/* ── Tema claro (padrão) ─────────────────────────────────────────── */
:root {
    --bg:              #f0f2f5;
    --surface:         #ffffff;
    --border:          #e2e8f0;
    --accent:          #6366f1;
    --accent-dim:      #4f46e5;
    --text:            #0f172a;
    --muted:           #64748b;
    --danger:          #ef4444;
    --success:         #16a34a;
    --warning:         #d97706;
    --radius:          10px;
    --radius-sm:       6px;
    --btn-primary-fg:  #ffffff;
    --row-hover:       rgba(0,0,0,.03);
    --shadow:          0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --editor-bg:       #ffffff;
    --editor-toolbar:  #f8fafc;
    --editor-border:   #cbd5e1;
    --editor-text:     #0f172a;
    --info-bg:         rgba(99,102,241,.06);
    --info-border:     rgba(99,102,241,.2);
    --logo-rect:       #6366f1;
    --nav-admin-color: #6366f1;
}

/* ── Tema escuro ─────────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg:              #0f0f1a;
    --surface:         #1a1a2e;
    --border:          #2a2a42;
    --accent:          #e8ff47;
    --accent-dim:      #b8cc2a;
    --text:            #e8e8f0;
    --muted:           #7878a0;
    --danger:          #ff5c6a;
    --success:         #4ade80;
    --warning:         #fbbf24;
    --btn-primary-fg:  #0f0f1a;
    --row-hover:       rgba(255,255,255,.02);
    --shadow:          0 1px 3px rgba(0,0,0,.4);
    --editor-bg:       #1e2235;
    --editor-toolbar:  #252840;
    --editor-border:   #2a2a42;
    --editor-text:     #e8e8f0;
    --info-bg:         rgba(232,255,71,.06);
    --info-border:     rgba(232,255,71,.2);
    --logo-rect:       #1a1a2e;
    --nav-admin-color: #e8ff47;
}

/* ── Transição suave ao trocar tema ──────────────────────────────── */
body, main, .card, .auth-box, .auth-wrap,
.field input, .field select, .tbl td, .tbl th,
.btn, .btn-logout, .toast, .badge, .nav-dropdown-menu,
.sidebar, .topbar {
    transition: background-color .25s ease, color .25s ease, border-color .25s ease;
}

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

html { font-size: 14px; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ── Footer ───────────────────────────────────────────────────────── */
.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 32px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 48px;
}

.footer-trust {
    display: flex;
    align-items: center;
    gap: 14px;
}

.icp-seal {
    width: 200px;
    height: auto;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.12));
}

[data-theme="dark"] .icp-seal {
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.4)) brightness(0.92);
}

.footer-trust-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.footer-trust-title {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text);
}

.footer-trust-sub {
    font-size: .72rem;
    color: var(--muted);
}

.footer-copy {
    font-size: .75rem;
    color: var(--muted);
}

/* ── Topbar legacy (mantido para compatibilidade; não usado no layout atual) */
.site-topnav {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 24px;
    box-shadow: var(--shadow);
}

/* ── Hamburger (mobile only) ──────────────────────────────────── */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 7px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    transition: background .15s;
}

.nav-hamburger:hover { background: var(--border); }

.nav-hamburger span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
    transform-origin: center;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile overlay ───────────────────────────────────────────── */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 150;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: overlayIn .2s ease;
}

.nav-overlay.open { display: block; }

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

/* ── Mobile drawer ────────────────────────────────────────────── */
.nav-mobile-menu {
    position: fixed;
    top: 0; left: 0;
    width: min(300px, 85vw);
    height: 100dvh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
}

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

.nav-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 56px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.nav-mobile-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    border-radius: var(--radius-sm);
    transition: background .15s, color .15s;
}

.nav-mobile-close:hover { background: var(--border); color: var(--text); }

.nav-mobile-links { flex: 1; padding: 8px 0; }

.nav-mobile-section {
    display: block;
    padding: 14px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

.nav-mobile-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: background .1s;
    border-radius: 0;
}

.nav-mobile-link:hover { background: var(--row-hover); color: var(--text); }

.nav-mobile-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px 10px 36px;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    transition: background .1s, color .1s;
}

.nav-mobile-sub:hover { background: var(--row-hover); color: var(--text); }

.nav-mobile-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.nav-mobile-user {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Responsivo ───────────────────────────────────────────────── */
@media (max-width: 1023px) {
    nav {
        gap: 12px;
        padding: 0 16px;
        overflow: hidden;
    }
    .nav-hamburger { display: flex; flex-shrink: 0; }
    .nav-links     { display: none !important; }
    .nav-user      { display: none !important; }
    .nav-brand     { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    letter-spacing: -.01em;
}

.nav-links {
    display: flex;
    gap: 2px;
    flex: 1;
    align-items: center;
}

.nav-link {
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 500;
    transition: all .15s;
}

.nav-link:hover {
    background: var(--border);
    color: var(--text);
}

/* ── Admin dropdown ───────────────────────────────────────────────── */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    color: var(--nav-admin-color);
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    background: transparent;
    border: none;
    transition: all .15s;
}

.nav-dropdown-btn:hover { background: var(--border); }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 160px;
    padding: 6px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    transition: all .15s;
}

