/* ════════════════════════════════════════════════════════
   Laís Lagreca Nail Designer — Design System
   Estética: premium, feminina, elegante, minimalista.
   ════════════════════════════════════════════════════════ */

:root {
    /* Paleta Laís Lagreca Nail Designer — vinho/marsala + rosé queimado + rosé gold.
       Nomes "rose/plum/sage" mantidos p/ compatibilidade com o CSS existente.
       Cores de STATUS (sucesso/alerta/erro/info) seguem coloridas. */
    --rose-50:  #FBF5F3;
    --rose-100: #E9D8D2;   /* fundo secundário (bege rosado) */
    --rose-200: #DCC4BD;
    --rose-300: #C8A27A;   /* accent claro — rosé gold */
    --rose-400: #CB98A3;
    --rose-500: #B87583;   /* secundária — rosé queimado */
    --rose-600: #9A4E61;   /* links */
    --rose-700: #7A3045;   /* mais forte — vinho/marsala */

    --plum-700: #8E4055;
    --plum-800: #7A3045;   /* sidebar/texto forte */
    --plum-900: #5A2233;

    --sage-300: #C8A27A;   /* accent (marca) — rosé gold */
    --sage-500: #B87583;   /* mid (marca — menu ativo) */
    --sage-600: #4F7D5E;   /* sucesso (STATUS — segue verde) */

    --gold-400: #C8A27A;   /* alerta (status) */
    --danger:   #C1484A;   /* erro (status) */
    --info:     #5E8C93;   /* informação (status) */
    --success:  #4F7D5E;   /* sucesso (status) */

    --bg:       #F6EFEC;   /* fundo principal — nude muito claro */
    --surface:  #FFFDFC;   /* off-white */
    --surface-2:#F2E7E3;   /* superfície secundária (linhas/cartões internos) */
    --border:   #E5D5D0;
    --muted:    #77686B;   /* texto secundário — taupe */
    --muted-soft:#9C8C8F;  /* SÓ decorativo/ícones — não use em texto */
    --text:     #302629;   /* texto principal — marrom quase preto */

    /* Aliases semânticos (paleta oficial) */
    --primary:   #7A3045;
    --primary-fill: #7A3045;   /* primary usado como FUNDO (texto branco em cima) */
    --secondary: #B87583;
    --accent:    #C8A27A;
    --card:      #FFFDFC;
    --warning:   #C8A27A;

    /* Pares de estado (fundo + texto) — STATUS seguem coloridos */
    --ok-bg:     #E6EFE8; --ok-fg:     #3F6B4D;
    --warn-bg:   #F7ECDF; --warn-fg:   #8A6326;
    --danger-bg: #F8E7E7; --danger-fg: #A64545;
    --info-bg:   #E5EFF0; --info-fg:   #46767D;

    --radius:   16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(48,38,41,.06), 0 1px 3px rgba(48,38,41,.04);
    --shadow:    0 4px 16px rgba(48,38,41,.08);
    --shadow-lg: 0 12px 40px rgba(48,38,41,.12);

    --sidebar-w: 256px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--rose-600); text-decoration: none; }
a:hover { color: var(--rose-700); }

/* ───── Layout shell ───── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--plum-800);
    color: #fff;
    padding: 24px 16px;
    position: fixed; inset: 0 auto 0 0;
    display: flex; flex-direction: column;
    z-index: 40;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 12px 24px;
    font-weight: 700; font-size: 18px; letter-spacing: -.02em;
}
.sidebar .brand .logo {
    width: 36px; height: 36px; border-radius: 11px;
    background: linear-gradient(135deg, var(--sage-500), var(--sage-300));
    display: grid; place-items: center; font-size: 18px;
    box-shadow: 0 4px 14px rgba(122,48,69,.35);
}
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: rgba(255,255,255,.4); margin: 18px 12px 8px; font-weight: 600; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: rgba(255,255,255,.78); font-weight: 500;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease; margin-bottom: 2px;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active {
    background: var(--sage-500);
    color: #fff; box-shadow: 0 4px 14px rgba(122,48,69,.35);
}
.nav-link .ico { width: 20px; text-align: center; opacity: .9; }

.sidebar .user-card {
    margin-top: auto; padding: 12px; border-radius: var(--radius-sm);
    background: rgba(255,255,255,.06); display: flex; align-items: center; gap: 10px;
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%; flex: 0 0 36px;
    background: linear-gradient(135deg, var(--sage-300), var(--sage-500));
    display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 14px;
}

/* ───── Conteúdo ───── */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
    height: 68px; background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.content { padding: 28px; max-width: none; width: 100%; min-width: 0; }
