/* =====================================================================
   FINVERO - design system
   "Controle hoje. Construa amanhã."
   Dark mode nativo (padrao) + light mode via [data-theme="light"].
   Sem framework, sem build step: um arquivo, zero dependencia externa.

   Paleta oficial FinVero:
     Preto Profundo  #080A0C  fundo principal
     Grafite         #111418  cards e secoes
     Grafite Medio   #1C2126  bordas / elementos secundarios
     Prata           #D9DDE1  textos e elementos
     Branco          #F5F7F8  titulos e textos principais
     Dourado FinVero #D9A72E  destaques / CTAs
     Dourado Claro   #F2C75C  hover / icones
     Dourado Escuro  #9A6B13  gradientes / profundidade
   ===================================================================== */

/* --- Tokens ---------------------------------------------------------- */
:root {
    --bg-base:      #080A0C;
    --bg-surface:   #111418;
    --bg-elevated:  #15191E;
    --bg-hover:     #1C2126;
    --bg-input:     #0D1013;

    --border:       #1C2126;
    --border-soft:  #16191E;

    --text:         #F5F7F8;
    --text-muted:   #D9DDE1;
    --text-faint:   #7C838A;

    --accent:       #D9A72E;
    --accent-soft:  rgba(217, 167, 46, 0.14);
    --accent-hover: #F2C75C;
    --accent-deep:  #9A6B13;

    --up:           #2FBF71;
    --up-soft:      rgba(47, 191, 113, 0.14);
    --down:         #E5484D;
    --down-soft:    rgba(229, 72, 77, 0.14);
    --warn:         #D97706;
    --warn-soft:    rgba(217, 119, 6, 0.14);

    --radius:       10px;
    --radius-sm:    7px;
    --radius-lg:    14px;

    --shadow:       0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.32);
    --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.4);

    --sidebar-w:    240px;
    --topbar-h:     62px;

    --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    --mono: "JetBrains Mono", "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
}

[data-theme="light"] {
    --bg-base:      #F7F6F3;
    --bg-surface:   #FFFFFF;
    --bg-elevated:  #FFFFFF;
    --bg-hover:     #F1EEE7;
    --bg-input:     #FAF9F6;

    --border:       #E3DFD6;
    --border-soft:  #EDEAE2;

    --text:         #17191B;
    --text-muted:   #55585C;
    --text-faint:   #8A8D91;

    --accent:       #B8860F;
    --accent-soft:  rgba(184, 134, 15, 0.12);
    --accent-hover: #9A6B13;
    --accent-deep:  #7A5410;

    --up:           #14874B;
    --up-soft:      rgba(20, 135, 75, 0.10);
    --down:         #C62A2F;
    --down-soft:    rgba(198, 42, 47, 0.10);
    --warn:         #B45F06;
    --warn-soft:    rgba(180, 95, 6, 0.12);

    --shadow:       0 1px 2px rgba(23, 25, 27, 0.06), 0 8px 24px rgba(23, 25, 27, 0.08);
    --shadow-sm:    0 1px 2px rgba(23, 25, 27, 0.06);
}