.nav-dropdown-menu a:hover {
    background: var(--border);
    color: var(--text);
}

/* ── Theme toggle button ──────────────────────────────────────────── */
.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--border);
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: var(--accent);
    color: var(--btn-primary-fg);
    border-color: var(--accent);
}

/* ── Nav user ─────────────────────────────────────────────────────── */
.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-name {
    font-size: 13px;
    color: var(--muted);
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}

.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ── Main container ───────────────────────────────────────────────── */
main {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 36px 20px;
}

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

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -.02em;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.back-link:hover { color: var(--text); }

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ── Two-column ───────────────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 640px) {
    .grid-2 { grid-template-columns: 1fr; }
}

/* ── Forms ────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 6px;
}

.field input,
.field select {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s, background-color .25s;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
}

.field input[type="file"] {
    padding: 7px;
    color: var(--muted);
    cursor: pointer;
}

.field small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--muted);
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: var(--btn-primary-fg);
}

.btn-primary:hover {
    background: var(--accent-dim);
    color: var(--btn-primary-fg);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    border-color: var(--text);
    color: var(--text);
}

.btn-danger-ghost {
    background: transparent;
    color: var(--danger);
    border: 1px solid transparent;
}

.btn-danger-ghost:hover {
    border-color: var(--danger);
}

.btn-sm   { padding: 5px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

button:disabled { opacity: .4; cursor: not-allowed; }

/* ── Table ────────────────────────────────────────────────────────── */
.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tbl th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .07em;
    border-bottom: 1px solid var(--border);
}

.tbl td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}

.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--row-hover); }

.tbl-actions { display: flex; gap: 6px; align-items: center; }

/* ── Coluna truncada com toggle inline ─────────────────────────────────────
   Aplicado em colunas de texto que comprimem botões Assinar/WhatsApp. Texto
   > 15 chars vira "primeiras10…" + ícone de expandir clicável. JS em
   wwwroot/js/tbl-truncate.js cuida do binding e do estado.                  */
.tbl-trunc { word-break: normal; }
.tbl-trunc-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px;
    margin-left: 6px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--muted);
    cursor: pointer;
    vertical-align: middle;
    transition: color .12s, border-color .12s, background .12s;
}
.tbl-trunc-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.tbl-trunc-toggle[aria-expanded="true"] {
    color: var(--accent);
    border-color: var(--accent);
}

/* Wrapper para scroll horizontal em tabelas — mobile */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Componentes reutilizáveis de listagem ────────────────────────── */
.table-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.data-table th {
    text-align: left;
    padding: 9px 14px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--bg);
}
.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--row-hover); }

