/* ============================================================
   ORBIK ADMIN — Sistema de Gestão Premium
   Design: Futurista / Azul / Preto / Branco
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    /* Cores primárias */
    --blue-50:  #eff6ff;
    --blue-100: #dbeafe;
    --blue-300: #93c5fd;
    --blue-400: #60a5fa;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --blue-800: #1e40af;
    --blue-900: #1e3a8a;

    /* Dark surface */
    --bg-base:      #060b18;
    --bg-surface:   #0a1020;
    --bg-card:      #0d1526;
    --bg-elevated:  #111a2e;
    --bg-hover:     #162035;
    --bg-active:    #1a2840;

    /* Borders */
    --border-subtle:  rgba(59, 130, 246, 0.08);
    --border-default: rgba(59, 130, 246, 0.15);
    --border-strong:  rgba(59, 130, 246, 0.30);
    --border-glow:    rgba(59, 130, 246, 0.50);

    /* Text */
    --text-primary:   #f0f4ff;
    --text-secondary: #8fa3c7;
    --text-muted:     #4d6080;
    --text-accent:    #60a5fa;

    /* Status */
    --success: #10b981;
    --warning: #f59e0b;
    --danger:  #ef4444;
    --info:    #06b6d4;

    /* Sizes */
    --sidebar-w:         240px;
    --sidebar-collapsed: 68px;
    --topbar-h:          60px;
    --radius-sm:         6px;
    --radius-md:         10px;
    --radius-lg:         14px;
    --radius-xl:         20px;

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(0,0,0,.4);
    --shadow-md:  0 4px 16px rgba(0,0,0,.5);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.6);
    --shadow-glow: 0 0 24px rgba(59,130,246,.18);

    /* Typography */
    --font-display: 'Syne', sans-serif;
    --font-body:    'DM Sans', sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--text-accent); text-decoration: none; }
a:hover { color: var(--blue-300); }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width .25s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--blue-500), transparent);
    opacity: .5;
}

/* Brand */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: var(--topbar-h);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: .5px;
    white-space: nowrap;
}

.brand-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    filter: drop-shadow(0 0 8px rgba(59,130,246,.5));
}

.brand-dot { color: var(--blue-500); }

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: color .2s, background .2s;
    flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-default) transparent;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: .875rem;
    font-weight: 500;
    position: relative;
    white-space: nowrap;
    transition: color .2s, background .2s;
    text-decoration: none;
}

.nav-item svg { flex-shrink: 0; transition: transform .2s; }

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-item.active {
    color: var(--blue-400);
    background: rgba(59,130,246,.1);
}

.nav-item.active svg { transform: scale(1.05); }

.nav-active-bar {
    position: absolute;
    right: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--blue-500);
    border-radius: 3px 0 0 3px;
    box-shadow: 0 0 8px var(--blue-500);
}

/* Sidebar footer / user card */
.sidebar-footer {
    padding: 10px 8px 12px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
}

.user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.user-name {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: .7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: .75rem;
    color: #fff;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

.user-avatar.sm { width: 30px; height: 30px; font-size: .7rem; }

.logout-btn {
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    transition: color .2s;
}
.logout-btn:hover { color: var(--danger); }

/* Collapsed sidebar */
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .brand-name,
.sidebar.collapsed .user-info {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .user-card { padding: 8px; justify-content: center; }
.sidebar.collapsed .user-card .logout-btn { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .sidebar-toggle { display: none; }
.sidebar.collapsed .brand-icon { margin: 0; }

/* ── Main wrapper ───────────────────────────────────────────── */
.main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    transition: margin-left .25s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed ~ .main-wrapper {
    margin-left: var(--sidebar-collapsed);
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: rgba(10, 16, 32, .95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

/* Search */
.topbar-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 7px 14px;
    max-width: 380px;
    width: 100%;
    transition: border-color .2s, box-shadow .2s;
}

.topbar-search:focus-within {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-glow);
}

.topbar-search svg { color: var(--text-muted); flex-shrink: 0; }

.topbar-search input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: .85rem;
    width: 100%;
}

.topbar-search input::placeholder { color: var(--text-muted); }

/* Topbar button */
.topbar-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color .2s, border-color .2s, background .2s;
    position: relative;
}

.topbar-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-default);
    background: var(--bg-hover);
}