/* --- Reset ----------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background: var(--bg-base);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }
p  { margin: 0 0 10px; }

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

svg { display: block; }

::selection { background: var(--accent-soft); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- Estrutura ------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    z-index: 40;
    overflow-y: auto;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 18px;
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.sidebar__logo {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: grid; place-items: center;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar__logo svg { width: 100%; height: 100%; display: block; }

.sidebar__name { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }

.sidebar__nav { padding: 12px 10px; flex: 1; }

.sidebar__group-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    padding: 14px 10px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13.5px;
    transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; stroke-width: 1.9; }

.sidebar__footer {
    padding: 10px;
    border-top: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: color-mix(in srgb, var(--bg-base) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 22px;
    z-index: 30;
}

.topbar__title { font-size: 15px; font-weight: 600; }
.topbar__spacer { flex: 1; }

.topbar__networth {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.25;
}
.topbar__networth-label { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.topbar__networth-value { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }

.content { padding: 22px; flex: 1; max-width: 1560px; width: 100%; }

.page-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.page-head__text { flex: 1; min-width: 200px; }
.page-head__sub { color: var(--text-muted); font-size: 13px; margin: 3px 0 0; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Cards ----------------------------------------------------------- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.card__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
}
.card__head h2, .card__head h3 { flex: 1; min-width: 0; }
.card__body { padding: 16px; }
.card__body--flush { padding: 0; }
.card__foot {
    padding: 11px 16px;
    border-top: 1px solid var(--border-soft);
    font-size: 12.5px;
    color: var(--text-muted);
}

/* --- Grid ------------------------------------------------------------ */
.grid { display: grid; gap: 14px; }
.grid--stats  { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--2      { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--3      { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--main   { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.grid--form   { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

@media (max-width: 1100px) {
    .grid--main { grid-template-columns: minmax(0, 1fr); }
}

/* --- Stat ------------------------------------------------------------ */
.stat {
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 15px 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.stat__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat__value {
    font-size: 23px;
    font-weight: 650;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
}
.stat__value--sm { font-size: 18px; }
.stat__meta { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.stat--accent { border-color: color-mix(in srgb, var(--accent) 34%, transparent); }

/* --- Semantica de sinal ---------------------------------------------- */
.is-up    { color: var(--up); }
.is-down  { color: var(--down); }
.is-flat  { color: var(--text-muted); }
.is-warn  { color: var(--warn); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.pill.is-up   { background: var(--up-soft); }
.pill.is-down { background: var(--down-soft); }
.pill.is-flat { background: var(--bg-hover); }
.pill.is-warn { background: var(--warn-soft); }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--bg-hover);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}
.tag__dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* --- Botoes ---------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 550;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, opacity 0.12s;
    white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; stroke-width: 2; }

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn--danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 35%, transparent); }
.btn--danger:hover { background: var(--down-soft); color: var(--down); }

.btn--ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn--sm { padding: 5px 10px; font-size: 12.5px; }
.btn--icon { padding: 6px; }
.btn--icon svg { width: 15px; height: 15px; }
.btn--block { width: 100%; }

/* --- Formularios ----------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.label__hint { font-weight: 400; color: var(--text-faint); font-size: 11.5px; }

.input, .select, .textarea {
    width: 100%;
    padding: 8px 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input--money { font-variant-numeric: tabular-nums; text-align: right; }
.input.has-error, .select.has-error { border-color: var(--down); }

.textarea { min-height: 68px; resize: vertical; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238C9BB5' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

.field__error { color: var(--down); font-size: 12px; }
.field__help  { color: var(--text-faint); font-size: 11.5px; }

.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row > * { flex: 1; min-width: 130px; }
.form-row > .form-row__fixed { flex: 0 0 auto; min-width: 0; }

/* --- Tabelas --------------------------------------------------------- */
.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
    text-align: left;
    padding: 9px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    font-weight: 600;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 1;
}
.table th.is-sortable { cursor: pointer; user-select: none; }
.table th.is-sortable:hover { color: var(--text); }
.table th[data-sort-dir="asc"]::after  { content: " ↑"; color: var(--accent); }
.table th[data-sort-dir="desc"]::after { content: " ↓"; color: var(--accent); }

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-hover); }

.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table__ticker { font-weight: 650; letter-spacing: -0.01em; }
.table__sub { font-size: 11.5px; color: var(--text-faint); }
.table tfoot td {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

/* --- Barra de progresso ---------------------------------------------- */
.bar {
    height: 7px;
    border-radius: 999px;
    background: var(--bg-hover);
    overflow: hidden;
}
.bar__fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 0.3s ease;
}
.bar__fill.is-up   { background: var(--up); }
.bar__fill.is-down { background: var(--down); }
.bar__fill.is-warn { background: var(--warn); }
.bar--lg { height: 11px; }

