/* ==========================================================================
   Google Ads Offline · Rubeus — Design System
   Vanilla CSS. Tema claro/escuro. Segue a estrutura do design system "Rubeus
   Signa" (Brand/Gray/Semantic + tokens Background/Border/Text/Icon).
   Fonte: Roboto (corpo e headings), confirmado pelo usuário.

   >>> LIMITAÇÃO CONHECIDA <<< os valores exatos de hex/espaçamento do Signa
   não são totalmente legíveis nas capturas de tela compartilhadas (resolução
   baixa nos mockups de header/sidebar). A ESTRUTURA (nomes de categoria,
   camadas de token) segue o que foi mostrado; os valores de cor são uma
   aproximação razoável em cima da marca já estabelecida. Compartilhar o link
   do Figma (mencionado como "Icon - figma file" na página de ícones) permite
   refinar pra valores exatos.
   ========================================================================== */

/* ----- Tokens -------------------------------------------------------------- */
:root {
    /* Brand/Primary — teal Rubeus */
    --brand-50:  #E3F6F3;
    --brand-100: #BEEBE4;
    --brand-200: #82D9CC;
    --brand-300: #45C2B0;
    --brand-400: #17AB9C;
    --brand-500: #0AA095;
    --brand-600: #08867D;
    --brand-700: #076F68;
    --brand-800: #065850;

    /* Brand/Secondary — slate-teal, acompanha o primary em tom mais neutro */
    --brand2-50:  #EAF1F1;
    --brand2-200: #A9C3C4;
    --brand2-500: #4E7679;
    --brand2-600: #3E5F62;
    --brand2-700: #314B4D;

    /* Brand/Tertiary — vermelho Rubeus (uso pontual: destaques, cards de realce) */
    --accent-50:  #FDEAEC;
    --accent-100: #FBCDD2;
    --accent-400: #F35B6B;
    --accent-500: #EF3E50;
    --accent-600: #D62E40;
    --accent-700: #B32334;

    /* Superfícies (tema claro) — conteúdo em branco puro, sidebar num cinza
       bem claro dedicado (confirmado pelo usuário: #FBFDFC). */
    --bg:            #FFFFFF;
    --sidebar-bg:    #FBFDFC;
    --bg-elevated:   #EEF2F1;
    --surface:       #FFFFFF;
    --surface-2:     #F6F8F7;
    --surface-hover: #EFF3F2;

    /* Texto */
    --text:        #201E1B;
    --text-soft:   #4E4B46;
    --text-muted:  #837E75;
    --text-onbrand:#FFFFFF;

    /* Bordas */
    --border:       #E3E7E6;
    --border-strong:#D3D9D7;

    /* Semantic */
    --success-fg: #0F7A52;  --success-bg: #E4F7EE;  --success-bd: #B7E7CF;
    --danger-fg:  #C0392B;  --danger-bg:  #FDEBE8;  --danger-bd:  #F5C7C0;
    --warning-fg: #9A6700;  --warning-bg: #FCF3DC;  --warning-bd: #F1DEA6;
    --info-fg:    #1F6FB2;  --info-bg:    #E7F1FB;  --info-bd:    #C4DEF4;

    /* Tokens (estilo MD3 do Signa): Background/Border/Text/Icon × primary/
       secondary/tertiary/disable. Por ora, aliases pros valores acima — dá
       pra usar esses nomes em componentes novos sem quebrar os existentes. */
    --bg-token-primary:    var(--brand-500);
    --bg-token-secondary:  var(--brand2-500);
    --bg-token-tertiary:   var(--accent-500);
    --bg-token-disable:    var(--bg-elevated);
    --border-token-primary:   var(--border-strong);
    --border-token-secondary: var(--brand-300);
    --border-token-tertiary:  var(--accent-400);
    --border-token-disable:   var(--border);
    --text-token-primary:   var(--text);
    --text-token-secondary: var(--brand-600);
    --text-token-tertiary:  var(--accent-600);
    --text-token-disable:   var(--text-muted);
    --icon-token-primary:   var(--text-soft);
    --icon-token-secondary: var(--brand-600);
    --icon-token-tertiary:  var(--accent-600);
    --icon-token-disable:   var(--text-muted);

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(32, 28, 20, .06);
    --shadow-md: 0 4px 14px rgba(32, 28, 20, .08);
    --shadow-lg: 0 18px 44px rgba(32, 28, 20, .14);
    --ring: 0 0 0 3px rgba(10, 160, 149, .22);

    /* Forma */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-xl: 24px;
    --r-pill: 999px;

    /* Tipografia — Roboto (corpo e headings), confirmado pelo usuário */
    --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-heading: var(--font);
    --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, monospace;

    /* Layout */
    --sidebar-w: 264px;
    --topbar-h: 72px;
    --maxw: 1080px;

    --transition: 160ms cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
    --brand-500: #22C4B2;
    --brand-600: #17AB9C;
    --brand-50:  #0F332F;

    --accent-500: #F35B6B;
    --accent-600: #EF3E50;
    --accent-50:  #341219;

    --bg:            #12110E;
    --sidebar-bg:    #171512;
    --bg-elevated:   #171512;
    --surface:       #1C1A16;
    --surface-2:     #221F1A;
    --surface-hover: #282420;

    --text:        #F1EEE7;
    --text-soft:   #C2BDB1;
    --text-muted:  #8C877C;
    --text-onbrand:#062E2A;

    --border:       #2E2A24;
    --border-strong:#3C372F;

    --success-fg: #57D69B;  --success-bg: #0E2C21;  --success-bd: #1C4A38;
    --danger-fg:  #F0857A;  --danger-bg:  #331916;  --danger-bd:  #5A2C26;
    --warning-fg: #E7C266;  --warning-bg: #2E2611;  --warning-bd: #4E421F;
    --info-fg:    #6FB6EF;  --info-bg:    #10263A;  --info-bd:    #244765;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, .45);
    --shadow-lg: 0 22px 50px rgba(0, 0, 0, .6);
    --ring: 0 0 0 3px rgba(34, 196, 178, .28);
}