/* Evita rolagem horizontal da página em qualquer tela (notebooks inclusive).
   Tabelas largas rolam dentro do próprio .table-wrap, não a página toda. */
html, body { overflow-x: hidden; }
.app-shell { max-width: 100vw; overflow-x: clip; }
.main { min-width: 0; }

/* ───── Cards ───── */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; }

/* ───── KPIs ───── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 18px; }
.kpi {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
    transition: transform .15s ease, box-shadow .15s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; }
.kpi .ico-badge {
    width: 40px; height: 40px; border-radius: 12px; float: right;
    display: grid; place-items: center; font-size: 18px;
    background: var(--rose-100); color: var(--rose-600);
}
.kpi.sage .ico-badge { background: #e7f0ea; color: var(--sage-600); }
.kpi.gold .ico-badge { background: #faf0e2; color: var(--gold-400); }
.kpi.danger .ico-badge { background: #fbe9e9; color: var(--danger); }
.kpi .trend { font-size: 12px; font-weight: 600; margin-top: 8px; }
.trend.up { color: var(--sage-600); } .trend.down { color: var(--danger); }

/* ───── Tabela ───── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
    text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border);
}
table.data td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--rose-50); }

/* ───── Badges ───── */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge.healthy   { background: var(--ok-bg); color: var(--ok-fg); }
.badge.attention { background: var(--warn-bg); color: var(--warn-fg); }
.badge.risk      { background: var(--danger-bg); color: var(--danger-fg); }
.badge.paid      { background: var(--ok-bg); color: var(--ok-fg); }
.badge.open      { background: var(--rose-100); color: var(--rose-600); }
.badge.overdue   { background: var(--danger-bg); color: var(--danger-fg); }
.badge.info      { background: var(--info-bg); color: var(--info-fg); }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.healthy { background: var(--sage-500); }
.dot.attention { background: var(--gold-400); }
.dot.risk { background: var(--danger); }

/* ───── Botões ───── */
.btn {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 10px 18px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
    border: 1px solid transparent; transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.btn-primary { background: #EEF0F3; color: var(--primary); border-color: #E5D5D0;
    box-shadow: none; }
.btn-primary:hover { background: var(--rose-200); transform: translateY(-1px); color: var(--primary); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--rose-50); border-color: var(--rose-200); }

/* ───── Foco visível (teclado) — A11y WCAG 2.4.7 ─────
   Anel consistente em qualquer alvo interativo, inclusive os clicáveis
   não-nativos (role="button") promovidos pelo a11y.js. */
:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}
.sidebar :focus-visible { outline-color: var(--accent); }   /* contraste sobre o deep-ocean */
/* o input já tem anel próprio (box-shadow) — evita duplicar */
.field input:focus-visible { outline: none; }

/* ───── Alertas ───── */
.alert {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    border-radius: var(--radius-sm); margin-bottom: 10px; font-weight: 500; font-size: 13.5px;
    border: 1px solid transparent;
}
.alert.info    { background: var(--rose-50); border-color: var(--rose-100); color: var(--rose-700); }
.alert.warning { background: var(--warn-bg); border-color: #f0dcc0; color: var(--warn-fg); }
.alert.danger  { background: var(--danger-bg); border-color: #f3d2d2; color: var(--danger-fg); }

/* ───── Health bar ───── */
.health-bar { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; width: 90px; }
.health-bar > span { display: block; height: 100%; border-radius: 999px; }

/* ───── Login ───── */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art {
    background: linear-gradient(155deg, var(--plum-900) 0%, var(--plum-800) 42%, var(--sage-500) 100%);
    color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 64px;
    position: relative; overflow: hidden;
}
.auth-art::before {
    content: ""; position: absolute; width: 360px; height: 360px; border-radius: 50%;
    background: radial-gradient(circle, rgba(164,195,178,.35), transparent 70%);
    top: -130px; left: -110px;
}
.auth-art::after {
    content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%);
    bottom: -120px; right: -120px;
}
.auth-art h2 { font-size: 34px; line-height: 1.2; letter-spacing: -.03em; margin: 0 0 16px; }
.auth-art p { opacity: .8; font-size: 16px; max-width: 380px; }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-form .box { width: 100%; max-width: 380px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field input {
    width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14.5px; font-family: var(--font); transition: border .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--rose-400); box-shadow: 0 0 0 3px var(--rose-100); }

.helper { color: var(--muted); font-size: 12.5px; }
.flex { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap { gap: 12px; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; }

/* ───── Mobile: drawer + tab bar ───── */
.nav-hamburger { display: none; background: none; border: none; cursor: pointer; font-size: 22px;
    color: var(--text); padding: 4px 8px; margin-right: 4px; }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 39; display: none; }
.sidebar-overlay.show { display: block; }
.mobile-tabbar { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--border);
    justify-content: space-around; align-items: stretch;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 12px rgba(0,0,0,.06); }