/* --- Flash / alertas ------------------------------------------------- */
.flash-stack {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(400px, calc(100vw - 28px));
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 13px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    box-shadow: var(--shadow);
    font-size: 13px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert__text { flex: 1; }
.alert--success { border-color: color-mix(in srgb, var(--up) 40%, transparent); color: var(--up); }
.alert--error   { border-color: color-mix(in srgb, var(--down) 40%, transparent); color: var(--down); }
.alert--warning { border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.alert--info    { border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent); }

.alert--inline { position: static; box-shadow: none; margin-bottom: 14px; }

.notice {
    padding: 11px 13px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--accent);
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.55;
}
.notice--warn { border-left-color: var(--warn); }

/* --- Estado vazio ---------------------------------------------------- */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 44px 22px;
    text-align: center;
    color: var(--text-muted);
}
.empty svg { width: 34px; height: 34px; color: var(--text-faint); stroke-width: 1.5; }
.empty__title { font-weight: 600; color: var(--text); font-size: 14.5px; }
.empty__text { font-size: 13px; max-width: 380px; }

/* --- Tabs ------------------------------------------------------------ */
.tabs {
    display: flex;
    gap: 3px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 16px;
    overflow-x: auto;
}
.tab {
    padding: 8px 13px;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 550;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    background: none;
    border-top: none; border-left: none; border-right: none;
    font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* --- Segmented (seletor de periodo) ---------------------------------- */
.segmented {
    display: inline-flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}
.segmented a, .segmented button {
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 12.5px;
    font-weight: 550;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.segmented a:hover, .segmented button:hover { color: var(--text); background: var(--bg-hover); }
.segmented .is-active { background: var(--accent); color: #fff; }
.segmented .is-active:hover { background: var(--accent); color: #fff; }

/* --- Modal ----------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 15, 0.66);
    backdrop-filter: blur(2px);
    z-index: 80;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}
.modal-backdrop.is-open { display: flex; }

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}
.modal--wide { max-width: 760px; }
.modal__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border-soft);
}
.modal__head h2 { flex: 1; }
.modal__body { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 13px; }
.modal__foot {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 13px 18px;
    border-top: 1px solid var(--border-soft);
}

/* --- Graficos -------------------------------------------------------- */
.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }

.chart__tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 7px 10px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 5;
    font-variant-numeric: tabular-nums;
}
.chart__tooltip.is-visible { opacity: 1; }
.chart__tooltip-label { color: var(--text-faint); font-size: 11px; }
.chart__tooltip-value { font-weight: 650; }

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 12.5px;
}
.chart-legend__item { display: flex; align-items: center; gap: 8px; }
.chart-legend__dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.chart-legend__label { flex: 1; color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-legend__value { font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-legend__pct { color: var(--text-faint); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-wrap .chart { flex: 0 0 168px; max-width: 168px; }
.donut-wrap .chart-legend { flex: 1; min-width: 190px; }

.donut__center-value { font-size: 15px; font-weight: 650; fill: var(--text); }
.donut__center-label { font-size: 9.5px; fill: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }

/* --- Lista compacta -------------------------------------------------- */
.list { display: flex; flex-direction: column; }
.list__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-soft);
}
.list__item:last-child { border-bottom: none; }
.list__item:hover { background: var(--bg-hover); }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__sub { font-size: 11.5px; color: var(--text-faint); }
.list__value { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }

/* --- Utilitarios ----------------------------------------------------- */
.muted   { color: var(--text-muted); }
.faint   { color: var(--text-faint); }
.small   { font-size: 12.5px; }
.tiny    { font-size: 11.5px; }
.bold    { font-weight: 650; }
.mono    { font-family: var(--mono); }
.num     { font-variant-numeric: tabular-nums; }
.right   { text-align: right; }
.center  { text-align: center; }
.nowrap  { white-space: nowrap; }
.row     { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.col     { display: flex; flex-direction: column; gap: 8px; }
.gap-lg  { gap: 14px; }
.mt      { margin-top: 14px; }
.mt-sm   { margin-top: 8px; }
.mb      { margin-bottom: 14px; }
.mb-sm   { margin-bottom: 8px; }
.flex-1  { flex: 1; min-width: 0; }
.hidden  { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stale-badge {
    font-size: 10.5px;
    color: var(--warn);
    background: var(--warn-soft);
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-elevated) 50%, var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Auth ------------------------------------------------------------ */
.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
    background:
        radial-gradient(circle at 15% 10%, rgba(91, 141, 239, 0.10), transparent 42%),
        radial-gradient(circle at 85% 88%, rgba(47, 191, 113, 0.08), transparent 42%),
        var(--bg-base);
}
.auth__card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px;
}
.auth__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth__brand-text { display: flex; flex-direction: column; gap: 1px; }
.auth__tagline { font-size: 11px; color: var(--text-faint); letter-spacing: 0.01em; }
.auth__title { font-size: 19px; margin-bottom: 4px; }
.auth__sub { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.auth__form { display: flex; flex-direction: column; gap: 13px; }
.auth__foot { margin-top: 18px; text-align: center; font-size: 13px; color: var(--text-muted); }

.code-input {
    font-family: var(--mono);
    font-size: 22px;
    letter-spacing: 0.36em;
    text-align: center;
    padding: 11px;
}

.secret-box {
    font-family: var(--mono);
    font-size: 15px;
    letter-spacing: 0.09em;
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 13px;
    text-align: center;
    word-break: break-all;
    user-select: all;
}

.recovery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 7px;
    font-family: var(--mono);
    font-size: 13.5px;
}
.recovery-grid span {
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 7px;
    text-align: center;
    user-select: all;
}

/* --- Menu de usuario -------------------------------------------------- */
.user-menu { position: relative; }
.user-menu__trigger {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    text-align: left;
}
.user-menu__trigger:hover { background: var(--bg-hover); }
.user-menu__avatar {
    width: 27px; height: 27px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid; place-items: center;
    font-weight: 650; font-size: 11.5px;
    flex-shrink: 0;
}
.user-menu__info { flex: 1; min-width: 0; }
.user-menu__name { font-weight: 600; font-size: 13px; }
.user-menu__email { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; }

.user-menu__dropdown {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 5px;
    display: none;
    z-index: 50;
}
.user-menu__dropdown.is-open { display: block; }
.user-menu__dropdown a, .user-menu__dropdown button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 9px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}
.user-menu__dropdown a:hover, .user-menu__dropdown button:hover { background: var(--bg-hover); color: var(--text); }
.user-menu__dropdown svg { width: 15px; height: 15px; }

/* --- Mobile ----------------------------------------------------------- */
.sidebar__toggle { display: none; }
.sidebar__scrim { display: none; }

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: var(--shadow);
    }
    .sidebar.is-open { transform: translateX(0); }

    .sidebar__scrim {
        position: fixed;
        inset: 0;
        background: rgba(4, 8, 15, 0.55);
        z-index: 35;
    }
    .sidebar__scrim.is-open { display: block; }

    .main { margin-left: 0; }
    .sidebar__toggle { display: inline-flex; }
    .content { padding: 14px; }
    .topbar { padding: 0 14px; }
    .topbar__title { font-size: 14px; }

    .grid--main { grid-template-columns: minmax(0, 1fr); }
    .stat__value { font-size: 20px; }

    .table th, .table td { padding: 9px 10px; }
    .table th:first-child, .table td:first-child { position: sticky; left: 0; background: var(--bg-surface); z-index: 2; }
    .table tbody tr:hover td:first-child { background: var(--bg-hover); }

    .modal-backdrop { padding: 14px; align-items: flex-end; }
    .modal { max-height: calc(100vh - 28px); }

    .flash-stack { left: 12px; right: 12px; max-width: none; }
}

@media (max-width: 520px) {
    .page-head__actions { width: 100%; }
    .page-head__actions .btn { flex: 1; }
    .donut-wrap { justify-content: center; }
    .form-row > * { min-width: 100%; }
}

@media print {
    .sidebar, .topbar, .page-head__actions, .flash-stack, .btn { display: none !important; }
    .main { margin-left: 0; }
    body { background: #fff; color: #000; }
}