/* ----- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
/* SVG é inline por padrão e fica "grudado" na baseline do texto, sobrando um
   respiro fantasma abaixo (espaço do descendente da fonte) — isso empurra o
   ícone visualmente pra cima de quem está ao lado dele (label de botão, item
   de menu, badge etc.), mesmo dentro de um flex com align-items:center. Virar
   display:block remove esse respiro e deixa a centralização do flex exata. */
svg { display: block; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
::selection { background: var(--brand-200); color: var(--brand-800); }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }

/* ----- Shell --------------------------------------------------------------- */
.app-shell {
    display: grid;
    grid-template-columns: auto 1fr;
    min-height: 100vh;
}

/* Sidebar: trilho de ícone (app ativo) + painel de navegação (páginas),
   inspirado no padrão de duas colunas usado nos produtos do CRM Rubeus. */
.sidebar-group {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    display: flex;
    flex-shrink: 0;
}

.icon-rail {
    width: 76px; flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; align-items: center;
    padding: 20px 0; gap: 16px;
}
.rail-mark { width: 34px; height: 34px; display: grid; place-items: center; flex-shrink: 0; }
.rail-mark img { width: 32px; height: 32px; }
.rail-app {
    width: 42px; height: 42px; border-radius: var(--r-md);
    display: grid; place-items: center;
    color: var(--text-muted);
}
.rail-app svg { width: 20px; height: 20px; }
.rail-app.active { background: var(--brand-50); color: var(--brand-600); }
[data-theme="dark"] .rail-app.active { color: var(--brand-500); }