.td-truncate {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .8rem;
    color: var(--muted);
}
.td-date   { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.td-center { text-align: center; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--muted);
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.empty-state p { margin: .25rem 0; font-size: .9rem; }
.empty-state svg { opacity: .25; margin-bottom: .5rem; }

.filter-bar {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}

.input-search {
    flex: 1;
    min-width: 180px;
    padding: .5rem .75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .875rem;
    font-family: inherit;
    transition: border-color .15s;
}
.input-search:focus { outline: none; border-color: var(--accent); }
.input-search::placeholder { color: var(--muted); opacity: .7; }

.input-select {
    padding: .5rem .75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .875rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s;
}
.input-select:focus { outline: none; border-color: var(--accent); }

/* ── Badges ───────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-ok      { background: rgba(22,163,74,.12);   color: var(--success); }
.badge-pending { background: rgba(217,119,6,.12);   color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,.12);   color: var(--danger);  }
.badge-info    { background: rgba(99,102,241,.12);  color: var(--accent);  }
.badge-deleted { background: rgba(100,116,139,.12); color: var(--text-muted, #64748b); text-decoration: line-through; }

[data-theme="dark"] .badge-ok      { background: rgba(74,222,128,.12); }
[data-theme="dark"] .badge-pending { background: rgba(251,191,36,.12); }
[data-theme="dark"] .badge-danger  { background: rgba(255,92,106,.12); }
[data-theme="dark"] .badge-info    { background: rgba(232,255,71,.1);  }
[data-theme="dark"] .badge-deleted { background: rgba(148,163,184,.1); }

/* ── Toasts ───────────────────────────────────────────────────────── */
.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.toast-ok  { background: rgba(22,163,74,.1);   color: var(--success); border: 1px solid rgba(22,163,74,.25); }
.toast-err { background: rgba(239,68,68,.1);   color: var(--danger);  border: 1px solid rgba(239,68,68,.25); }

[data-theme="dark"] .toast-ok  { background: rgba(74,222,128,.1);  border-color: rgba(74,222,128,.25); }
[data-theme="dark"] .toast-err { background: rgba(255,92,106,.1);  border-color: rgba(255,92,106,.25); }

/* ── Callouts (caixas de aviso com ícone + texto) ─────────────────── */
/* Usado em telas de confirmação pós-cadastro, "esqueci minha senha",
   /Carteira (saldo bloqueado), etc. Variantes: warning, success, info, danger. */
.callout {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    text-align: left;
    margin-bottom: 16px;
}
.callout-icon { flex-shrink: 0; margin-top: 1px; }
.callout-body { font-size: 13px; line-height: 1.5; }
.callout-warning { background: #fff7ed; border-color: #fed7aa; }
.callout-warning .callout-icon { color: #ea580c; }
.callout-warning .callout-body  { color: #7c2d12; }
.callout-success { background: rgba(22,163,74,.08); border-color: rgba(22,163,74,.25); }
.callout-success .callout-icon { color: #16a34a; }
.callout-success .callout-body  { color: #15803d; }
.callout-info    { background: rgba(99,102,241,.08); border-color: rgba(99,102,241,.25); }
.callout-info .callout-icon { color: var(--accent); }
.callout-info .callout-body  { color: var(--text); }
.callout-danger  { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.25); }
.callout-danger .callout-icon { color: #dc2626; }
.callout-danger .callout-body  { color: #b91c1c; }
[data-theme="dark"] .callout-warning { background: rgba(234,88,12,.10); }
[data-theme="dark"] .callout-warning .callout-body { color: #fed7aa; }
[data-theme="dark"] .callout-success { background: rgba(74,222,128,.10); }
[data-theme="dark"] .callout-success .callout-body { color: #86efac; }
[data-theme="dark"] .callout-danger  { background: rgba(255,92,106,.10); }
[data-theme="dark"] .callout-danger .callout-body { color: #fca5a5; }

/* ── SLA Pills (verde < 1d, âmbar < 3d, vermelho > 5d) ────────────── */
/* Usado no /Admin/Certificados pra indicar tempo decorrido em pedidos. */
.sla-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.sla-pill.ok    { background: rgba(22,163,74,.10); color: #15803d; }
.sla-pill.warn  { background: rgba(234,88,12,.10); color: #c2410c; }
.sla-pill.bad   { background: rgba(220,38,38,.10); color: #b91c1c; }
[data-theme="dark"] .sla-pill.ok   { background: rgba(74,222,128,.10);  color: #86efac; }
[data-theme="dark"] .sla-pill.warn { background: rgba(251,146,60,.10);  color: #fdba74; }
[data-theme="dark"] .sla-pill.bad  { background: rgba(255,92,106,.10);  color: #fca5a5; }

/* ── Admin nav tabs (segmented pill) ───────────────────────────────── */
/* Top-level navegação entre seções de /Admin/* — ex: Dashboard | Users |
   Empresas | Certificados | Custo das Ações. Estilo "pill segmented" com
   alto contraste no item ativo. Antes era redefinido em cada page com
   contraste fraco — agora centralizado. */
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 24px;
    padding: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.admin-tab {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
    transition: background .15s, color .15s, box-shadow .15s;
}
.admin-tab:hover  { background: var(--row-hover); color: var(--text); }
.admin-tab.active {
    background: var(--surface);
    color: var(--accent);
    box-shadow: var(--shadow);
}
[data-theme="dark"] .admin-tab.active { background: rgba(232,255,71,.06); }

/* ── Subtabs (underline tabs dentro de uma página) ─────────────────── */
/* Usado pra alternar entre painéis dentro de /Admin/Certificados, etc.
   Padrão clean com underline no ativo. Suporta .badge-count ao lado. */
.subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.subtab {
    padding: 10px 18px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    border: 0;
    background: transparent;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color .15s, border-color .15s;
}
.subtab:hover  { color: var(--text); }
.subtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.subtab .badge-count {
    display: inline-block;
    min-width: 18px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    border-radius: 9px;
    background: var(--row-hover);
    color: var(--text);
    line-height: 18px;
}
.subtab.active .badge-count { background: var(--accent); color: var(--btn-primary-fg); }
[data-theme="dark"] .subtab.active .badge-count { color: var(--bg); }
.subtab-pane { display: none; }
.subtab-pane.active { display: block; }

/* ── Empty state ──────────────────────────────────────────────────── */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--muted);
    text-align: center;
    gap: 14px;
}

.empty-icon {
    width: 48px;
    height: 48px;
    background: var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.empty p { max-width: 280px; font-size: 14px; line-height: 1.5; }

/* ── Info box ─────────────────────────────────────────────────────── */
.info-box {
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

.info-box strong { color: var(--accent); display: block; margin-bottom: 4px; }

/* ── Doc preview ──────────────────────────────────────────────────── */
.doc-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.doc-preview-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--border);
    flex-shrink: 0;
}

.doc-preview-name { font-weight: 500; font-size: 14px; }
.doc-preview-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Cert card ────────────────────────────────────────────────────── */
.cert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.cert-row:last-child  { border-bottom: none; padding-bottom: 0; }
.cert-row:first-child { padding-top: 0; }

.cert-info-name { font-weight: 500; font-family: 'DM Mono', monospace; font-size: 13px; }
.cert-info-sub  { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Auth ─────────────────────────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}

.auth-box {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 36px;
    box-shadow: var(--shadow);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 28px;
    justify-content: center;
}

.auth-box h2 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -.02em;
    margin-bottom: 6px;
}

.auth-box p {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 24px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--muted);
}

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

/* ── Mono ─────────────────────────────────────────────────────────── */
.mono { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--muted); }

/* ── Quill editor — tema adaptável ───────────────────────────────── */
.ql-toolbar.ql-snow {
    border-radius: 8px 8px 0 0 !important;
    border-color: var(--editor-border) !important;
    background: var(--editor-toolbar) !important;
    transition: background-color .25s, border-color .25s;
}

.ql-container.ql-snow {
    border-radius: 0 0 8px 8px !important;
    border-color: var(--editor-border) !important;
    background: var(--editor-bg) !important;
    font-size: 14px;
    transition: background-color .25s, border-color .25s;
}

.ql-editor {
    min-height: 360px;
    height: auto !important;
    overflow: visible !important;
    color: var(--editor-text) !important;
    line-height: 1.8;
    padding: 20px 24px;
}

.ql-editor p,
.ql-editor li  { color: var(--editor-text) !important; }
.ql-editor h1,
.ql-editor h2,
.ql-editor h3  { color: var(--text) !important; }
.ql-editor hr  { border-color: var(--border); margin: 12px 0; }

.ql-editor.ql-blank::before { color: var(--muted) !important; font-style: normal; }

/* ícones da toolbar no tema escuro */
[data-theme="dark"] .ql-stroke              { stroke: var(--text) !important; }
[data-theme="dark"] .ql-fill                { fill:   var(--text) !important; }
[data-theme="dark"] .ql-picker               { color:  var(--text) !important; }
[data-theme="dark"] .ql-picker-options       { background: var(--surface) !important; border-color: var(--border) !important; }
[data-theme="dark"] .ql-picker-item          { color: var(--muted) !important; }
[data-theme="dark"] .ql-picker-item:hover    { color: var(--text)  !important; }

/* ── Drop zone ───────────────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    outline: none;
}
.drop-zone:hover,
.drop-zone:focus,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--info-bg);
}
.drop-zone-icon {
    width: 44px; height: 44px;
    margin: 0 auto 12px;
    color: var(--muted);
}
.drop-zone p  { margin: 0 0 4px; color: var(--text); font-size: .9rem; }
.drop-zone p label { color: var(--accent); cursor: pointer; text-decoration: underline; }
.drop-zone small   { color: var(--muted); font-size: .8rem; }

/* ── Upload queue ────────────────────────────────────────────────── */
.upload-queue { display: flex; flex-direction: column; gap: 8px; }
.upload-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    align-items: center;
}
.upload-item-name  { font-size: .875rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.upload-item-size  { font-size: .75rem; color: var(--muted); }
.upload-item-status { font-size: .78rem; text-align: right; white-space: nowrap; }
.upload-item-status.ok   { color: var(--success); }
.upload-item-status.err  { color: var(--danger); }
.upload-item-status.wait { color: var(--muted); }
.upload-item-status.prog { color: var(--accent); }
.upload-progress {
    grid-column: 1 / -1;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.upload-progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width .15s linear;
    border-radius: 2px;
}

/* selected file preview (certificate) */
.file-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
}
.file-preview-name { flex: 1; font-size: .875rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview-remove {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    transition: color .15s;
}
.file-preview-remove:hover { color: var(--danger); }

/* ── Cookie consent banner ───────────────────────────────────────── */
#cookie-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 9000;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 24px rgba(0,0,0,.12);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    animation: slideUp .35s ease;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0);    }
}
#cookie-banner p {
    margin: 0;
    flex: 1 1 300px;
    font-size: .85rem;
    color: var(--text);
    line-height: 1.5;
}
#cookie-banner p a {
    color: var(--accent);
    text-decoration: underline;
}
.cookie-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.btn-cookie-accept {
    background: var(--accent);
    color: var(--btn-primary-fg);
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 20px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.btn-cookie-accept:hover { opacity: .85; }
.btn-cookie-reject {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 20px;
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.btn-cookie-reject:hover { border-color: var(--text); color: var(--text); }

/* ── Cookie required modal ───────────────────────────────────────── */
#cookie-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9100;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
}
#cookie-modal-overlay.open { display: flex; }
#cookie-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    padding: 36px 32px;
    max-width: 440px;
    width: calc(100% - 40px);
    text-align: center;
}
#cookie-modal .cm-icon {
    width: 52px; height: 52px;
    background: rgba(239,68,68,.1);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
#cookie-modal h3 {
    margin: 0 0 10px;
    font-size: 1.1rem;
    color: var(--text);
}
#cookie-modal p {
    margin: 0 0 24px;
    font-size: .875rem;
    color: var(--muted);
    line-height: 1.6;
}
#cookie-modal .btn-cookie-force {
    width: 100%;
    background: var(--accent);
    color: var(--btn-primary-fg);
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
#cookie-modal .btn-cookie-force:hover { opacity: .85; }
[data-theme="dark"] .ql-toolbar.ql-snow button:hover .ql-stroke { stroke: var(--accent) !important; }

/* ── Busca de cliente / Autocomplete ────────────────────────────── */
.search-wrap {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s, background-color .25s;
    box-sizing: border-box;
}

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

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    z-index: 300;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 36px rgba(0,0,0,.13), 0 2px 8px rgba(0,0,0,.06);
    max-height: 260px;
    overflow-y: auto;
    animation: searchDropIn .12s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

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

@keyframes selectedIn {
    from { opacity: 0; transform: translateY(4px); box-shadow: none; }
    to   { opacity: 1; transform: translateY(-1px); }
}

.search-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}

.search-item:last-child { border-bottom: none; }

.search-item:hover,
.search-item.active {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.search-item strong {
    font-size: 13px;
    color: var(--text);
    display: block;
    font-weight: 600;
}

.search-item .item-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.search-item--empty {
    padding: 16px 14px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
    cursor: default;
}

/* ── Estado "cliente selecionado" ──────────────────────────────── */
.selected-box,
.selected-cliente {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 15px;
    background: color-mix(in srgb, var(--accent) 9%, var(--surface));
    border: 1.5px solid color-mix(in srgb, var(--accent) 35%, transparent);
    border-radius: var(--radius);
    font-size: 13px;
    box-shadow:
        0 4px 14px color-mix(in srgb, var(--accent) 18%, transparent),
        0 1px 3px rgba(0,0,0,.08);
    transform: translateY(-1px);
    animation: selectedIn .2s ease;
    transition: background .25s, border-color .25s, box-shadow .25s, transform .25s;
}

.selected-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent);
}

.selected-box > div:nth-child(2),
.selected-cliente > div:nth-child(2) {
    flex: 1;
    min-width: 0;
}

.selected-box strong,
.selected-cliente strong {
    display: block;
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selected-box .item-sub,
.selected-box .sub,
.selected-cliente .sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-trocar,
.selected-box .trocar,
.selected-cliente .trocar {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    background: none;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    transition: background .15s, border-color .15s;
}

.btn-trocar:hover,
.selected-box .trocar:hover,
.selected-cliente .trocar:hover {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

.search-hint {
    margin-top: 7px;
    font-size: 12px;
    color: var(--muted);
}

/* ── Formulário de busca server-side (Clientes/Index) ──────────── */
.search-form-wrap {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-form-wrap .search-wrap {
    flex: 1;
}

/* ── Chamados — botão flutuante ────────────────────────────────── */
.btn-chamado-float {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 900;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--btn-primary-fg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    transition: transform .15s, box-shadow .15s;
}

.btn-chamado-float:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,.3);
}

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

/* ── Modal genérico (overlay + card) ───────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: calc(100% - 40px);
    max-width: 480px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
}
.modal-close:hover { color: var(--text); background: var(--border); }

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding: .875rem 1.25rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to   { opacity: 1; transform: none; }
}
.modal-overlay.open .modal-card {
    animation: modal-in .18s ease;
}

/* ── Chamados — form fields ─────────────────────────────────────── */
.field-group {
    margin-bottom: 1rem;
}
.field-group:last-child {
    margin-bottom: 0;
}

.field-label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .5rem;
}

.input-textarea {
    width: 100%;
    padding: .625rem .75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .875rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 110px;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}
.input-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.input-textarea::placeholder { color: var(--muted); opacity: .7; }

.field-char-count {
    display: block;
    text-align: right;
    font-size: .72rem;
    color: var(--muted);
    margin-top: .3rem;
    opacity: .7;
}
.field-char-count.near-limit { color: var(--warning, #d97706); opacity: 1; }
.field-char-count.at-limit   { color: var(--danger);  opacity: 1; font-weight: 600; }

.field-error {
    display: flex;
    align-items: center;
    gap: .4rem;
    background: color-mix(in srgb, var(--danger) 10%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: .825rem;
    padding: .5rem .75rem;
    margin-bottom: .75rem;
}
.field-error::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='7' stroke='currentColor' stroke-width='1.5'/%3E%3Cpath d='M8 5v3.5M8 11h.01' stroke='currentColor' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='7' stroke='currentColor' stroke-width='1.5'/%3E%3Cpath d='M8 5v3.5M8 11h.01' stroke='currentColor' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
    flex-shrink: 0;
}

/* tipo-specific radio pill colors */
.radio-pill[data-tipo="Sugestao"]:has(input:checked) {
    background: rgba(59,130,246,.12);
    border-color: #3b82f6;
    color: #1d4ed8;
}
.radio-pill[data-tipo="Elogio"]:has(input:checked) {
    background: rgba(34,197,94,.12);
    border-color: #22c55e;
    color: #15803d;
}
.radio-pill[data-tipo="Critica"]:has(input:checked) {
    background: rgba(239,68,68,.12);
    border-color: #ef4444;
    color: #b91c1c;
}
[data-theme="dark"] .radio-pill[data-tipo="Sugestao"]:has(input:checked) { color: #93c5fd; }
[data-theme="dark"] .radio-pill[data-tipo="Elogio"]:has(input:checked)   { color: #86efac; }
[data-theme="dark"] .radio-pill[data-tipo="Critica"]:has(input:checked)  { color: #fca5a5; }

/* chamado success state */
.chamado-success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--success, #22c55e) 12%, var(--surface));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto .75rem;
    color: var(--success, #22c55e);
}

/* ── Quill editor — tema integrado ─────────────────────────────── */
.chamado-quill-editor .ql-toolbar.ql-snow {
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: var(--bg);
    padding: 6px 8px;
}
.chamado-quill-editor .ql-container.ql-snow {
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: var(--bg);
    font-family: inherit;
    font-size: .875rem;
}
.chamado-quill-editor .ql-editor {
    min-height: 120px;
    max-height: 260px;
    color: var(--text);
    line-height: 1.55;
    padding: .625rem .75rem;
}
.chamado-quill-editor .ql-editor.ql-blank::before {
    color: var(--muted);
    opacity: .7;
    font-style: normal;
}
.chamado-quill-editor .ql-container.ql-snow:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.chamado-quill-editor .ql-toolbar.ql-snow:has(+ .ql-container.ql-snow:focus-within) {
    border-color: var(--accent);
}

/* toolbar icons — adapta ao tema */
.chamado-quill-editor .ql-toolbar .ql-stroke { stroke: var(--muted); }
.chamado-quill-editor .ql-toolbar .ql-fill   { fill:   var(--muted); }
.chamado-quill-editor .ql-toolbar button:hover .ql-stroke,
.chamado-quill-editor .ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent); }
.chamado-quill-editor .ql-toolbar button:hover .ql-fill,
.chamado-quill-editor .ql-toolbar button.ql-active .ql-fill   { fill:   var(--accent); }

[data-theme="dark"] .chamado-quill-editor .ql-toolbar.ql-snow,
[data-theme="dark"] .chamado-quill-editor .ql-container.ql-snow {
    border-color: var(--border);
}
[data-theme="dark"] .chamado-quill-editor .ql-toolbar .ql-picker-label,
[data-theme="dark"] .chamado-quill-editor .ql-toolbar .ql-picker-options {
    color: var(--text);
    background: var(--surface);
    border-color: var(--border);
}

/* ql-editor sem borda/bg quando usado para exibição (chamado-msg-body) */
.chamado-msg-body.ql-editor {
    padding: 0;
    min-height: unset;
    max-height: unset;
    font-size: inherit;
    line-height: inherit;
}

/* ── Chamados — thread de conversa ─────────────────────────────── */
.chamado-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.chamado-msg {
    max-width: 75%;
    border-radius: var(--radius);
    padding: .85rem 1rem;
    box-shadow: var(--shadow);
}

.chamado-msg-cliente {
    background: var(--surface);
    border: 1px solid var(--border);
    align-self: flex-start;
}

.chamado-msg-suporte {
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    align-self: flex-end;
}

.chamado-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    margin-bottom: .4rem;
    font-size: .8rem;
}

.chamado-msg-header strong {
    font-weight: 600;
}

.chamado-msg-date {
    font-size: .75rem;
    opacity: .55;
}

.chamado-msg-body {
    font-size: .875rem;
    word-break: break-word;
    line-height: 1.55;
}

.chamado-reply-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: .5rem;
}

.chamado-resolved-notice {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--muted);
    font-size: .9rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: .5rem;
}

/* ── Radio pills (modal chamado) ───────────────────────────────── */
.radio-pill {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    font-size: .85rem;
    transition: background .12s, border-color .12s;
}

.radio-pill:has(input:checked) {
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    border-color: var(--accent);
}

.radio-pill input[type="radio"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
}

/* ── Badge tipos chamado ────────────────────────────────────────── */
.badge-sugestao { background: rgba(59,130,246,.12); color: #1d4ed8; }
.badge-elogio   { background: rgba(34,197,94,.12);  color: #15803d; }
.badge-critica  { background: rgba(239,68,68,.12);  color: #b91c1c; }

[data-theme="dark"] .badge-sugestao { color: #93c5fd; }
[data-theme="dark"] .badge-elogio   { color: #86efac; }
[data-theme="dark"] .badge-critica  { color: #fca5a5; }

.badge-status-aberto    { background: rgba(239,68,68,.1);  color: #b91c1c; }
.badge-status-emalise   { background: rgba(234,179,8,.1);  color: #92400e; }
.badge-status-resolvido { background: rgba(34,197,94,.1);  color: #15803d; }

[data-theme="dark"] .badge-status-aberto    { color: #fca5a5; }
[data-theme="dark"] .badge-status-emalise   { color: #fde68a; }
[data-theme="dark"] .badge-status-resolvido { color: #86efac; }

.badge-new { background: var(--accent); color: var(--btn-primary-fg); }

/* small select */
.input-select-sm { font-size: .8rem; padding: .2rem .4rem; }

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR LAYOUT
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --sidebar-w:       240px;
    --sidebar-icon-w:  56px;
}

/* ── Sidebar container ────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: var(--sidebar-icon-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: 2px 0 12px rgba(0,0,0,.06);
    z-index: 120;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width .22s cubic-bezier(.4,0,.2,1),
                background-color .25s ease,
                border-color .25s ease;
}

/* Expand on hover (unpinned) or always when pinned */
.sidebar:hover,
html.sidebar-pinned .sidebar {
    width: var(--sidebar-w);
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
}

/* ── Sidebar header ───────────────────────────────────────────────── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 10px 0 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
    gap: 8px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    white-space: nowrap;
    text-decoration: none;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.sidebar-brand-text {
    opacity: 0;
    transition: opacity .14s ease;
    pointer-events: none;
}

.sidebar:hover .sidebar-brand-text,
html.sidebar-pinned .sidebar .sidebar-brand-text {
    opacity: 1;
    pointer-events: auto;
}

/* ── Pin button ───────────────────────────────────────────────────── */
.sidebar-pin {
    flex-shrink: 0;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    color: var(--muted);
    border-radius: var(--radius-sm);
    opacity: 0;
    pointer-events: none;
    transition: opacity .14s ease, background .15s, color .15s;
}

.sidebar:hover .sidebar-pin,
html.sidebar-pinned .sidebar .sidebar-pin {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-pin:hover { background: var(--border); color: var(--text); }
html.sidebar-pinned .sidebar-pin { color: var(--accent); }

/* ── Nav area ─────────────────────────────────────────────────────── */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Group ────────────────────────────────────────────────────────── */
.sidebar-group { margin-bottom: 2px; }

.sidebar-group-label {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 38px;
    padding: 0 16px;
    overflow: hidden;
    cursor: default;
    user-select: none;
}

.sidebar-group-text {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .14s ease;
}

.sidebar:hover .sidebar-group-text,
html.sidebar-pinned .sidebar .sidebar-group-text {
    opacity: 1;
}

/* ── Direct nav link ──────────────────────────────────────────────── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    padding: 0 16px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-decoration: none;
    transition: background .12s, color .12s;
}

.sidebar-link:hover { background: var(--row-hover); color: var(--text); }

.sidebar-link.active,
.sidebar-sub.active {
    color: var(--accent);
    background: var(--info-bg);
}

/* ── Accordion sub-list ──────────────────────────────────────────── */
.sidebar-sub-list {
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
}

.sidebar-group.open .sidebar-sub-list {
    max-height: 600px;
}

/* Chevron */
.sidebar-chevron {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--muted);
    opacity: 0;
    transition: transform .22s ease, opacity .14s ease;
    pointer-events: none;
}

.sidebar:hover .sidebar-chevron,
html.sidebar-pinned .sidebar .sidebar-chevron {
    opacity: 1;
}

.sidebar-group.open .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-group-label {
    cursor: pointer;
}

/* ── Sub-link ─────────────────────────────────────────────────────── */
.sidebar-sub {
    display: flex;
    align-items: center;
    height: 34px;
    padding: 0 16px 0 52px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-decoration: none;
    transition: background .12s, color .12s, opacity .14s ease;
    opacity: 0;
    pointer-events: none;
}

.sidebar:hover .sidebar-sub,
html.sidebar-pinned .sidebar .sidebar-sub {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-sub:hover { background: var(--row-hover); color: var(--text); }

/* ── Nav link text ────────────────────────────────────────────────── */
.sidebar-link-text {
    opacity: 0;
    pointer-events: none;
    transition: opacity .14s ease;
    white-space: nowrap;
}

.sidebar:hover .sidebar-link-text,
html.sidebar-pinned .sidebar .sidebar-link-text {
    opacity: 1;
    pointer-events: auto;
}

/* ── Icons ────────────────────────────────────────────────────────── */
.sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--muted);
}

.sidebar-link:hover .sidebar-icon,
.sidebar-link.active .sidebar-icon { color: var(--accent); }

/* ── CTA link (ex: Loja) — destaque permanente ───────────────────── */
.sidebar-link-cta {
    color: var(--accent);
    font-weight: 600;
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    border-left: 2px solid var(--accent);
    padding-left: 14px; /* compensa 2px da borda */
}
.sidebar-link-cta .sidebar-icon { color: var(--accent); }
.sidebar-link-cta:hover {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: var(--accent);
}
.sidebar-link-cta .sidebar-link-text::after {
    content: 'NOVO';
    display: inline-block;
    margin-left: 7px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 1px 5px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--btn-primary-fg);
    vertical-align: middle;
    line-height: 1.6;
}

/* ── Footer ───────────────────────────────────────────────────────── */
.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-user {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity .14s ease;
    padding: 2px 4px;
}

.sidebar:hover .sidebar-user,
html.sidebar-pinned .sidebar .sidebar-user { opacity: 1; pointer-events: auto; }

.sidebar-footer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-footer-actions .btn-logout {
    opacity: 0;
    pointer-events: none;
    transition: opacity .14s ease;
    font-size: 12px;
    padding: 3px 10px;
    white-space: nowrap;
}

.sidebar:hover .sidebar-footer-actions .btn-logout,
html.sidebar-pinned .sidebar .sidebar-footer-actions .btn-logout {
    opacity: 1;
    pointer-events: auto;
}

/* ── App content (right of sidebar) ──────────────────────────────── */
/* Padrão: sem margem (páginas não autenticadas) */
.app-content {
    transition: margin-left .22s cubic-bezier(.4,0,.2,1);
}

/* Autenticado: offset da sidebar recolhida (56px) */
body.has-sidebar .app-content {
    margin-left: var(--sidebar-icon-w);
}

/* Autenticado + sidebar fixada (240px) */
html.sidebar-pinned body.has-sidebar .app-content {
    margin-left: var(--sidebar-w);
}

/* ── Topbar (mobile only) ─────────────────────────────────────────── */
.topbar {
    display: none;
    align-items: center;
    height: 56px;
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 12px;
    box-shadow: var(--shadow);
    transition: background-color .25s ease, border-color .25s ease;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Mobile (≤1023px) ─────────────────────────────────────────────── */
@media (max-width: 1023px) {
    .sidebar                             { display: none !important; }
    .topbar                              { display: flex; }
    body.has-sidebar .app-content        { margin-left: 0 !important; }
    html.sidebar-pinned body.has-sidebar .app-content { margin-left: 0 !important; }
}

/* ── Estalecas toast (aparece 3s após ação de crédito) ────────────── */
.vings-toast {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--accent);
    color: #fff;
    padding: .6rem 1rem;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: .75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    transition: opacity .6s ease;
}
.vings-toast--fade {
    opacity: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE RESPONSIVENESS — breakpoint principal ≤600px
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {

    /* ── Layout geral ──────────────────────────────────────────────── */
    main {
        padding: 18px 14px 40px;
    }

    /* ── Page header ───────────────────────────────────────────────── */
    .page-header {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 16px;
    }
    .page-header h1 {
        font-size: 18px;
    }
    .page-header .btn {
        font-size: 13px;
        padding: 7px 14px;
    }

    /* ── Cards ─────────────────────────────────────────────────────── */
    .card {
        padding: 16px;
    }

    /* ── Auth ──────────────────────────────────────────────────────── */
    .auth-wrap {
        align-items: flex-start;
        padding: 32px 14px;
    }
    .auth-box {
        padding: 24px 18px;
        border-radius: 10px;
    }

    /* ── Footer do site ────────────────────────────────────────────── */
    .site-footer {
        padding: 14px 16px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
    }
    .footer-trust {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    .icp-seal {
        width: 140px;
    }

    /* ── Tabelas — ações ────────────────────────────────────────────── */
    .tbl-actions {
        flex-wrap: wrap;
        gap: 4px;
    }
    .tbl th, .tbl td {
        padding: 10px 10px;
        font-size: 13px;
    }

    /* ── Linha de certificado ───────────────────────────────────────── */
    .cert-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* ── Upload queue ──────────────────────────────────────────────── */
    .upload-item-name {
        max-width: calc(100vw - 130px);
    }

    /* ── Drop zone ─────────────────────────────────────────────────── */
    .drop-zone {
        padding: 24px 14px;
    }

    /* ── Doc preview ───────────────────────────────────────────────── */
    .doc-preview {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
    }

    /* ── Quill editor ──────────────────────────────────────────────── */
    .ql-editor {
        min-height: 180px;
        padding: 14px 16px;
    }

    /* ── Modal footer ──────────────────────────────────────────────── */
    .modal-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
    .modal-footer .btn {
        flex: 1 1 auto;
        justify-content: center;
        min-width: 100px;
    }

    /* ── Chamado messages ───────────────────────────────────────────── */
    .chamado-msg {
        max-width: 92%;
    }

    /* ── Busca server-side ──────────────────────────────────────────── */
    .search-form-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    /* ── Filter bar ─────────────────────────────────────────────────── */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar .btn,
    .filter-bar .input-select {
        width: 100%;
    }
    .input-search {
        min-width: 0;
        width: 100%;
    }

    /* ── Grids inline com 2+ colunas → coluna única no mobile ──────── */
    /* Cobre Agenda, Atendimentos, Bulário e demais que usam inline style */
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* ── Botão flutuante de chamado ─────────────────────────────────── */
    .btn-chamado-float {
        bottom: 1rem;
        right: 1rem;
        width: 46px;
        height: 46px;
    }

    /* ── Pagination ─────────────────────────────────────────────────── */
    .pagination-wrap,
    [style*="justify-content:space-between"][style*="flex-wrap"] {
        justify-content: center;
    }

    /* ── Back link ──────────────────────────────────────────────────── */
    .back-link {
        font-size: 12px;
    }
}

/* ── Breakpoint médio (≤768px) — ajustes complementares ────────────── */
@media (max-width: 768px) {

    /* ── Grid de 3+ colunas → 2 colunas ────────────────────────────── */
    [style*="grid-template-columns:1fr 1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* ── Topbar: garante que não haja overflow ──────────────────────── */
    .topbar {
        padding: 0 12px;
    }
}