/* Notification */
.notification-wrapper { position: relative; }

.notif-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-surface);
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
    display: none;
    animation: dropIn .18s ease;
}

.notif-dropdown.open { display: block; }

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: .825rem;
    font-weight: 600;
}

.notif-mark-all {
    background: none;
    border: none;
    color: var(--blue-400);
    font-size: .75rem;
    cursor: pointer;
}

.notif-list { max-height: 320px; overflow-y: auto; }

.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background .2s;
    cursor: pointer;
}

.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: rgba(59,130,246,.04); }

.notif-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--blue-500);
    margin-top: 5px;
    flex-shrink: 0;
}

.notif-item.unread .notif-dot { box-shadow: 0 0 6px var(--blue-500); }
.notif-item:not(.unread) .notif-dot { background: var(--text-muted); }

.notif-text { font-size: .8rem; color: var(--text-primary); line-height: 1.4; }
.notif-time { font-size: .7rem; color: var(--text-muted); margin-top: 2px; }

.notif-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: .85rem;
}

.notif-footer {
    display: block;
    padding: 10px 16px;
    text-align: center;
    font-size: .78rem;
    color: var(--blue-400);
    border-top: 1px solid var(--border-subtle);
    transition: background .2s;
}

.notif-footer:hover { background: var(--bg-hover); color: var(--blue-300); }

/* Clock */
.topbar-clock {
    font-size: .78rem;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 500;
    white-space: nowrap;
}

/* ── Page content ───────────────────────────────────────────── */
.page-content {
    flex: 1;
    padding: 28px 28px 40px;
    max-width: 1600px;
    width: 100%;
}