.nav-panel {
    width: var(--sidebar-w); flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    gap: 4px;
    overflow-y: auto;
}
.nav-panel-head { padding: 4px 10px 18px; line-height: 1.25; }
.nav-panel-head strong { display: block; font-family: var(--font-heading); font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.nav-panel-head span { font-size: 11.5px; color: var(--text-muted); }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--r-md);
    color: var(--text-soft);
    font-weight: 550;
    font-size: 14px;
    text-align: left;
    transition: background var(--transition), color var(--transition);
}
.nav-item-ic { display: flex; flex-shrink: 0; opacity: .85; }
.nav-item-ic svg { width: 19px; height: 19px; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item:hover .nav-item-ic { opacity: 1; }
.nav-item.active .nav-item-ic { opacity: 1; }
.nav-item.active {
    background: var(--brand-50);
    color: var(--brand-600);
    font-weight: 650;
}
[data-theme="dark"] .nav-item.active { color: var(--brand-500); }

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* Usuário logado (placeholder até o login de verdade existir) */
.user-card {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface-2);
}
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--brand-50); color: var(--brand-600);
}
.user-avatar svg { width: 16px; height: 16px; }
.user-meta { min-width: 0; flex: 1; line-height: 1.25; }
.user-meta strong { display: block; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11px; color: var(--text-muted); }
.user-logout {
    width: 28px; height: 28px; border-radius: var(--r-sm); flex-shrink: 0;
    display: grid; place-items: center; color: var(--text-muted);
    transition: background var(--transition), color var(--transition);
}
.user-logout svg { width: 15px; height: 15px; }
.user-logout:hover { background: var(--danger-bg); color: var(--danger-fg); }
.env-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px;
    border-radius: var(--r-md);
    background: var(--warning-bg);
    color: var(--warning-fg);
    border: 1px solid var(--warning-bd);
    font-size: 12px;
    font-weight: 600;
}
.env-chip svg { width: 15px; height: 15px; }

.theme-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 12px;
    border-radius: var(--r-md);
    color: var(--text-soft);
    font-size: 13px; font-weight: 550;
    transition: background var(--transition);
}
.theme-toggle:hover { background: var(--surface-hover); }
.theme-toggle .tt-left { display: flex; align-items: center; gap: 10px; }
.theme-toggle svg { width: 18px; height: 18px; }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: var(--topbar-h);
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 16px;
    padding: 0 32px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.topbar-title h1 { font-size: 18px; font-weight: 680; letter-spacing: -.02em; }