.mobile-tabbar a, .mobile-tabbar button { flex: 1; background: none; border: none; cursor: pointer;
    color: var(--muted); font-size: 10.5px; font-weight: 600; text-align: center; padding: 4px 0; }
.mobile-tabbar .ti { display: block; font-size: 21px; line-height: 1; margin-bottom: 2px; }
.mobile-tabbar a.active2 { color: var(--rose-600); }

/* Botão de ação flutuante (mobile) */
.fab-wrap { display: none; }
.fab { width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer; color: #fff; font-size: 28px; line-height: 1;
    background: var(--plum-800); box-shadow: 0 8px 24px rgba(48,38,41,.4); transition: transform .2s; }
.fab-wrap.open .fab { transform: rotate(45deg); }
.fab-menu { position: absolute; bottom: 64px; right: 0; display: flex; flex-direction: column; gap: 8px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s, transform .18s; }
.fab-menu.open { opacity: 1; pointer-events: auto; transform: none; }
.fab-menu button { white-space: nowrap; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 16px; font-weight: 600; box-shadow: var(--shadow-sm); cursor: pointer; color: var(--text); }
@media (max-width: 900px) { .fab-wrap { display: block; position: fixed; right: 16px; bottom: 84px; z-index: 55; } }

/* ───── Responsivo ───── */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); width: 280px; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-art { display: none; }
    .nav-hamburger { display: inline-block; }
    .mobile-tabbar { display: flex; }
    .content { padding: 16px; padding-bottom: 84px; }
    .topbar { padding: 0 14px; height: 60px; }
    .topbar h1 { font-size: 17px; }
    .hide-mobile { display: none !important; }
    .dash-cols, .profile-cols, .week-grid { grid-template-columns: 1fr !important; }
    .card-pad { padding: 16px; }
}

/* Modais (overlay fixo): nunca passam da tela — rolagem interna, no desktop e mobile */
[style*="position:fixed"][style*="inset:0"] > .card,
[style*="position: fixed"][style*="inset: 0"] > .card {
    max-height: 92vh;
    overflow-y: auto;
}

/* ════════ Mobile responsivo — passe global ════════ */

/* Tablets/celulares: empilha QUALQUER grid de 2+ colunas e barras laterais fixas */
@media (max-width: 820px) {
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr 1fr"],
    [style*="grid-template-columns:2fr 1fr"],
    [style*="grid-template-columns: 2fr 1fr"],
    [style*="grid-template-columns:1.4fr 1fr"],
    [style*="grid-template-columns:1.5fr 1fr"],
    [style*="grid-template-columns:repeat(2,"],
    [style*="grid-template-columns:repeat(3,"],
    [style*="grid-template-columns:repeat(4,"],
    [style*="grid-template-columns: repeat(2,"],
    [style*="grid-template-columns: repeat(3,"],
    [style*="grid-template-columns: repeat(4,"],
    [style*="320px 1fr"], [style*="340px 1fr"], [style*="360px 1fr"], [style*="300px 1fr"], [style*="280px 1fr"],
    [style*="240px 1fr"], [style*="260px 1fr"], [style*="220px 1fr"], [style*="200px 1fr"],
    [style*="1fr 320px"], [style*="1fr 340px"], [style*="1fr 360px"], [style*="1fr 300px"], [style*="1fr 280px"] {
        grid-template-columns: 1fr !important;
    }
    .kpi-grid { grid-template-columns: 1fr 1fr !important; }
}