/* ── Page header ────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-subtitle {
    font-size: .85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.page-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
}

.card:hover {
    border-color: var(--border-default);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.card-title {
    font-family: var(--font-display);
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 20px; }

/* Stat cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: border-color .25s, transform .25s, box-shadow .25s;
    cursor: default;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent, var(--blue-500));
    opacity: .7;
}

.stat-card:hover {
    border-color: var(--border-default);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 42px; height: 42px;
    border-radius: var(--radius-md);
    background: rgba(59,130,246,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue-400);
    margin-bottom: 14px;
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-card .stat-label {
    font-size: .78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.stat-card .stat-change {
    position: absolute;
    top: 20px; right: 20px;
    font-size: .72rem;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.stat-change.up   { color: var(--success); background: rgba(16,185,129,.1); }
.stat-change.down { color: var(--danger);  background: rgba(239,68,68,.1);  }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .2s;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--blue-600);
    color: #fff;
    border-color: var(--blue-600);
    box-shadow: 0 0 12px rgba(37,99,235,.3);
}
.btn-primary:hover {
    background: var(--blue-700);
    color: #fff;
    box-shadow: 0 0 20px rgba(37,99,235,.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-default);
}
.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(239,68,68,.1);
    color: var(--danger);
    border-color: rgba(239,68,68,.3);
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-success {
    background: rgba(16,185,129,.1);
    color: var(--success);
    border-color: rgba(16,185,129,.3);
}
.btn-success:hover { background: var(--success); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-lg { padding: 11px 24px; font-size: .95rem; }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Icon buttons */
.btn-icon {
    width: 34px; height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .2s;
}
.btn-icon:hover { color: var(--text-primary); border-color: var(--border-default); background: var(--bg-hover); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

label, .form-label {
    display: block;
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.form-control,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"],
input[type="tel"], input[type="url"], select, textarea {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 9px 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: .875rem;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    -webkit-appearance: none;
}

.form-control:focus,
input[type="text"]:focus, input[type="email"]:focus,
input[type="password"]:focus, input[type="number"]:focus,
input[type="date"]:focus, input[type="time"]:focus,
input[type="tel"]:focus, input[type="url"]:focus,
select:focus, textarea:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238fa3c7' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

select option { background: var(--bg-card); color: var(--text-primary); }

textarea { resize: vertical; min-height: 90px; }

.form-text { font-size: .75rem; color: var(--text-muted); margin-top: 5px; }

.form-error {
    font-size: .75rem;
    color: var(--danger);
    margin-top: 4px;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

table { width: 100%; border-collapse: collapse; }

thead th {
    background: var(--bg-elevated);
    padding: 12px 16px;
    text-align: left;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background .15s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
    padding: 13px 16px;
    font-size: .85rem;
    color: var(--text-primary);
    vertical-align: middle;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .04em;
}

.badge-success { background: rgba(16,185,129,.12);  color: var(--success); }
.badge-warning { background: rgba(245,158,11,.12);  color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,.12);   color: var(--danger);  }
.badge-info    { background: rgba(6,182,212,.12);   color: var(--info);    }
.badge-primary { background: rgba(59,130,246,.12);  color: var(--blue-400); }
.badge-secondary { background: rgba(255,255,255,.06); color: var(--text-muted); }

/* ── Grid layout helpers ────────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

/* ── Flash / Alert ──────────────────────────────────────────── */
.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    font-size: .85rem;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    animation: flashIn .25s ease;
}

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flash-success { background: rgba(16,185,129,.1); color: var(--success); border-color: rgba(16,185,129,.2); }
.flash-error   { background: rgba(239,68,68,.1);  color: var(--danger);  border-color: rgba(239,68,68,.2);  }
.flash-info    { background: rgba(6,182,212,.1);  color: var(--info);    border-color: rgba(6,182,212,.2);  }
.flash-warning { background: rgba(245,158,11,.1); color: var(--warning); border-color: rgba(245,158,11,.2); }

.flash-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: .9rem;
    opacity: .7;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    padding: 20px 0;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: .82rem;
    font-weight: 500;
    transition: all .2s;
}
.page-link:hover, .page-link.active {
    background: var(--blue-600);
    border-color: var(--blue-600);
    color: #fff;
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.7);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp .2s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-sm { max-width: 400px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1100px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    width: 30px; height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color .2s, background .2s;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-body { padding: 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .2s, border-color .2s;
    white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--blue-400); border-color: var(--blue-500); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Overlay for mobile sidebar ─────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 999;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Utility ────────────────────────────────────────────────── */
.text-muted    { color: var(--text-muted); }
.text-accent   { color: var(--text-accent); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.text-sm       { font-size: .8rem; }
.text-xs       { font-size: .72rem; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.font-mono     { font-family: 'Courier New', monospace; }
.font-display  { font-family: var(--font-display); }

.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end   { justify-content: flex-end; }
.gap-2         { gap: 8px; }
.gap-3         { gap: 12px; }
.gap-4         { gap: 16px; }
.flex-1        { flex: 1; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4  { padding: 16px; }
.p-6  { padding: 24px; }

.w-full { width: 100%; }
.hidden { display: none; }

/* Divider */
.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 20px 0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg { opacity: .3; margin-bottom: 16px; }
.empty-state h3  { font-size: 1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p   { font-size: .85rem; }

/* Loading spinner */
.spinner {
    width: 24px; height: 24px;
    border: 2px solid var(--border-default);
    border-top-color: var(--blue-500);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s cubic-bezier(.4,0,.2,1);
        width: var(--sidebar-w) !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-overlay.visible { display: block; }

    .main-wrapper { margin-left: 0 !important; }

    .mobile-menu-btn { display: flex; }

    .page-content { padding: 20px 16px 32px; }

    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }

    .page-header { flex-direction: column; gap: 12px; }

    .topbar { padding: 0 16px; }

    .topbar-search { max-width: 200px; }

    .topbar-clock { display: none; }
}