.topbar-title p { font-size: 12.5px; color: var(--text-muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.conn-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 13px;
    border-radius: var(--r-pill);
    font-size: 12.5px; font-weight: 600;
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.conn-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.conn-pill.on { color: var(--success-fg); border-color: var(--success-bd); background: var(--success-bg); }
.conn-pill.on .dot { background: var(--success-fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success-fg) 25%, transparent); }
.conn-pill.off { color: var(--text-muted); }

.view-root { padding: 32px; max-width: var(--maxw); width: 100%; margin: 0 auto; }

/* ----- View header --------------------------------------------------------- */
.view-head { margin-bottom: 24px; }
.view-head h2 { font-size: 22px; font-weight: 720; letter-spacing: -.025em; }
.view-head p { color: var(--text-muted); font-size: 14px; margin-top: 5px; max-width: 62ch; }
.view-head-row { display: flex; align-items: flex-start; gap: 20px; }
.view-head-row .spacer { flex: 1; }

/* ----- Card ---------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card + .card { margin-top: 20px; }
.card-head {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.card-head .ch-icon {
    width: 34px; height: 34px; border-radius: var(--r-md);
    display: grid; place-items: center;
    background: var(--brand-50); color: var(--brand-600);
    flex-shrink: 0;
}
.card-head .ch-icon svg { width: 18px; height: 18px; }
.card-head h3 { font-size: 15px; font-weight: 650; }
.card-head p { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.card-head .ch-actions { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 22px; }
.card-body.tight { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
/* .card + .card soma 20px de margem pra empilhamento vertical — dentro de um
   grid horizontal como este os cards são "irmãos adjacentes" no DOM mesmo
   lado a lado, então herdavam essa margem e ficavam mais baixos que o
   primeiro (o espaçamento entre colunas já é o `gap` do grid). */
.grid-2 > .card + .card { margin-top: 0; }

/* ----- Stat tile ------------------------------------------------------------
   Inspirado num dashboard financeiro: badge de ícone colorido, número grande
   e um traço decorativo (mini "sparkline"). A variante .accent inverte pra
   fundo cheio na cor da marca — usada pra destacar a métrica mais relevante. */
.stat-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    display: flex; flex-direction: column; gap: 14px;
}
.stat-tile-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-ic {
    width: 36px; height: 36px; border-radius: var(--r-md);
    display: grid; place-items: center; flex-shrink: 0;
    background: var(--brand-50); color: var(--brand-600);
}
.stat-ic svg { width: 18px; height: 18px; }
.stat-tile-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.stat-tile-value { font-size: 27px; font-weight: 700; letter-spacing: -.03em; }
.stat-spark { width: 64px; height: 26px; flex-shrink: 0; opacity: .8; }
.stat-spark path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.stat-tile.accent {
    background: linear-gradient(155deg, var(--brand-500), var(--brand-700));
    border-color: transparent; color: var(--text-onbrand);
}
.stat-tile.accent .stat-ic { background: rgba(255,255,255,.16); color: var(--text-onbrand); }
.stat-tile.accent .stat-tile-label { color: rgba(255,255,255,.78); }
.stat-tile.accent .stat-spark { color: rgba(255,255,255,.9); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 860px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* ----- Buttons ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 18px;
    border-radius: var(--r-pill);
    font-size: 13.5px; font-weight: 600;
    border: 1px solid transparent;
    transition: background var(--transition), border-color var(--transition), transform var(--transition), opacity var(--transition);
    white-space: nowrap;
    user-select: none;
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Filled */
.btn-primary { background: var(--brand-500); color: var(--text-onbrand); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-600); }

/* Tonal — fundo suave na cor da marca, pra ações secundárias com destaque leve */
.btn-tonal { background: var(--brand-50); color: var(--brand-700); }
.btn-tonal:hover { background: var(--brand-100); }
[data-theme="dark"] .btn-tonal { color: var(--brand-500); }

/* Outline */
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-hover); }

/* Text */
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }

/* Outline (vermelho) */
.btn-danger { background: transparent; color: var(--danger-fg); border-color: var(--danger-bd); }
.btn-danger:hover { background: var(--danger-bg); }

.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 14.5px; }

/* ----- Forms --------------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label {
    display: block; font-size: 12.5px; font-weight: 600;
    margin-bottom: 7px; color: var(--text-soft);
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.req { color: var(--danger-fg); }

.help-ic {
    display: inline-flex; vertical-align: -3px;
    color: var(--text-muted); cursor: help;
}
.help-ic svg { width: 14px; height: 14px; }
.help-ic:hover { color: var(--text-soft); }

/* Campo "filled" (M3): fundo sólido, sem borda ao redor, só um traço inferior
   que engrossa e ganha a cor da marca no foco — como nos campos do Signa. */
.input, .select, .textarea {
    width: 100%;
    padding: 10px 13px;
    border: none;
    border-bottom: 1.5px solid var(--border-strong);
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    background: var(--surface-2);
    color: var(--text);
    font-size: 13.5px;
    transition: border-color var(--transition), background var(--transition), padding var(--transition);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-bottom-width: 2px; border-bottom-color: var(--brand-500);
    background: var(--surface); padding-bottom: 9.5px;
}
.input:disabled, .select:disabled { color: var(--text-muted); cursor: not-allowed; background: var(--bg-elevated); border-bottom-style: dashed; }
.textarea { resize: vertical; min-height: 84px; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2374858D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 38px;
}