/* Telas pequenas */
@media (max-width: 600px) {
    .kpi-grid { grid-template-columns: 1fr !important; }
    h1 { font-size: 17px; }
    .btn { padding: 9px 12px; }
    /* iOS não dá zoom em campos com fonte ≥16px */
    input, select, textarea { font-size: 16px !important; }
    /* evita rolagem horizontal da página inteira */
    html, body { overflow-x: hidden; max-width: 100%; }
    .content { padding: 14px; padding-bottom: 88px; }
}

/* Tabelas: rolagem horizontal própria no celular, mantendo colunas legíveis */
@media (max-width: 760px) {
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    /* a própria tabela rola e não deixa as colunas espremerem (nowrap) */
    .content table.data { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    .content table.data th, .content table.data td { padding: 11px 12px; }
    /* dentro de um wrapper que já rola, a tabela volta a ser table normal com piso de largura */
    .table-wrap table.data { display: table; width: 100%; min-width: 560px; white-space: normal; }

    /* Tabelas marcadas com .tcards: cada linha vira um CARTÃO (rótulo + valor) */
    .content table.data.tcards, .table-wrap table.data.tcards { display: block; min-width: 0; overflow: visible; white-space: normal; }
    .content table.data.tcards thead { display: none; }
    .content table.data.tcards tbody { display: block; }
    .content table.data.tcards tr { display: block; border: 1px solid var(--border); border-radius: 14px; padding: 4px 14px; margin-bottom: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
    .content table.data.tcards td { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 9px 0; border: none; border-bottom: 1px solid var(--border); text-align: right; }
    .content table.data.tcards td:last-child { border-bottom: none; }
    .content table.data.tcards td::before { content: attr(data-label); color: var(--muted); font-weight: 700; font-size: 12px; text-align: left; white-space: nowrap; }
    .content table.data.tcards td[data-label=""]::before, .content table.data.tcards td.nolabel::before { display: none; }
    .content table.data.tcards td[data-label=""], .content table.data.tcards td.nolabel { justify-content: flex-end; }
    .content table.data.tcards td:empty { display: none; }
}

/* Modais viram "bottom sheet" no celular: largura cheia, presos embaixo, com rolagem */
@media (max-width: 600px) {
    [style*="position:fixed"][style*="inset:0"] > .card,
    [style*="position: fixed"][style*="inset: 0"] > .card {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 18px 18px 0 0 !important;
        position: fixed; left: 0; right: 0; bottom: 0; top: auto;
        animation: sheet-up .22s ease;
    }
    @keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
    /* botões de ação em linha quebram em vez de estourar */
    .card-pad > .flex.gap, .card-pad .flex.between { flex-wrap: wrap; }
}

/* ───── Reduced motion (A11y) — vale em QUALQUER página que use este CSS,
   inclusive o login e telas fora do shell. Encurta em vez de remover, p/
   preservar estados finais. O shell tem override próprio; aqui é o piso. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ════════════════════════════════════════════════════════
   DARK MODE — ativado por <html data-theme="dark"> (toggle na topbar).
   Estratégia: redefine os TOKENS (cobre todo componente que usa var()),
   ajusta os poucos componentes com hex fixo, e tem uma REDE DE SEGURANÇA
   p/ os estilos inline claros (#fff e tints) muito usados nas views.
   Escopo: telas autenticadas (shell). Login/impressão/marketing não setam
   data-theme, então permanecem claros de propósito.
   NOTA: seletor `html[data-theme]` (0,1,1) p/ vencer o `:root` (0,1,0) que o
   Theme::styleTag injeta depois com a paleta do tenant. ═══════════════════ */
html[data-theme="dark"] {
    --bg:        #0E1116;
    --surface:   #171B21;
    --surface-2: #1F242C;
    --card:      #171B21;
    --border:    #2A313B;
    --text:      #E6E9ED;
    --muted:     #A2ABB6;   /* ≥4.5:1 sobre --surface */
    --muted-soft:#7C8794;

    /* --primary é usado como COR DE TEXTO/realce em muitos lugares → claro no dark */
    --primary:   #C7CFD8;
    --secondary: #9AA3AE;
    --accent:    #C8A27A;

    /* rampa "rose-*" → tons de cinza escuros / textos claros */
    --rose-50:  #1A1F26;
    --rose-100: #20262F;
    --rose-200: #2A313B;
    --rose-300: #3A424D;
    --rose-600: #C7CFD8;
    --rose-700: #E6E9ED;
    --sage-300: #3A424D;

    /* sidebar um pouco mais escura que o conteúdo */
    --plum-800: #0B0E12;
    --plum-900: #07090C;

    /* pares de estado: fundo escuro + texto claro (STATUS seguem coloridos) */
    --ok-bg:     #16332a; --ok-fg:     #8FD6B4;
    --warn-bg:   #33291a; --warn-fg:   #E6B877;
    --danger-bg: #3a1f1f; --danger-fg: #F0A59A;
    --info-bg:   #123139; --info-fg:   #7ED3DD;

    --primary-fill: #3A4754;   /* fundo "ativo/selecionado" no dark — texto branco legível em cima */

    --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
    --shadow:    0 4px 16px rgba(0,0,0,.5);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.6);

    color-scheme: dark;
}
/* estados "ativo/selecionado" com fundo primary (inline ou em classe) — fundo escuro + texto claro */
[data-theme="dark"] [style*="background:var(--primary)" i],
[data-theme="dark"] [style*="background: var(--primary)" i] { background-color: var(--primary-fill) !important; color: #EAF5EF !important; }
/* destaque "hoje" (cinza claro #F2E7E3) → fica grafite legível no dark + texto branco */
[data-theme="dark"] [style*="background:#F2E7E3" i],
[data-theme="dark"] [style*="background: #F2E7E3" i],
[data-theme="dark"] [style*="background:#e5f1ed" i] { background-color: var(--primary-fill) !important; }
[data-theme="dark"] th[style*="#F2E7E3" i],
[data-theme="dark"] th[style*="#F2E7E3" i] *,
[data-theme="dark"] th[style*="#e5f1ed" i],
[data-theme="dark"] th[style*="#e5f1ed" i] * { color: #fff !important; }

/* Relatórios no dark: zebra/linha "clara" vira cinza forte legível (texto claro em cima) */
[data-theme="dark"] .tab-pane table.data th,
[data-theme="dark"] .tab-pane table.data tr.tot td { background: #2E343F !important; color: var(--text) !important; }
[data-theme="dark"] .tab-pane table.data tbody tr:nth-child(even) td { background: #262C36 !important; }
[data-theme="dark"] [style*="background:#fafbfb" i] { background-color: #262C36 !important; }
[data-theme="dark"] [style*="background:#f4f6f5" i] { background-color: var(--surface-2) !important; }

/* Agenda no dark: cards de AULA no MESMO padrão dos cards de legenda (chips de instrutor) —
   tint sutil da cor do instrutor sobre a superfície ESCURA (não mais o pastel claro --cc-bg) +
   texto claro (var(--text)), com a borda na cor cheia (--cc). Se color-mix não for suportado,
   o fundo inline (cor +14) já entrega o mesmo tint sobre o fundo escuro como fallback.
   A Agenda Interna (.se-internal) NÃO entra aqui: usa as cores do bloqueio (cinza), iguais nos dois temas. */
[data-theme="dark"] .sess-lesson,
[data-theme="dark"] .agd-card,
[data-theme="dark"] .rec-card {
    background: color-mix(in srgb, var(--cc, var(--secondary)) 16%, var(--surface)) !important;
    border-color: var(--cc, var(--secondary)) !important;
}
[data-theme="dark"] .sess-lesson, [data-theme="dark"] .sess-lesson *,
[data-theme="dark"] .agd-card, [data-theme="dark"] .agd-card *,
[data-theme="dark"] .rec-card, [data-theme="dark"] .rec-card * {
    color: var(--text) !important;
}
/* Agenda Interna usa as MESMAS cores do bloqueio (.se-blocked, cinza #9A4E61) no claro e no dark —
   não precisa de override dark próprio (a cor base cinza já funciona nos dois temas). */

/* Componentes com hex fixo que os tokens não alcançam */
[data-theme="dark"] body { background: var(--bg); }
[data-theme="dark"] .btn-primary { background: #2A323C; color: #E6E9ED; border-color: #3A434F; }
[data-theme="dark"] .btn-primary:hover { background: #353F4B; color: #FFFFFF; }
[data-theme="dark"] .kpi.sage .ico-badge,
[data-theme="dark"] .kpi.gold .ico-badge,
[data-theme="dark"] .kpi.danger .ico-badge,
[data-theme="dark"] .kpi .ico-badge { background: var(--surface-2); }
[data-theme="dark"] .pf-gsearch-results a:hover,
[data-theme="dark"] .pf-gsearch-results a.gs-active { background: var(--surface-2); }

/* ── Rede de segurança p/ estilos INLINE claros nas views ──
   `i` = case-insensitive. Só fundos/textos (não bordas) p/ evitar falso-positivo. */
[data-theme="dark"] [style*="background:#fff" i],
[data-theme="dark"] [style*="background: #fff" i],
[data-theme="dark"] [style*="background:#ffffff" i],
[data-theme="dark"] [style*="background: #ffffff" i] { background-color: var(--surface) !important; }

[data-theme="dark"] [style*="background:#f8fafa" i],
[data-theme="dark"] [style*="background:#f7fafb" i],
[data-theme="dark"] [style*="background:#f3f4f5" i],
[data-theme="dark"] [style*="background:#eef5f3" i],
[data-theme="dark"] [style*="background: #eef5f3" i],
[data-theme="dark"] [style*="background:#eef4f3" i],
[data-theme="dark"] [style*="background:#eef5f6" i],
[data-theme="dark"] [style*="background:#eef6f3" i],
[data-theme="dark"] [style*="background:#eef3f1" i],
[data-theme="dark"] [style*="background:#f6faf8" i],
[data-theme="dark"] [style*="background:#dcefe7" i],
[data-theme="dark"] [style*="background:#e7f0ea" i] { background-color: var(--surface-2) !important; }

/* textos escuros fixos → claros */
[data-theme="dark"] [style*="color:#7A3045" i],
[data-theme="dark"] [style*="color: #7A3045" i] { color: var(--text) !important; }
[data-theme="dark"] [style*="color:#0f3d3e" i],
[data-theme="dark"] [style*="color: #0f3d3e" i],
[data-theme="dark"] [style*="color:#0e4d5e" i] { color: var(--primary) !important; }

/* o anel de foco precisa contrastar com o fundo escuro */
[data-theme="dark"] :focus-visible { outline-color: var(--accent); }

/* Form controls no dark: fundo escuro + texto claro + lista de options escura.
   !important p/ vencer estilos inline claros nos campos das telas. */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--muted) !important; }
[data-theme="dark"] option { background-color: var(--surface); color: var(--text); }

/* ════════════════════════════════════════════════════════
   NAVEGAÇÃO "FIO" — fita condutora + Índice (cortina) + paleta Ctrl/⌘K.
   Substitui a sidebar/topbar no shell autenticado. Tokens = tema claro/escuro
   automáticos. As classes .sidebar/.topbar antigas seguem no CSS p/ telas
   próprias (Super Admin) e regras de impressão das views.
   ════════════════════════════════════════════════════════ */
.pf-strip {
    position: sticky; top: 0; z-index: 45;
    display: flex; align-items: center; gap: 14px;
    min-height: 56px; padding: 0 24px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .pf-strip { background: var(--bg); }
}
.pf-logo {
    width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px;
    background: linear-gradient(135deg, var(--sage-500), var(--sage-300));
    display: inline-grid; place-items: center; color: #fff; font-size: 14px;
    overflow: hidden;
}
.pf-logo img { width: 100%; height: 100%; object-fit: contain; }
.pf-crumb { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pf-crumb-studio { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
.pf-crumb-sep { color: var(--muted-soft); }
.pf-crumb-mod {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    font-weight: 700; font-size: 14.5px; font-family: inherit; color: var(--text);
    background: none; border: none;
    padding: 6px 10px; margin: -6px -10px; border-radius: 9px;
    transition: background .15s ease;
}
.pf-crumb-mod:hover { background: var(--rose-100); }
.pf-chev { transition: transform .25s cubic-bezier(.16,1,.3,1); color: var(--muted); }
.pf-crumb-mod[aria-expanded="true"] .pf-chev { transform: rotate(180deg); }
.pf-crumb-leaf { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-strip-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pf-omnibox {
    display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
    min-width: 225px; padding: 8px 13px; border-radius: 10px;
    color: var(--muted); font-size: 13px; font-family: inherit;
    border: 1px solid var(--border); background: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.pf-omnibox:hover { border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(122,48,69,.12); }
.pf-omnibox kbd {
    margin-left: auto; font: 600 10.5px/1 var(--font); color: var(--muted);
    border: 1px solid var(--border); border-bottom-width: 2px;
    border-radius: 5px; padding: 3px 5px; background: var(--surface-2);
}
.pf-iconbtn { padding: 8px 10px !important; }
.pf-search-m { display: none !important; }
.pf-avatar { width: 32px; height: 32px; flex: 0 0 32px; font-size: 13px; }

/* ── Barra de favoritos (atalhos horizontais sob a fita, só desktop) ── */
.pf-favbar {
    position: sticky; top: 56px; z-index: 44;
    display: flex; align-items: center; gap: 4px;
    padding: 5px 24px;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
    overflow-x: auto; scrollbar-width: none;
}
.pf-favbar::-webkit-scrollbar { display: none; }
@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .pf-favbar { background: var(--bg); }
}
.pf-fav {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none;
    padding: 5px 11px; border-radius: 8px;
    transition: background .15s ease, color .15s ease;
}
.pf-fav:hover { background: var(--rose-100); color: var(--text); }
.pf-fav.on { background: var(--surface-2); color: var(--primary); box-shadow: inset 0 0 0 1px var(--border); }
.pf-fav-emoji { font-size: 13px; line-height: 1; }
@media (max-width: 900px) { .pf-favbar { display: none; } }

/* ── Índice do estúdio (cortina) ── */
.pf-dim {
    position: fixed; inset: 0; z-index: 68;
    background: rgba(48,38,41,.35);
    opacity: 0; pointer-events: none; transition: opacity .28s cubic-bezier(.16,1,.3,1);
}
.pf-dim.on { opacity: 1; pointer-events: auto; }
.pf-curtain {
    position: fixed; left: 0; right: 0; top: 0; z-index: 70;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-102%); transition: transform .32s cubic-bezier(.16,1,.3,1);
    max-height: 94vh; overflow: auto;
}
.pf-curtain.open { transform: none; }
.pf-curtain-in { max-width: 1280px; margin: 0 auto; padding: 26px 32px 24px; }
.pf-curtain-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.pf-curtain-head h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0; }
.pf-curtain-close {
    color: var(--muted); font-size: 12.5px; font-weight: 600; font-family: inherit;
    background: none; border: none; cursor: pointer; padding: 6px 10px; border-radius: 8px;
}
.pf-curtain-close:hover { background: var(--surface-2); color: var(--text); }
.pf-mods { display: grid; grid-template-columns: repeat(4, 1fr); row-gap: 30px; }
.pf-mod {
    padding: 2px 26px 4px; border-left: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 7px;
    opacity: 0; transform: translateY(10px);
}
.pf-mods > .pf-mod:nth-child(4n+1) { border-left: none; padding-left: 0; }
.pf-curtain.open .pf-mod {
    opacity: 1; transform: none;
    transition: opacity .36s cubic-bezier(.16,1,.3,1), transform .36s cubic-bezier(.16,1,.3,1);
}
.pf-curtain.open .pf-mod:nth-child(2) { transition-delay: .03s; }
.pf-curtain.open .pf-mod:nth-child(3) { transition-delay: .06s; }
.pf-curtain.open .pf-mod:nth-child(4) { transition-delay: .09s; }
.pf-curtain.open .pf-mod:nth-child(5) { transition-delay: .06s; }
.pf-curtain.open .pf-mod:nth-child(6) { transition-delay: .09s; }
.pf-curtain.open .pf-mod:nth-child(7) { transition-delay: .12s; }
.pf-curtain.open .pf-mod:nth-child(8) { transition-delay: .15s; }
.pf-mod-name {
    display: flex; align-items: baseline; gap: 8px;
    font-size: 20px; font-weight: 800; letter-spacing: -.02em; color: var(--primary);
    text-decoration: none; transition: color .15s ease;
}
.pf-mod-name:hover { color: var(--secondary); }
.pf-mod.on .pf-mod-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.pf-key {
    font-size: 10.5px; font-weight: 600; color: var(--muted-soft);
    border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px;
    transform: translateY(-4px);
}
.pf-mod-chapters { display: flex; flex-wrap: wrap; gap: 2px 13px; margin-top: 2px; }
.pf-mod-chapters a {
    font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none;
    padding: 2px 0; border-bottom: 1px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}
.pf-mod-chapters a:hover { color: var(--primary); border-color: var(--primary); }
.pf-mod-chapters a.on { color: var(--primary); border-bottom-color: var(--primary); }
.pf-curtain-foot {
    margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--border);
    display: flex; gap: 22px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap;
}
.pf-curtain-foot kbd {
    font: 600 10.5px/1 var(--font); border: 1px solid var(--border); border-bottom-width: 2px;
    border-radius: 5px; padding: 2px 5px; background: var(--surface-2); margin-right: 3px;
}
.pf-foot-user { margin-left: auto; }
.pf-foot-user a { color: var(--text); text-decoration: none; }
.pf-foot-user a:hover { color: var(--danger); }

/* ── Cabeçalho de página (o título/data que ficava na topbar) ── */
.pf-pagehead { margin-bottom: 18px; }
.pf-pagehead h1 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.pf-pagehead .sub { color: var(--muted); font-size: 13px; margin-top: 1px; }

/* ── Paleta (Ctrl/⌘K) ── */
.pf-palette-wrap {
    position: fixed; inset: 0; z-index: 230;
    display: none; align-items: flex-start; justify-content: center;
    padding: 12vh 20px 20px;
    background: rgba(48,38,41,.4);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.pf-palette-wrap.on { display: flex; }
.pf-palette {
    width: min(580px, 100%); background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); overflow: hidden;
    animation: pf-pal-in .2s cubic-bezier(.16,1,.3,1);
}
@keyframes pf-pal-in { from { opacity: 0; transform: scale(.97) translateY(-8px); } to { opacity: 1; transform: none; } }
.pf-palette input {
    width: 100%; border: none; outline: none;
    padding: 16px 20px; font: 500 15px/1.3 var(--font); color: var(--text);
    border-bottom: 1px solid var(--border); background: transparent;
}
.pf-palette input::placeholder { color: var(--muted); font-weight: 400; }
.pf-pal-list { max-height: 46vh; overflow: auto; padding: 8px; }
.pf-pal-group { font-size: 11px; font-weight: 700; color: var(--muted); padding: 11px 13px 4px; }
.pf-pal-item {
    display: flex; align-items: baseline; gap: 11px; width: 100%; text-align: left;
    padding: 10px 13px; border-radius: 10px; font-size: 14px; font-weight: 500;
    background: none; border: none; cursor: pointer; color: var(--text); font-family: inherit;
}
.pf-pal-item .pre { color: var(--muted-soft); width: 17px; font-weight: 600; flex: 0 0 17px; }
.pf-pal-item.sel { background: var(--surface-2); }
.pf-pal-item.sel .pre { color: var(--secondary); }
.pf-pal-sub { color: var(--muted); font-size: 11.5px; font-weight: 400; }
.pf-pal-empty { padding: 18px 13px; color: var(--muted); font-size: 13.5px; }

/* ── Responsivo ── */
@media (max-width: 1080px) {
    .pf-mods { grid-template-columns: repeat(2, 1fr); }
    .pf-mods > .pf-mod:nth-child(4n+1) { border-left: 1px solid var(--border); padding-left: 26px; }
    .pf-mods > .pf-mod:nth-child(2n+1) { border-left: none; padding-left: 0; }
}
@media (max-width: 900px) {
    .pf-strip { padding: 0 14px; gap: 10px; min-height: 54px; }
    .pf-search-m { display: inline-flex !important; }
    .pf-avatar { display: none; }
    .pf-curtain-in { padding: 20px 18px 18px; }
    .pf-mods { grid-template-columns: 1fr; row-gap: 22px; }
    .pf-mods > .pf-mod { border-left: none; padding-left: 0; }
    .pf-mod-name { font-size: 18px; }
    .pf-foot-user { margin-left: 0; }
    .pf-pagehead h1 { font-size: 17px; }
}
/* Impressão: a navegação some, o conteúdo fica */
@media print {
    .pf-strip, .pf-favbar, .pf-dim, .pf-curtain, .pf-palette-wrap, .mobile-tabbar, .fab-wrap { display: none !important; }
    .content { padding: 0 !important; }
}