/* Autocomplete (condições de Curso/Oferta — catálogo grande demais pra <select>) */
.ac-list {
    position: fixed; z-index: 200; min-width: 280px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--shadow-md);
    max-height: 260px; overflow-y: auto; padding: 6px;
}
.ac-item {
    padding: 12px 12px; min-height: 24px;
    font-size: 13.5px; line-height: 1.4; cursor: pointer;
    border-radius: var(--r-sm);
}
.ac-item:hover, .ac-item.active { background: var(--brand-50); color: var(--brand-700); }
[data-theme="dark"] .ac-item:hover, [data-theme="dark"] .ac-item.active { color: var(--brand-500); }

/* Copy field */
.copyfield { display: flex; gap: 8px; }
.copyfield .input { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: -.01em; }

/* Toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.switch .track {
    width: 40px; height: 23px; border-radius: 999px;
    background: var(--border-strong); transition: background var(--transition);
    position: relative; flex-shrink: 0;
}
.switch .track::after {
    content: ""; position: absolute; top: 2.5px; left: 2.5px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: var(--shadow-sm); transition: transform var(--transition);
}
.switch input:checked + .track { background: var(--brand-500); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* Checkbox row */
.check-row {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
    transition: border-color var(--transition), background var(--transition);
}
.check-row + .check-row { margin-top: 10px; }
.check-row:hover { border-color: var(--border-strong); }
.check-row.on { border-color: var(--brand-200); background: var(--brand-50); }
.check-box {
    width: 19px; height: 19px; border-radius: 4px; flex-shrink: 0; margin-top: 1px;
    border: 1.5px solid var(--border-strong); background: var(--surface);
    display: grid; place-items: center; transition: all var(--transition);
}
.check-box svg { width: 13px; height: 13px; color: #fff; opacity: 0; transform: scale(.6); transition: all var(--transition); }
.check-row.on .check-box { background: var(--brand-500); border-color: var(--brand-500); }
.check-row.on .check-box svg { opacity: 1; transform: scale(1); }
.check-row .cr-text strong { display: block; font-size: 13.5px; font-weight: 600; }
.check-row .cr-text span { font-size: 12.5px; color: var(--text-muted); }
.check-row.locked { opacity: .8; }

/* ----- Badges -------------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: var(--r-pill);
    font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
    border: 1px solid transparent;
}
.badge svg { width: 12px; height: 12px; }
.badge-success { color: var(--success-fg); background: var(--success-bg); border-color: var(--success-bd); }
.badge-danger  { color: var(--danger-fg);  background: var(--danger-bg);  border-color: var(--danger-bd); }
.badge-warning { color: var(--warning-fg); background: var(--warning-bg); border-color: var(--warning-bd); }
.badge-neutral { color: var(--text-muted); background: var(--bg-elevated); border-color: var(--border); }
.badge-info    { color: var(--info-fg);    background: var(--info-bg);    border-color: var(--info-bd); }

/* ----- Table --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
.tbl th {
    text-align: left; font-size: 12.5px; font-weight: 650;
    color: var(--text-soft);
    padding: 13px 18px; background: var(--surface);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.tbl td { padding: 15px 18px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background var(--transition); }
.tbl tbody tr:hover { background: var(--surface-hover); }
.tbl .mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-soft); }
.tbl .t-sub { font-size: 11.5px; color: var(--text-muted); }

/* ----- Instruction steps --------------------------------------------------- */
.guide {
    border: 1px solid var(--border);
    border-left: 3px solid var(--brand-500);
    border-radius: var(--r-md);
    background: var(--surface-2);
    padding: 20px 22px;
}
.guide-title { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 14px; margin-bottom: 4px; }
.guide-title svg { width: 18px; height: 18px; color: var(--brand-600); }
.guide-sub { font-size: 12.5px; color: var(--text-muted); margin-bottom: 16px; }
.steps { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 2px; }
.steps li { display: flex; gap: 14px; padding: 9px 0; }
.steps li::before {
    counter-increment: step; content: counter(step);
    width: 25px; height: 25px; flex-shrink: 0;
    border-radius: 50%; background: var(--brand-500); color: #fff;
    display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.steps li .st-body { font-size: 13.5px; padding-top: 1px; }
.steps li .st-body b { font-weight: 650; }
.pill-val {
    display: inline-block; font-family: var(--font-mono); font-size: 12px;
    padding: 1px 7px; border-radius: var(--r-sm);
    background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100);
}
[data-theme="dark"] .pill-val { color: var(--brand-500); }

/* ----- Empty / info -------------------------------------------------------- */
.empty {
    text-align: center; padding: 46px 24px; color: var(--text-muted);
}
.empty .em-icon {
    width: 52px; height: 52px; margin: 0 auto 14px;
    border-radius: var(--r-lg); display: grid; place-items: center;
    background: var(--bg-elevated); color: var(--text-muted);
}
.empty .em-icon svg { width: 24px; height: 24px; }
.empty h4 { font-size: 15px; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 40ch; margin: 0 auto; }

.notice {
    display: flex; gap: 12px; padding: 14px 16px;
    border-radius: var(--r-md); font-size: 13px;
    background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-bd);
}
.notice svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.notice.warn { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }

/* Account picker */
.acct { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); }
.acct .acct-ic { width: 38px; height: 38px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--info-bg); color: var(--info-fg); flex-shrink: 0; }
.acct .acct-ic svg { width: 19px; height: 19px; }
.acct .acct-meta strong { display: block; font-size: 13.5px; font-weight: 600; }
.acct .acct-meta span { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

/* Divider label */
.section-label { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 26px 0 12px; }
.section-label:first-child { margin-top: 0; }

/* ----- Toast --------------------------------------------------------------- */
.toast-wrap {
    position: fixed; bottom: 24px; right: 24px; z-index: 100;
    display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.toast {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 13px 15px; border-radius: var(--r-md);
    background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: toast-in .28s cubic-bezier(.2, .8, .2, 1);
}
.toast.out { animation: toast-out .22s ease forwards; }
.toast .ic { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.toast.success .ic { color: var(--success-fg); }
.toast.error .ic { color: var(--danger-fg); }
.toast.info .ic { color: var(--info-fg); }
.toast .msg { font-size: 13px; font-weight: 500; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ----- Modal --------------------------------------------------------------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(10, 20, 18, .5); backdrop-filter: blur(3px);
    display: grid; place-items: center; padding: 24px;
    animation: fade-in .18s ease;
}
.modal {
    width: 100%; max-width: 560px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg); overflow: hidden;
    animation: modal-in .24s cubic-bezier(.2, .8, .2, 1);
}
.modal-lg { max-width: 800px; }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { font-size: 16px; font-weight: 680; }
.modal-head .btn { margin-left: auto; }
.modal-body { padding: 24px; max-height: 64vh; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ----- Skeleton ------------------------------------------------------------ */
.skeleton {
    border-radius: var(--r-md);
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--surface-hover) 37%, var(--bg-elevated) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ----- Utilities ----------------------------------------------------------- */
.row { display: flex; gap: 12px; }
.row.between { justify-content: space-between; align-items: center; }
.row.end { justify-content: flex-end; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 8px; }
.mt-sm { margin-top: 10px; } .mt-md { margin-top: 18px; } .mt-lg { margin-top: 26px; }
.grow { flex: 1; }
.muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }
.hidden { display: none !important; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fade-in .25s ease; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ----- Responsive ---------------------------------------------------------- */
@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar-group {
        position: fixed; z-index: 40; left: 0; top: 0; height: 100vh;
        transform: translateX(-100%); transition: transform var(--transition);
        box-shadow: var(--shadow-lg);
    }
    .sidebar-group.open { transform: none; }
    .topbar { padding: 0 18px; }
    .view-root { padding: 20px 18px; }
    .menu-btn { display: inline-grid !important; }
    .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
}
.menu-btn { display: none; width: 38px; height: 38px; border-radius: var(--r-md); place-items: center; border: 1px solid var(--border); background: var(--surface); }
.menu-btn svg { width: 20px; height: 20px; }
