/* ═══════════════════════════════════════════════════════════
   ÁTRIO – Design System v2
   Plataforma de Governança Administrativa Estadual – CCB
   Manual de Identidade Visual: Azul Escuro #033D60
   ═══════════════════════════════════════════════════════════ */

/* ─── 1. TOKENS ─────────────────────────────────────────── */
:root {
    /* CCB Brand */
    --brand:           #033d60;
    --brand-hover:     #04527f;
    --brand-soft:      #e8f3fb;
    --brand-mid:       #1a6f9a;

    /* Light theme */
    --page:            #f0f4f8;
    --surface:         #ffffff;
    --surface-2:       #f8fafc;
    --sidebar-bg:      #ffffff;
    --topbar-bg:       #ffffff;
    --border:          #e2e8f0;
    --border-soft:     #f1f5f9;
    --control-border:  #64748b;
    --control-focus:   #033d60;
    --control-error:   #b91c1c;

    /* Text */
    --ink:             #1e293b;
    --muted:           #64748b;
    --subtle:          #94a3b8;

    /* Nav */
    --nav-fg:          #374151;
    --nav-active-bg:   #e8f3fb;
    --nav-active-fg:   #033d60;
    --nav-hover-bg:    #f1f5f9;
    --nav-icon-bg:     #f1f5f9;

    /* Dimensions */
    --sidebar-w:       224px;
    --topbar-h:        64px;
    --radius:          8px;
    --radius-sm:       6px;
    --radius-lg:       12px;

    /* Semantic colors */
    --success:         #16a34a;
    --success-soft:    #dcfce7;
    --warning:         #d97706;
    --warning-soft:    #fef3c7;
    --danger:          #dc2626;
    --danger-soft:     #fee2e2;
    --info:            #0284c7;
    --info-soft:       #e0f2fe;

    /* Shadows */
    --shadow-sm:       0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:       0 4px 12px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
    --shadow-lg:       0 10px 30px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.05);

    /* Dept icon colors */
    --dept-blue:       #033d60;
    --dept-teal:       #0e7490;
    --dept-gold:       #b45309;
    --dept-violet:     #6d28d9;
    --dept-green:      #15803d;
    --dept-rose:       #be185d;
    --dept-sky:        #0369a1;
    --dept-slate:      #475569;
}

/* Agenda da Secretaria */
.agenda-shell { display:grid; gap:1rem; }
.agenda-header { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; flex-wrap:wrap; }
.agenda-header h1 { margin:.15rem 0 0; font-size:clamp(1.35rem,2vw,2rem); }
.agenda-header__actions { display:flex; align-items:flex-end; gap:.75rem; flex-wrap:wrap; }
.agenda-context-form label { display:grid; gap:.25rem; min-width:min(320px,80vw); }
.agenda-context-form label span { color:var(--muted); font-size:.75rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; }
.agenda-context-empty { display:grid; gap:.15rem; padding:.65rem .8rem; border:1px solid var(--border); border-radius:10px; }
.agenda-context-empty small { color:var(--muted); }
.agenda-metrics { display:grid; grid-template-columns:repeat(auto-fit,minmax(145px,1fr)); border:1px solid var(--border); border-radius:12px; background:var(--surface); overflow:hidden; }
.agenda-metrics > div { display:flex; align-items:center; justify-content:space-between; gap:.75rem; padding:.75rem 1rem; border-right:1px solid var(--border); }
.agenda-metrics > div:last-child { border-right:0; }
.agenda-metrics span { color:var(--muted); font-size:.82rem; }
.agenda-metrics strong { font-size:1.2rem; }
.agenda-tabs { display:flex; gap:.25rem; border-bottom:1px solid var(--border); overflow-x:auto; }
.agenda-tabs a { padding:.65rem .9rem; color:var(--muted); text-decoration:none; border-bottom:2px solid transparent; white-space:nowrap; }
.agenda-tabs a.is-active { color:var(--brand); border-color:var(--brand); font-weight:700; }
.agenda-sections { display:flex; gap:.35rem; overflow-x:auto; padding-bottom:.25rem; }
.agenda-sections a { padding:.45rem .7rem; border:1px solid var(--border); border-radius:999px; color:var(--muted); text-decoration:none; white-space:nowrap; font-size:.8rem; }
.agenda-sections a.is-active { border-color:var(--brand); background:var(--brand-soft); color:var(--brand); font-weight:700; }
.agenda-filters { border:1px solid var(--border); border-radius:10px; background:var(--surface); }
.agenda-filters summary { cursor:pointer; padding:.7rem 1rem; font-weight:700; }
.agenda-filters form { display:grid; grid-template-columns:repeat(4,minmax(140px,1fr)); gap:.75rem; padding:0 1rem 1rem; }
.agenda-filter-search { grid-column:span 2; }
.agenda-filter-person { grid-column:span 2; }
.agenda-filters label { display:grid; gap:.25rem; }
.agenda-filters label span { color:var(--muted); font-size:.78rem; font-weight:650; }
.agenda-filter-actions { display:flex; gap:.4rem; align-items:flex-end; }
.agenda-period-nav { display:flex; align-items:center; justify-content:center; gap:1rem; }
.agenda-period-nav a { display:grid; place-items:center; width:34px; height:34px; border:1px solid var(--border); border-radius:8px; text-decoration:none; }
.agenda-calendar { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); border:1px solid var(--border); border-radius:12px; overflow:hidden; background:var(--border); gap:1px; }
.agenda-calendar__weekday { padding:.5rem; background:var(--surface); color:var(--muted); font-size:.75rem; font-weight:750; text-align:center; text-transform:uppercase; }
.agenda-day { min-height:138px; padding:.45rem; background:var(--surface); overflow:hidden; }
.agenda-day > time { display:grid; place-items:center; width:25px; height:25px; margin-left:auto; border-radius:50%; font-size:.8rem; font-weight:700; }
.agenda-day.is-outside { opacity:.52; }
.agenda-day.is-today > time { background:var(--brand); color:#fff; }
.agenda-day__events { display:grid; gap:.25rem; margin-top:.25rem; }
.agenda-event { display:flex; align-items:center; gap:.32rem; min-width:0; padding:.28rem .35rem; border-left:3px solid var(--event-color); border-radius:4px; background:color-mix(in srgb,var(--event-color) 11%,var(--surface)); color:var(--ink); text-decoration:none; font-size:.7rem; }
.agenda-event span { flex:0 0 auto; color:var(--muted); font-variant-numeric:tabular-nums; }
.agenda-event strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.agenda-list { overflow-x:auto; }
.agenda-list a { color:var(--brand); text-decoration:none; }
.agenda-list table { min-width:1180px; }
.agenda-list th,.agenda-list td { padding:.48rem .6rem; vertical-align:top; }
.agenda-list th { white-space:nowrap; }
.agenda-list td:first-child,.agenda-list td:nth-child(2),.agenda-list td:nth-child(3),.agenda-list td:nth-child(7),.agenda-list td:nth-child(9),.agenda-list td:nth-child(10) { white-space:nowrap; }
.agenda-list td:nth-child(4) a { display:grid; gap:.12rem; min-width:190px; }
.agenda-list td:nth-child(4) small { color:var(--muted); font-size:.72rem; }
.agenda-list__open { display:inline-flex; min-height:32px; align-items:center; padding:.25rem .45rem; border:1px solid var(--border); border-radius:6px; font-weight:700; }
.agenda-list__open:focus-visible { outline:3px solid color-mix(in srgb,var(--brand) 24%,transparent); outline-offset:2px; }
.agenda-pagination { margin-top:.75rem; }
.agenda-detail { display:grid; gap:1.25rem; }
.agenda-detail > header { display:flex; justify-content:space-between; gap:1rem; align-items:flex-start; }
.agenda-detail h1 { margin:.4rem 0 0; }
.agenda-detail dl { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1px; padding:1px; background:var(--border); border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.agenda-detail dl div { padding:1rem; background:var(--surface); }
.agenda-detail dt { color:var(--muted); font-size:.75rem; text-transform:uppercase; letter-spacing:.04em; }
.agenda-detail dd { margin:.3rem 0 0; font-weight:650; }
.agenda-territory-list { display:flex; gap:.4rem; flex-wrap:wrap; }
.agenda-event-form { display:grid; gap:1.2rem; }
.agenda-event-form fieldset { border:1px solid var(--border); border-radius:10px; padding:1rem; }
.agenda-event-form legend { padding:0 .4rem; font-weight:750; }
.agenda-scope-field { display:grid; gap:.3rem; max-width:420px; }
.agenda-territory-cascade { display:grid; grid-template-columns:repeat(4,minmax(150px,1fr)); gap:.75rem; }
.agenda-territory-cascade--filter { grid-column:1/-1; }
.agenda-territory-cascade label { display:grid; align-content:start; gap:.25rem; }
.agenda-territory-cascade input[type="search"] { min-width:0; }
.agenda-lookup-help { grid-column:1/-1; margin:0; color:var(--muted); font-size:.8rem; }
.agenda-form-context { display:flex; justify-content:space-between; gap:1rem; padding:.7rem 1rem; border-radius:8px; background:var(--brand-soft); color:var(--brand); }
.agenda-operation-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.agenda-operation-grid form { display:grid; gap:.6rem; padding:1rem; border:1px solid var(--border); border-radius:10px; }
.agenda-operation-grid h3 { margin:0; }
.agenda-history { display:grid; gap:.5rem; padding-left:1.2rem; }
.agenda-history small { display:block; color:var(--muted); }
.agenda-people { display:grid; gap:.7rem; }
.agenda-people > form { display:grid; grid-template-columns:2fr 1fr 2fr auto; gap:.5rem; }
.agenda-person-picker { position:relative; min-width:0; }
.agenda-person-picker > input[type="search"] { width:100%; }
.agenda-person-results { position:absolute; z-index:20; top:calc(100% + .25rem); right:0; left:0; max-height:240px; overflow-y:auto; padding:.3rem; border:1px solid var(--border); border-radius:8px; background:var(--surface); box-shadow:var(--shadow-md); color:var(--muted); }
.agenda-person-results button { display:block; width:100%; padding:.55rem .65rem; border:0; border-radius:6px; background:transparent; color:var(--ink); text-align:left; cursor:pointer; }
.agenda-person-results button:hover,.agenda-person-results button:focus-visible { background:var(--brand-soft); color:var(--brand); outline:2px solid var(--control-focus); }
.agenda-people-list { display:flex; gap:.5rem; flex-wrap:wrap; }
.agenda-people-list > span { display:grid; gap:.12rem; min-width:180px; padding:.55rem .7rem; border:1px solid var(--border); border-radius:8px; }
.agenda-people-list small { color:var(--muted); }
.agenda-response { display:flex !important; gap:.5rem; }
.agenda-documents { display:grid; gap:.7rem; }
.agenda-document-list { display:grid; gap:.5rem; }
.agenda-document-list article { display:flex; align-items:center; gap:.5rem; padding:.7rem; border:1px solid var(--border); border-radius:8px; }
.agenda-document-list article > div { display:grid; flex:1; }
.agenda-document-list small { color:var(--muted); }
.agenda-documents > form { display:grid; grid-template-columns:2fr 1fr 2fr 1fr auto; gap:.5rem; }
.agenda-event-types h2 { margin:.2rem 0 0; font-size:1.1rem; }
.agenda-event-types p { color:var(--muted); }
.agenda-event-type-create,.agenda-event-type-list { border:1px solid var(--border); border-radius:12px; background:var(--surface); overflow:hidden; }
.agenda-event-type-create > header,.agenda-event-type-list > header { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; padding:1rem; border-bottom:1px solid var(--border); }
.agenda-event-type-create > header small { color:var(--muted); }
.agenda-event-type-form { display:grid; grid-template-columns:minmax(180px,2fr) minmax(160px,1.4fr) minmax(140px,1.2fr) 80px 90px minmax(145px,1fr) auto; align-items:end; gap:.7rem; padding:1rem; }
.agenda-event-type-form + .agenda-event-type-form { border-top:1px solid var(--border); }
.agenda-event-type-form.is-inactive { background:var(--surface-2); opacity:.78; }
.agenda-event-type-form label { display:grid; gap:.25rem; min-width:0; }
.agenda-event-type-form label small { color:var(--muted); font-size:.7rem; }
.agenda-event-type-form input { min-width:0; }
.agenda-event-type-form input[readonly] { background:var(--surface-2); color:var(--muted); }
.agenda-event-type-form input[type="color"] { width:100%; min-height:42px; padding:.2rem; }
.agenda-event-type-form .agenda-event-type-active { display:flex; flex-direction:row; align-items:center; gap:.45rem; min-height:42px; font-size:.8rem; }
.agenda-event-type-form .agenda-event-type-active input[type="checkbox"] { width:auto; }
.commitment-groups { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.commitment-groups > section { border:1px solid var(--border); border-radius:10px; background:var(--surface); overflow:hidden; }
.commitment-groups header { display:flex; justify-content:space-between; padding:.7rem 1rem; border-bottom:1px solid var(--border); }
.commitment-groups h2 { margin:0; font-size:.95rem; }
.commitment-groups section > div { display:grid; }
.commitment-groups a { display:grid; grid-template-columns:auto 1fr auto; gap:.7rem; padding:.65rem 1rem; border-bottom:1px solid var(--border-soft); color:var(--ink); text-decoration:none; }
.commitment-groups a time,.commitment-groups a small { color:var(--muted); font-size:.78rem; }
.commitment-groups p { padding:0 1rem; color:var(--muted); }
@media (max-width:900px) {
    .agenda-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .agenda-metrics > div:nth-child(2) { border-right:0; }
    .agenda-filters form { grid-template-columns:repeat(2,minmax(140px,1fr)); }
    .agenda-day { min-height:112px; }
    .agenda-territory-cascade { grid-template-columns:repeat(2,minmax(140px,1fr)); }
    .agenda-event span { display:none; }
    .agenda-detail dl { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .agenda-event-type-form { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:600px) {
    .agenda-header__actions,.agenda-context-form,.agenda-context-form label { width:100%; }
    .agenda-metrics { grid-template-columns:1fr 1fr; }
    .agenda-metrics > div { display:grid; gap:.2rem; padding:.65rem; }
    .agenda-filters form { grid-template-columns:1fr; }
    .agenda-filter-search,.agenda-filter-person { grid-column:auto; }
    .agenda-calendar { display:block; border:0; background:transparent; }
    .agenda-calendar__weekday,.agenda-day.is-outside { display:none; }
    .agenda-day { min-height:auto; margin-bottom:.5rem; border:1px solid var(--border); border-radius:10px; }
    .agenda-day:not(.is-today):has(.agenda-day__events:empty) { display:none; }
    .agenda-day > time { margin:0 0 .25rem; }
    .agenda-event { padding:.5rem; font-size:.82rem; }
    .agenda-event span { display:inline; }
    .agenda-detail dl { grid-template-columns:1fr; }
    .agenda-territory-cascade { grid-template-columns:1fr; }
    .agenda-operation-grid { grid-template-columns:1fr; }
    .agenda-people > form { grid-template-columns:1fr; }
    .agenda-documents > form { grid-template-columns:1fr; }
    .agenda-event-type-create > header,.agenda-event-type-list > header { display:grid; }
    .agenda-event-type-form { grid-template-columns:1fr; }
    .agenda-document-list article { align-items:flex-start; flex-wrap:wrap; }
    .commitment-groups { grid-template-columns:1fr; }
    .commitment-groups a { grid-template-columns:1fr; gap:.15rem; }
}

[data-theme="dark"] {
    --page:            #0f172a;
    --surface:         #1e293b;
    --surface-2:       #162032;
    --sidebar-bg:      #0d1b2a;
    --topbar-bg:       #1e293b;
    --border:          #334155;
    --border-soft:     #1e293b;
    --control-border:  #94a3b8;
    --control-focus:   #38bdf8;
    --control-error:   #f87171;

    --ink:             #f1f5f9;
    --muted:           #94a3b8;
    --subtle:          #64748b;

    --nav-fg:          #cbd5e1;
    --nav-active-bg:   #1e3a5f;
    --nav-active-fg:   #7dd3fc;
    --nav-hover-bg:    #1e293b;
    --nav-icon-bg:     rgba(255,255,255,.06);
    --brand-soft:      #1e3a5f;

    --shadow-sm:       0 1px 3px rgba(0,0,0,.3);
    --shadow-md:       0 4px 12px rgba(0,0,0,.3);
    --shadow-lg:       0 10px 30px rgba(0,0,0,.4);
}

[data-theme="contrast"] {
    --brand:           #ffffff;
    --brand-hover:     #ffff00;
    --brand-soft:      #111111;
    --brand-mid:       #ffff00;

    --page:            #000000;
    --surface:         #000000;
    --surface-2:       #050505;
    --sidebar-bg:      #000000;
    --topbar-bg:       #000000;
    --border:          #ffffff;
    --border-soft:     #ffffff;
    --control-border:  #ffffff;
    --control-focus:   #ffff00;
    --control-error:   #ff8080;

    --ink:             #ffffff;
    --muted:           #ffffff;
    --subtle:          #ffff00;

    --nav-fg:          #ffffff;
    --nav-active-bg:   #ffff00;
    --nav-active-fg:   #000000;
    --nav-hover-bg:    #111111;
    --nav-icon-bg:     #000000;

    --success:         #00ff66;
    --success-soft:    #001a0a;
    --warning:         #ffff00;
    --warning-soft:    #242400;
    --danger:          #ff5c5c;
    --danger-soft:     #260000;
    --info:            #66ccff;
    --info-soft:       #001a26;

    --shadow-sm:       none;
    --shadow-md:       none;
    --shadow-lg:       none;
}

/* ─── 2. BASE / RESET ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

/* Escala de acessibilidade: ajusta o html para que todos os valores rem escalem juntos.
   Fator = browser-default(16px) × (tamanho-alvo / base-body(14px)) */
html[data-font-scale="large"]  { font-size: 17.71px; } /* 16 × (15.5 ÷ 14) */
html[data-font-scale="larger"] { font-size: 19.43px; } /* 16 × (17   ÷ 14) */

body {
    background: var(--page);
    color: var(--ink);
    font-family: Verdana, 'Segoe UI', Arial, sans-serif;
    font-size: 0.875rem; /* 14px no tamanho normal (0.875 × 16px = 14px) */
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

img { display: block; max-width: 100%; }

h1,h2,h3,h4,h5,h6 { font-weight: 700; line-height: 1.25; color: var(--ink); }

/* ─── 3. LAYOUT SHELL ────────────────────────────────────── */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

/* Collapsed sidebar */
.app-shell.sidebar-collapsed {
    grid-template-columns: 64px minmax(0, 1fr);
}

/* ─── 4. SIDEBAR ─────────────────────────────────────────── */
.app-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    z-index: 40;
    transition: width .22s ease;
    width: var(--sidebar-w);
}

.app-shell.sidebar-collapsed .app-sidebar { width: 64px; }

/* Brand / Logo */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.sidebar-brand:hover { color: inherit; }

.sidebar-logo {
    flex-shrink: 0;
    width: 100px;
    height: 60px;
}

.ccb-logo-stack {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ccb-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ccb-logo--dark { display: none; }
[data-theme="dark"] .ccb-logo--light,
[data-theme="contrast"] .ccb-logo--light { display: none; }
[data-theme="dark"] .ccb-logo--dark,
[data-theme="contrast"] .ccb-logo--dark { display: block; }

.sidebar-brand__text { overflow: hidden; min-width: 0; flex: 1; text-align: center; }
.sidebar-brand__text strong {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -.01em;
    color: var(--brand);
    white-space: nowrap;
}
.sidebar-brand__text small {
    display: block;
    font-size: .68rem;
    color: var(--muted);
    line-height: 1.3;
    white-space: nowrap;
}

.app-shell.sidebar-collapsed .sidebar-brand__text { display: none; }

.ccb-logo--reduced-light,
.ccb-logo--reduced-dark {
    display: none;
    width: 60px;
    height: 60px;
    object-fit: contain;
    flex-shrink: 0;
}

.app-shell.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding-left: 2px;
    padding-right: 2px;
}

.app-shell.sidebar-collapsed .ccb-logo-stack { display: none; }
.app-shell.sidebar-collapsed .ccb-logo--reduced-light { display: block; }

[data-theme="dark"] .app-shell.sidebar-collapsed .ccb-logo--reduced-light,
[data-theme="contrast"] .app-shell.sidebar-collapsed .ccb-logo--reduced-light { display: none; }
[data-theme="dark"] .app-shell.sidebar-collapsed .ccb-logo--reduced-dark,
[data-theme="contrast"] .app-shell.sidebar-collapsed .ccb-logo--reduced-dark { display: block; }

/* Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .6rem .5rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-height: 40px;
    border-radius: var(--radius-sm);
    padding: .45rem .65rem;
    color: var(--nav-fg);
    font-size: .83rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .14s, color .14s;
    position: relative;
    overflow: hidden;
}

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

.nav-item.is-active {
    background: var(--nav-active-bg);
    color: var(--nav-active-fg);
}

.nav-item--child {
    min-height: 34px;
    margin-left: 1.1rem;
    padding-left: .6rem;
    font-size: .78rem;
}

.nav-item--child::before {
    content: "";
    width: 1px;
    height: 20px;
    background: var(--border);
    position: absolute;
    left: -.45rem;
}

.nav-item.is-active .nav-icon { color: var(--nav-active-fg); }

.nav-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--muted);
    transition: color .14s;
}

.nav-item:hover .nav-icon { color: var(--ink); }

.nav-label { overflow: hidden; min-width: 0; }
.nav-label strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-label small {
    display: block;
    font-size: .68rem;
    font-weight: 400;
    color: var(--subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    margin-top: .05rem;
}

.app-shell.sidebar-collapsed .nav-label { display: none; }
.app-shell.sidebar-collapsed .nav-item { justify-content: center; padding: .45rem; }
.app-shell.sidebar-collapsed .nav-item--child { margin-left: 0; }
.app-shell.sidebar-collapsed .nav-item--child::before { display: none; }

/* Nav section divider */
.nav-divider {
    height: 1px;
    background: var(--border);
    margin: .35rem .25rem;
}

/* Sidebar footer */
.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    padding: .65rem .5rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .5rem .65rem;
    border-radius: var(--radius-sm);
    margin-bottom: .35rem;
}

.sidebar-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-user__info { overflow: hidden; min-width: 0; }
.sidebar-user__info strong {
    display: block;
    font-size: .8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user__info small {
    display: block;
    font-size: .68rem;
    color: var(--muted);
    white-space: nowrap;
}

.app-shell.sidebar-collapsed .sidebar-user__info { display: none; }
.app-shell.sidebar-collapsed .sidebar-user { justify-content: center; padding: .5rem; }

.sidebar-footer-actions {
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.sidebar-footer-actions a,
.sidebar-footer-actions button {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    min-height: 36px;
    padding: .4rem .65rem;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    font-size: .78rem;
    font-family: inherit;
    font-weight: 500;
    text-decoration: none;
    transition: background .14s, color .14s;
}

.sidebar-footer-actions a:hover,
.sidebar-footer-actions button:hover {
    background: var(--nav-hover-bg);
    color: var(--ink);
}

.app-shell.sidebar-collapsed .sidebar-footer-actions a span,
.app-shell.sidebar-collapsed .sidebar-footer-actions button span { display: none; }

/* ─── 5. WORKSPACE & TOPBAR ──────────────────────────────── */
.app-workspace {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 1rem;
    height: var(--topbar-h);
    padding: 0 1.5rem;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.topbar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--control-border);
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    flex-shrink: 0;
}

.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 {
    font-size: 1.05rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-eyebrow {
    font-size: .7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    margin-bottom: .1rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
    position: relative;
}

.theme-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--surface-2);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-sm);
}

.theme-switcher button {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 32px;
    padding: 0 .7rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
}

.theme-switcher button:hover,
.theme-switcher button.is-active {
    background: var(--brand);
    color: #ffffff;
}

[data-theme="dark"] .theme-switcher button:hover,
[data-theme="dark"] .theme-switcher button.is-active {
    background: #0369a1;
    color: #ffffff;
}

.theme-dot {
    width: .65rem;
    height: .65rem;
    border-radius: 50%;
    border: 1px solid currentColor;
    flex-shrink: 0;
}

.theme-dot--light { background: #ffffff; color: #64748b; }
.theme-dot--dark { background: #0f172a; color: #94a3b8; }
.theme-dot--contrast { background: #ffff00; color: #000000; }

[data-theme="contrast"] .theme-switcher button:hover,
[data-theme="contrast"] .theme-switcher button.is-active {
    background: #ffff00;
    color: #000000;
}

[data-theme="contrast"] .theme-switcher {
    gap: 4px;
    padding: 4px;
}

[data-theme="contrast"] .theme-switcher button {
    border: 1px solid #ffffff;
    color: #ffffff;
}

[data-theme="contrast"] .theme-dot {
    display: none;
}

.a11y-menu {
    position: relative;
    display: inline-flex;
}

.a11y-panel {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    width: 220px;
    padding: .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 80;
}

.a11y-panel strong {
    display: block;
    margin-bottom: .5rem;
    color: var(--ink);
    font-size: .85rem;
}

.a11y-panel button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 36px;
    margin-top: .35rem;
    padding: .45rem .65rem;
    border: 1px solid var(--control-border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--ink);
    font: inherit;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
}

.a11y-panel button:hover {
    border-color: var(--brand);
    color: var(--brand);
}

[data-theme="contrast"] #a11yContrastBtn {
    background: #ffff00;
    color: #000000;
    border-color: #ffff00;
}

.atrio-vlibras [vw-access-button] {
    right: 1rem !important;
    bottom: 1rem !important;
    border: 2px solid var(--border) !important;
    box-shadow: var(--shadow-lg) !important;
}

[data-theme="contrast"] .atrio-vlibras [vw-access-button] {
    border-color: #ffff00 !important;
    filter: contrast(1.2);
}

.topbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--control-border);
    background: transparent;
    cursor: pointer;
    color: var(--muted);
    transition: background .14s, color .14s, border-color .14s;
    position: relative;
    font-family: inherit;
}

.topbar-btn:hover { background: var(--nav-hover-bg); color: var(--ink); border-color: var(--control-focus); }
.topbar-btn svg { width: 18px; height: 18px; }
.a11y-trigger__icon { width: 20px; height: 20px; object-fit: contain; display: none; }

/* Tema claro (padrão) */
.a11y-icon--light-rest { display: block; }
.a11y-trigger:hover .a11y-icon--light-rest,
.a11y-trigger:focus-visible .a11y-icon--light-rest { display: none; }
.a11y-trigger:hover .a11y-icon--light-hover,
.a11y-trigger:focus-visible .a11y-icon--light-hover { display: block; }

/* Tema escuro */
[data-theme="dark"] .a11y-icon--light-rest,
[data-theme="dark"] .a11y-icon--light-hover { display: none; }
[data-theme="dark"] .a11y-trigger:hover .a11y-icon--light-hover,
[data-theme="dark"] .a11y-trigger:focus-visible .a11y-icon--light-hover { display: none; }
[data-theme="dark"] .a11y-icon--dark-rest { display: block; }
[data-theme="dark"] .a11y-trigger:hover .a11y-icon--dark-rest,
[data-theme="dark"] .a11y-trigger:focus-visible .a11y-icon--dark-rest { display: none; }
[data-theme="dark"] .a11y-trigger:hover .a11y-icon--dark-hover,
[data-theme="dark"] .a11y-trigger:focus-visible .a11y-icon--dark-hover { display: block; }

/* Alto contraste */
[data-theme="contrast"] .a11y-icon--light-rest,
[data-theme="contrast"] .a11y-icon--light-hover,
[data-theme="contrast"] .a11y-icon--dark-rest,
[data-theme="contrast"] .a11y-icon--dark-hover { display: none; }
[data-theme="contrast"] .a11y-trigger:hover .a11y-icon--light-hover,
[data-theme="contrast"] .a11y-trigger:focus-visible .a11y-icon--light-hover { display: none; }
[data-theme="contrast"] .a11y-icon--contrast { display: block; }

.topbar-btn .badge {
    position: absolute;
    top: 5px; right: 5px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--danger);
    border: 1.5px solid var(--topbar-bg);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .35rem .65rem .35rem .45rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--control-border);
    cursor: pointer;
    transition: background .14s;
    background: transparent;
    color: var(--ink);
}

.topbar-user:hover { background: var(--nav-hover-bg); }

.topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.topbar-user__info { min-width: 0; }
.topbar-user__info strong {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
}

.profile-badge {
    display: inline-block;
    padding: .1rem .45rem;
    border-radius: 20px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
}

[data-theme="dark"] .profile-badge {
    background: #0b4f71;
    color: #e0f2fe;
}

[data-theme="contrast"] .profile-badge {
    background: #ffff00;
    color: #000000;
    border: 1px solid #ffff00;
}

/* ─── 6. MAIN CONTENT ────────────────────────────────────── */
.app-main {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* ─── 7. NOTICE / FLASH ──────────────────────────────────── */
.notice {
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--info-soft);
    color: var(--info);
    font-size: .83rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--info);
}

.notice--success { background: var(--success-soft); color: var(--success); border-left-color: var(--success); }
.notice--danger  { background: var(--danger-soft);  color: var(--danger);  border-left-color: var(--danger); }
.notice--warning { background: var(--warning-soft); color: var(--warning); border-left-color: var(--warning); }

[data-theme="dark"] .notice {
    background: #082f49;
    color: #bae6fd;
    border-left-color: #38bdf8;
}

[data-theme="dark"] .notice--success {
    background: #052e1a;
    color: #86efac;
    border-left-color: #22c55e;
}

[data-theme="dark"] .notice--danger {
    background: #450a0a;
    color: #fecaca;
    border-left-color: #f87171;
}

[data-theme="dark"] .notice--warning {
    background: #422006;
    color: #fde68a;
    border-left-color: #facc15;
}

[data-theme="contrast"] .notice,
[data-theme="contrast"] .notice--success,
[data-theme="contrast"] .notice--danger,
[data-theme="contrast"] .notice--warning {
    background: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
    border-left: 6px solid #ffff00;
}

/* ─── 8. CARDS ───────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

/* ─── 9. DASHBOARD ───────────────────────────────────────── */
.welcome-section {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.welcome-section__text { }
.welcome-section__text h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: .25rem;
    color: var(--ink);
}
.welcome-section__text p {
    color: var(--muted);
    font-size: .85rem;
}

.calendar-card {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .65rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--ink);
    text-decoration: none;
    font-size: .8rem;
    transition: box-shadow .14s;
}

.calendar-card:hover { box-shadow: var(--shadow-md); color: var(--ink); }
.calendar-card__icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    background: var(--brand-soft);
    display: flex; align-items: center; justify-content: center;
}
.calendar-card__icon svg { width: 20px; height: 20px; color: var(--brand); }
.calendar-card__text strong { display: block; font-weight: 700; }
.calendar-card__text small { color: var(--muted); }

/* ─── Module section ─── */
.module-section {
    margin-bottom: 2rem;
}

.module-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .85rem;
}

.module-section__title {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.module-section__title h2 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--ink);
}

.module-section__subtitle {
    font-size: .78rem;
    color: var(--muted);
}

.section-link {
    font-size: .8rem;
    font-weight: 600;
    color: var(--brand);
    display: flex;
    align-items: center;
    gap: .25rem;
}

.section-link svg { width: 14px; height: 14px; }

/* ─── Module icon badge ─── */
.module-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.module-icon svg { width: 20px; height: 20px; }

.module-icon--blue   { background: #e0f2fe; color: #0369a1; }
.module-icon--navy   { background: var(--brand-soft); color: var(--brand); }
.module-icon--teal   { background: #ccfbf1; color: #0f766e; }
.module-icon--green  { background: #dcfce7; color: #15803d; }
.module-icon--amber  { background: #fef3c7; color: #b45309; }
.module-icon--violet { background: #ede9fe; color: #6d28d9; }
.module-icon--rose   { background: #ffe4e6; color: #be185d; }
.module-icon--sky    { background: #e0f2fe; color: #0284c7; }
.module-icon--slate  { background: #f1f5f9; color: #475569; }
.module-icon--gold   { background: #fef9c3; color: #a16207; }
.module-icon--orange { background: #ffedd5; color: #c2410c; }

/* Dark mode — tons escuros para os ícones de módulo */
[data-theme="dark"] .module-icon--blue   { background: rgba(3,105,161,.18);   color: #7dd3fc; }
[data-theme="dark"] .module-icon--navy   { background: rgba(3,61,96,.35);      color: #7dd3fc; }
[data-theme="dark"] .module-icon--teal   { background: rgba(15,118,110,.2);    color: #5eead4; }
[data-theme="dark"] .module-icon--green  { background: rgba(21,128,61,.18);    color: #86efac; }
[data-theme="dark"] .module-icon--amber  { background: rgba(180,83,9,.2);      color: #fcd34d; }
[data-theme="dark"] .module-icon--violet { background: rgba(109,40,217,.2);    color: #c4b5fd; }
[data-theme="dark"] .module-icon--rose   { background: rgba(190,24,93,.2);     color: #fda4af; }
[data-theme="dark"] .module-icon--sky    { background: rgba(2,132,199,.2);     color: #7dd3fc; }
[data-theme="dark"] .module-icon--slate  { background: rgba(71,85,105,.25);    color: #94a3b8; }
[data-theme="dark"] .module-icon--gold   { background: rgba(161,98,7,.2);      color: #fde68a; }
[data-theme="dark"] .module-icon--orange { background: rgba(194,65,12,.2);     color: #fdba74; }

/* Alto contraste — fundo preto, ícone amarelo para máxima visibilidade */
[data-theme="contrast"] .module-icon--blue,
[data-theme="contrast"] .module-icon--navy,
[data-theme="contrast"] .module-icon--teal,
[data-theme="contrast"] .module-icon--green,
[data-theme="contrast"] .module-icon--amber,
[data-theme="contrast"] .module-icon--violet,
[data-theme="contrast"] .module-icon--rose,
[data-theme="contrast"] .module-icon--sky,
[data-theme="contrast"] .module-icon--slate,
[data-theme="contrast"] .module-icon--gold,
[data-theme="contrast"] .module-icon--orange { background: #111111; color: #ffff00; border: 1px solid #444; }

/* ─── Dept grid (GAE / CAE department cards) ─── */
.dept-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .85rem;
}

.dept-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.1rem .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-decoration: none;
    color: var(--ink);
    transition: box-shadow .18s, border-color .18s, transform .18s;
}

.dept-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--brand);
    color: var(--ink);
    transform: translateY(-1px);
}

[data-theme="dark"] .dept-card:hover {
    border-color: #38bdf8;
    box-shadow: 0 4px 16px rgba(56,189,248,.12);
}

.dept-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .65rem;
}

.dept-card__icon svg { width: 24px; height: 24px; }

.dept-card__title {
    font-size: .8rem;
    font-weight: 700;
    margin-bottom: .2rem;
    line-height: 1.3;
    color: var(--ink);
}

.dept-card__description {
    margin: 0 0 .35rem;
    color: var(--muted);
    font-size: .72rem;
    line-height: 1.35;
}

.dept-card__sub {
    font-size: .72rem;
    color: var(--muted);
    line-height: 1.35;
}

/* CAE administrative departments */
.cae-admin-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.35rem;
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.cae-admin-hero--compact {
    align-items: center;
}

.cae-admin-hero h2 {
    margin-top: .25rem;
    font-size: 1.35rem;
    line-height: 1.2;
    color: var(--ink);
}

.cae-admin-hero p {
    margin-top: .35rem;
    max-width: 760px;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.55;
}

.cae-dept-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .9rem;
}

.cae-dept-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 230px;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.cae-dept-card__marker {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--brand);
}

.cae-dept-card--green .cae-dept-card__marker { background: var(--success); }
.cae-dept-card--sky .cae-dept-card__marker { background: var(--info); }
.cae-dept-card--slate .cae-dept-card__marker { background: #64748b; }

.cae-dept-card__top {
    display: flex;
    justify-content: flex-start;
    margin-bottom: .8rem;
}

.cae-dept-card__icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cae-dept-card__icon svg {
    width: 20px;
    height: 20px;
}

.cae-dept-card h3 {
    font-size: .98rem;
    line-height: 1.25;
    color: var(--ink);
    margin-bottom: .45rem;
}

.cae-dept-card p {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.cae-dept-card .btn {
    margin-top: auto;
    align-self: flex-start;
}

.cae-dept-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
    gap: 1rem;
}

.cae-detail-panel {
    padding: 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.cae-detail-panel--muted {
    background: var(--nav-hover-bg);
}

.cae-detail-panel h2 {
    font-size: 1rem;
    color: var(--ink);
    margin-bottom: .4rem;
}

.cae-detail-panel p {
    color: var(--muted);
    font-size: .85rem;
    line-height: 1.55;
}

.cae-resource-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
}

.cae-resource-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-height: 44px;
    padding: .65rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
}

.cae-resource-item span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--brand);
    flex: 0 0 auto;
}

.cae-resource-item strong {
    font-size: .82rem;
}

.cae-note {
    margin-top: .85rem;
    padding-top: .85rem;
    border-top: 1px solid var(--border);
}

/* ─── Module/Governance grid ─── */
.mod-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .85rem;
}

.mod-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem .6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-decoration: none;
    color: var(--ink);
    transition: box-shadow .18s, border-color .18s, transform .18s;
}

.mod-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--brand);
    color: var(--ink);
    transform: translateY(-1px);
}

[data-theme="dark"] .mod-card:hover {
    border-color: #38bdf8;
    box-shadow: 0 4px 16px rgba(56,189,248,.12);
}

.mod-card__icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .55rem;
}

.mod-card__icon svg { width: 22px; height: 22px; }

.mod-card__title {
    font-size: .75rem;
    font-weight: 700;
    margin-bottom: .15rem;
    line-height: 1.3;
    color: var(--ink);
}

.mod-card__sub {
    font-size: .68rem;
    color: var(--muted);
    line-height: 1.3;
}

/* ─── Quick access grid ─── */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .85rem;
}

.quick-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .8rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-decoration: none;
    color: var(--ink);
    transition: box-shadow .18s, border-color .18s;
}

.quick-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--brand);
    color: var(--ink);
}

[data-theme="dark"] .quick-card:hover {
    border-color: #38bdf8;
    box-shadow: 0 4px 16px rgba(56,189,248,.12);
}

.quick-card__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quick-card__icon svg { width: 18px; height: 18px; }

.quick-card__text { overflow: hidden; min-width: 0; }
.quick-card__text strong {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.quick-card__text small {
    display: block;
    font-size: .72rem;
    color: var(--muted);
    line-height: 1.3;
}

/* ─── 10. DEPT / MODULE PAGE ─────────────────────────────── */
.page-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.page-hero__icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-hero__icon svg { width: 28px; height: 28px; }

.page-hero__text h1 { font-size: 1.25rem; margin-bottom: .2rem; }
.page-hero__text p  { font-size: .85rem; color: var(--muted); }

/* Tools grid inside dept page */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.tool-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--ink);
    transition: box-shadow .18s, border-color .18s;
    min-height: 120px;
}

.tool-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--brand);
    color: var(--ink);
}

.tool-card__header {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: .65rem;
}

.tool-card__icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tool-card__icon svg { width: 18px; height: 18px; }

.tool-card__name { font-size: .85rem; font-weight: 700; }
.tool-card__desc { font-size: .78rem; color: var(--muted); line-height: 1.4; }

.placeholder-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 20px;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-top: .5rem;
    align-self: flex-start;
}

[data-theme="contrast"] .active-badge,
[data-theme="contrast"] .placeholder-badge,
[data-theme="contrast"] .restricted-badge {
    background: #000000 !important;
    border: 1px solid #ffffff;
    color: #ffffff !important;
    font-weight: 900;
    text-shadow: none;
}

[data-theme="contrast"] .active-badge {
    border-color: #00ff66;
    color: #00ff66 !important;
}

[data-theme="contrast"] .placeholder-badge,
[data-theme="contrast"] .restricted-badge {
    border-color: #ffff00;
    color: #ffff00 !important;
}

[data-theme="contrast"] .active-badge::before {
    background: currentColor;
}

.active-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 20px;
    background: color-mix(in srgb, var(--success) 12%, transparent);
    color: var(--success);
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-top: .5rem;
    align-self: flex-start;
}

.restricted-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 20px;
    background: color-mix(in srgb, var(--muted) 15%, transparent);
    color: var(--muted);
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-top: .5rem;
    align-self: flex-start;
}

.tool-card--active {
    border-color: color-mix(in srgb, var(--brand) 30%, transparent);
}

.tool-card--active:hover {
    border-color: var(--brand);
}

/* Page heading — intro text acima de grids de links */
.page-heading {
    margin-bottom: 1rem;
}

.page-heading p {
    font-size: .875rem;
    color: var(--muted);
}

/* Link grid — mapas, formulários e páginas de links externos */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.link-card {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: 1rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--ink);
    transition: box-shadow .18s, border-color .18s, background .18s;
    cursor: pointer;
}

.link-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--brand);
    color: var(--ink);
}

.link-card.is-active {
    border-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 6%, var(--surface));
}

.link-card strong {
    font-size: .9rem;
    font-weight: 700;
    color: var(--ink);
}

.link-card span {
    font-size: .78rem;
    color: var(--muted);
    line-height: 1.4;
}

/* Map view — iframe embed section */
.map-view {
    margin-top: 1.75rem;
}

.map-view h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .75rem;
    color: var(--ink);
}

.map-view iframe {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 100%;
    display: block;
}

/* Dept sub-nav (inside module pages) */
.dept-subnav {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.dept-subnav__item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .85rem;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    transition: all .14s;
}

.dept-subnav__item:hover { border-color: var(--brand); color: var(--brand); }
.dept-subnav__item.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.dept-subnav__item svg { width: 15px; height: 15px; }

/* ─── 11. METRIC CARDS ───────────────────────────────────── */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--brand);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.metric-card__value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1;
    margin-bottom: .25rem;
}

.metric-card__label { font-size: .76rem; color: var(--muted); }
.metric-card span {
    display: inline-block;
    color: var(--muted);
    font-size: .78rem;
}
.metric-card strong {
    display: inline-block;
    color: var(--ink);
    font-size: 1.15rem;
    font-weight: 800;
    margin-left: .15rem;
}
.metric-card--success { border-top-color: var(--success); }
.metric-card--warning { border-top-color: var(--warning); }
.metric-card--warn { border-top-color: var(--warning); }
.metric-card--danger  { border-top-color: var(--danger); }

/* ─── 12. TABLE CARD ─────────────────────────────────────── */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--border);
}

.table-card__title { font-size: .9rem; font-weight: 700; }

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

th {
    padding: .6rem 1rem;
    background: var(--surface-2);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    font-size: .83rem;
    color: var(--ink);
    background: var(--surface);
}

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

/* clickable-row */
.clickable-row { cursor: pointer; }

/* table-actions (botões inline em tabelas) */
.table-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}

.inline-details {
    position: relative;
    display: inline-block;
}

.inline-details > summary {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: .3rem .65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--brand);
    background: var(--surface);
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    white-space: nowrap;
}

.inline-details > summary::-webkit-details-marker { display: none; }

.inline-details[open] > summary {
    border-color: var(--brand);
    background: var(--brand-soft);
}

/* icon-actions / icon-action */
.icon-actions {
    display: flex;
    align-items: center;
    gap: .2rem;
}

.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    padding: 0;
    line-height: 1;
}

.icon-action svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    display: block;
}

.icon-action--view  { color: var(--info); }
.icon-action--view:hover  { background: var(--info-soft);    border-color: var(--info);    color: var(--info); }
.icon-action--edit  { color: var(--brand-mid); }
.icon-action--edit:hover  { background: var(--brand-soft);   border-color: var(--brand);   color: var(--brand); }
.icon-action--copy  { color: var(--success); }
.icon-action--copy:hover  { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.icon-action--delete { color: var(--danger); }
.icon-action--delete:hover { background: var(--danger-soft); border-color: var(--danger);  color: var(--danger); }

[data-theme="dark"] .icon-action--view:hover  { background: rgba(2,132,199,.15); }
[data-theme="dark"] .icon-action--edit:hover  { background: rgba(3,61,96,.4); }
[data-theme="dark"] .icon-action--copy:hover  { background: rgba(22,163,74,.15); }
[data-theme="dark"] .icon-action--delete:hover { background: rgba(220,38,38,.15); }

.page-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand);
}

.page-title-icon svg,
nav[role="navigation"] svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.location-matrix {
    overflow: visible;
}

.location-matrix__regional,
.location-matrix__administracao {
    border-bottom: 1px solid var(--border-soft);
}

.location-matrix__regional:last-child,
.location-matrix__administracao:last-child {
    border-bottom: none;
}

.location-matrix__regional > summary,
.location-matrix__administracao > summary {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: .85rem 1rem;
    cursor: pointer;
    list-style: none;
}

.location-matrix__regional > summary {
    background: var(--surface-2);
}

.location-matrix__administracao > summary {
    background: var(--surface);
    padding-left: 1.5rem;
}

.location-matrix__regional > summary::-webkit-details-marker,
.location-matrix__administracao > summary::-webkit-details-marker {
    display: none;
}

.location-matrix__regional > summary span,
.location-matrix__administracao > summary span {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.location-matrix__regional > summary strong,
.location-matrix__administracao > summary strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.location-matrix__regional > summary em,
.location-matrix__administracao > summary em {
    color: var(--muted);
    font-size: .78rem;
    font-style: normal;
    white-space: nowrap;
}

.location-matrix__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: .5rem;
    padding: .75rem 1rem 1rem 1.5rem;
    background: var(--surface-2);
}

.location-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 62px;
    padding: .75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.location-tile strong {
    display: block;
    font-size: .88rem;
}

.location-tile small {
    display: block;
    margin-top: .2rem;
    color: var(--muted);
    font-size: .76rem;
}

.location-tile__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .35rem;
    flex-wrap: wrap;
}

/* ─── 13. FORMS ──────────────────────────────────────────── */
.form-card {
    padding: 1.5rem 1.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-card h2 {
    font-size: .95rem;
    font-weight: 700;
    color: var(--ink);
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: .5rem;
    margin: 0;
}

.form-group { margin-bottom: 1rem; }

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

.form-help {
    display: block;
    font-size: .75rem;
    color: var(--muted);
    margin-top: .3rem;
}

.form-error {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    padding: .65rem 1rem;
    font-size: .83rem;
    font-weight: 600;
}

.field-error {
    display: block;
    margin-top: .35rem;
    color: var(--control-error);
    font-size: .78rem;
    font-weight: 700;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

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

/* Signature flow */
.signature-flow {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.signature-flow > .field-label {
    font-size: .8rem;
    color: var(--brand);
}

.signature-flow > p {
    font-size: .82rem;
    color: var(--muted);
    margin: 0;
}

.signature-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .75rem;
}

[data-theme="dark"] .form-error {
    background: color-mix(in srgb, var(--danger) 15%, var(--surface));
    border-color: var(--danger);
    color: #fca5a5;
}

[data-theme="contrast"] .form-error {
    background: #000;
    border: 2px solid #ff4444;
    color: #ff4444;
}

[data-theme="contrast"] .signature-flow {
    border-color: #ffffff;
    background: #000000;
}

label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: .35rem;
}

input:not([type]),
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="url"],
select,
textarea {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: .45rem .75rem;
    background: var(--surface);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: .85rem;
    font-family: inherit;
    line-height: 1.5;
    transition: border-color .14s, box-shadow .14s;
    -webkit-appearance: none;
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: 3px solid var(--control-focus);
    outline-offset: 2px;
    border-color: var(--control-focus);
    box-shadow: none;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
select,
textarea {
    border-color: var(--control-border);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--surface-2);
    border-color: var(--control-border);
    color: var(--muted);
    cursor: not-allowed;
    opacity: 1;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    border-color: var(--control-error);
    box-shadow: 0 0 0 1px var(--control-error);
}

/* Inputs readonly — tom levemente diferente para indicar não-editável */
input[readonly], textarea[readonly] {
    background: var(--surface-2);
    color: var(--muted);
    cursor: default;
}

/* Dark mode — garantir que o browser não sobrescreva com branco */
[data-theme="dark"] input:not([type]),
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--control-border);
    color-scheme: dark;
}

[data-theme="dark"] input:disabled,
[data-theme="dark"] select:disabled,
[data-theme="dark"] textarea:disabled {
    background: var(--surface-2);
    border-color: var(--control-border);
    color: var(--muted);
}

[data-theme="dark"] input[aria-invalid="true"],
[data-theme="dark"] select[aria-invalid="true"],
[data-theme="dark"] textarea[aria-invalid="true"] {
    border-color: var(--control-error);
    box-shadow: 0 0 0 1px var(--control-error);
}

[data-theme="dark"] input[readonly],
[data-theme="dark"] textarea[readonly] {
    background: var(--surface-2);
    color: var(--muted);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: var(--control-focus);
    box-shadow: none;
}

/* Alto contraste — máxima legibilidade */
[data-theme="contrast"] input:not([type]),
[data-theme="contrast"] input[type="text"],
[data-theme="contrast"] input[type="email"],
[data-theme="contrast"] input[type="password"],
[data-theme="contrast"] input[type="number"],
[data-theme="contrast"] input[type="date"],
[data-theme="contrast"] input[type="time"],
[data-theme="contrast"] input[type="search"],
[data-theme="contrast"] input[type="url"],
[data-theme="contrast"] select,
[data-theme="contrast"] textarea {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
    color-scheme: dark;
}

[data-theme="contrast"] input[aria-invalid="true"],
[data-theme="contrast"] select[aria-invalid="true"],
[data-theme="contrast"] textarea[aria-invalid="true"] {
    border-color: var(--control-error) !important;
    outline: 2px solid var(--control-error);
    outline-offset: 1px;
}

[data-theme="contrast"] input[readonly],
[data-theme="contrast"] textarea[readonly] {
    background: #111111 !important;
    color: #ffff00 !important;
    border-color: #888888 !important;
}

/* Select — restaurar seta nativa onde -webkit-appearance foi removido */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2.25rem;
}

[data-theme="contrast"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23ffffff' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
}

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

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--brand);
}

[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"] {
    accent-color: #38bdf8;
}

[data-theme="contrast"] input[type="checkbox"],
[data-theme="contrast"] input[type="radio"] {
    accent-color: #ffff00;
}

/* ─── 14. BUTTONS ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .5rem 1.1rem;
    min-height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: .83rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background .14s, border-color .14s, color .14s, box-shadow .14s;
}

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

.btn--secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--control-border);
}
.btn--secondary:hover { border-color: var(--brand); color: var(--brand); }

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

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

.btn svg { width: 16px; height: 16px; }

.form-card button[type="submit"],
.filter-panel button[type="submit"],
.vue-actions button,
.auth-card button[type="submit"],
.card button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: .55rem 1rem;
    border: 1px solid var(--brand);
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: #ffffff;
    font: inherit;
    font-size: .84rem;
    font-weight: 800;
    cursor: pointer;
}

.form-card button[type="submit"]:hover,
.filter-panel button[type="submit"]:hover,
.vue-actions button:hover,
.auth-card button[type="submit"]:hover,
.card button[type="submit"]:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
}

[data-theme="contrast"] button:not(.topbar-btn):not(.topbar-toggle):not([data-theme-choice]),
[data-theme="contrast"] .action-button,
[data-theme="contrast"] .btn,
[data-theme="contrast"] .btn-primary,
[data-theme="contrast"] input[type="submit"],
[data-theme="contrast"] input[type="button"] {
    background: #000000;
    color: #ffff00;
    border-color: #ffffff;
}

[data-theme="contrast"] button:not(.topbar-btn):not(.topbar-toggle):not([data-theme-choice]):hover,
[data-theme="contrast"] .action-button:hover,
[data-theme="contrast"] .btn:hover,
[data-theme="contrast"] .btn-primary:hover,
[data-theme="contrast"] input[type="submit"]:hover,
[data-theme="contrast"] input[type="button"]:hover {
    background: #ffff00;
    color: #000000;
    border-color: #ffff00;
}

[data-theme="contrast"] .action-button--secondary,
[data-theme="contrast"] .btn--secondary {
    background: #000000;
    color: #ffffff;
    border-color: #ffffff;
}

[data-theme="contrast"] .button-danger,
[data-theme="contrast"] .action-button--danger,
[data-theme="contrast"] .btn--danger {
    background: #000000;
    color: #ff8080;
    border-color: #ff8080;
}

[data-theme="dark"] .btn--secondary,
[data-theme="dark"] .btn-outline-primary,
[data-theme="dark"] .btn-outline-secondary {
    background: var(--surface-2);
    color: var(--ink);
    border-color: var(--control-border);
}

[data-theme="dark"] .btn--secondary:hover,
[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="dark"] .btn-outline-secondary:hover {
    border-color: #38bdf8;
    color: #e0f2fe;
}

[data-theme="contrast"] input:focus,
[data-theme="contrast"] select:focus,
[data-theme="contrast"] textarea:focus,
[data-theme="contrast"] button:focus-visible,
[data-theme="contrast"] a:focus-visible {
    outline: 3px solid #ffff00;
    outline-offset: 2px;
    box-shadow: none;
}

/* Legacy compat */
.action-button { @extend .btn; @extend .btn--primary; }
.action-button--secondary { @extend .btn; @extend .btn--secondary; }

/* ─── 15. STATUS BADGE ───────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 20px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger  { background: var(--danger-soft);  color: var(--danger); }
.badge--info    { background: var(--info-soft);    color: var(--info); }
.badge--neutral { background: var(--border);       color: var(--muted); }

/* Legacy */
.status-badge { @extend .badge; }

/* ─── 16. AUTH SCREENS ───────────────────────────────────── */
.auth-screen .app-shell { display: block; min-height: 100vh; }
.auth-screen .app-sidebar { display: none; }
.auth-screen .topbar { display: none; }
.auth-screen .app-main { padding: 0; width: 100%; max-width: 100%; margin: 0; min-height: 100vh; }

.auth-layout {
    display: grid;
    grid-template-columns: minmax(300px, .85fr) minmax(380px, 1fr);
    min-height: 100vh;
    background: var(--surface);
}

.auth-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    padding: clamp(2rem, 6vw, 5rem);
    background: linear-gradient(145deg, #0d1b2a 0%, #033d60 100%);
    color: #fff;
    min-height: 100%;
}

[data-theme="contrast"] .auth-hero {
    background: #000000;
    border-right: 2px solid #ffffff;
}

.auth-logo {
    width: 180px;
    height: auto;
    align-self: flex-start;
    display: block;
}

.auth-hero__logo {
    width: 90px;
    height: 68px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 12px 30px rgba(0,0,0,.2);
}

.auth-hero h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); line-height: 1.1; color: #fff; }
.auth-hero p  { font-size: .95rem; color: rgba(255,255,255,.72); max-width: 420px; }

.auth-form-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: min(460px, 100%);
    padding: 2rem 2.25rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
}

.auth-kicker {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--brand);
    margin-bottom: .5rem;
}

.auth-card h2 { font-size: 1.4rem; margin-bottom: 1.25rem; }

/* ─── 17. EMBED PANEL ────────────────────────────────────── */
.embed-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* ─── 18. MISC / LEGACY COMPAT ───────────────────────────── */
.eyebrow {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
}

.overview-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.overview-metrics {
    display: flex;
    gap: 1.5rem;
    flex-shrink: 0;
}

.overview-metrics div { text-align: center; }
.overview-metrics strong { display: block; font-size: 1.6rem; font-weight: 800; color: var(--brand); }
.overview-metrics span  { font-size: .73rem; color: var(--muted); }

.module-section .section-heading { margin-bottom: .75rem; }
.module-section .section-heading h2 { font-size: .95rem; font-weight: 800; }
.module-section .section-heading span { font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.module-card {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--ink);
    transition: box-shadow .18s, border-color .18s;
}

.module-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand); color: var(--ink); }

[data-theme="dark"] .module-card:hover {
    border-color: #38bdf8;
    box-shadow: 0 4px 16px rgba(56,189,248,.12);
}

.module-card span  { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--brand); }
.module-card strong { font-size: .9rem; font-weight: 800; }
.module-card small  { font-size: .77rem; color: var(--muted); }

.module-card--blue   { border-top: 3px solid #0369a1; }
.module-card--teal   { border-top: 3px solid #0f766e; }
.module-card--amber  { border-top: 3px solid #b45309; }
.module-card--violet { border-top: 3px solid #6d28d9; }

.action-board { display: flex; flex-direction: column; gap: .75rem; }

.action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.action-row h3 { font-size: .9rem; margin-bottom: .15rem; }
.action-row p  { font-size: .8rem; color: var(--muted); }
.workspace-card__kicker { font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--brand); }

.action-stack { display: flex; gap: .5rem; flex-shrink: 0; }

.action-button {
    display: inline-flex;
    align-items: center;
    padding: .45rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid var(--brand);
    cursor: pointer;
    font-family: inherit;
    transition: background .14s;
}

.action-button:hover { background: var(--brand-hover); color: #fff; }

.action-button--secondary {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--control-border);
}

.action-button--secondary:hover { border-color: var(--brand); color: var(--brand); background: var(--surface); }
.action-button--danger {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}

.action-button--danger:hover {
    background: #b91c1c;
    color: #ffffff;
    border-color: #b91c1c;
}

[data-theme="dark"] .action-button--secondary {
    background: var(--surface-2);
    color: var(--ink);
    border-color: var(--control-border);
}

[data-theme="dark"] .action-button--secondary:hover {
    border-color: #38bdf8;
    color: #e0f2fe;
}

[data-theme="dark"] .action-button--danger {
    background: #991b1b;
    color: #fee2e2;
    border-color: #f87171;
}

[data-theme="dark"] .action-button--danger:hover {
    background: #7f1d1d;
    color: #ffffff;
    border-color: #fca5a5;
}
.action-button--full { display: flex; justify-content: center; width: 100%; }

.filter-panel {
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

/* Legacy topbar-status compat */
.topbar-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: .78rem;
    gap: .1rem;
}

.topbar-status span { color: var(--muted); }
.topbar-status strong { color: var(--ink); font-weight: 700; }

/* User edit compat */
.user-edit summary {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: .82rem;
    font-weight: 600;
    color: var(--brand);
    background: var(--surface);
    list-style: none;
}

.user-edit form {
    margin-top: .5rem;
    padding: 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* ─── 19. UTILITIES ──────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-muted { color: var(--muted); }
.text-sm { font-size: .8rem; }
.mt-0 { margin-top: 0; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: .5rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }

/* ─── 20. RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 1280px) {
    .mod-grid { grid-template-columns: repeat(4, 1fr); }
    .dept-grid { grid-template-columns: repeat(3, 1fr); }
    .quick-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 50;
        box-shadow: var(--shadow-lg);
        transition: left .22s ease;
    }
    .app-sidebar.is-open { left: 0; }
    .topbar-toggle { display: flex; }
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 45;
    }
    .sidebar-backdrop.is-open { display: block; }
    .dept-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
    .mod-grid   { grid-template-columns: repeat(3, 1fr); }
    .auth-layout { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
}

@media (max-width: 900px) {
    .topbar {
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr);
        align-items: center;
        gap: .55rem .75rem;
        height: auto;
        min-height: var(--topbar-h);
        padding-block: .65rem;
    }
    .topbar-toggle { grid-column: 1; }
    .topbar-title {
        grid-column: 2;
        min-width: 0;
    }
    .topbar-title h1 {
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .topbar-actions {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    .topbar-user {
        min-width: 0;
        max-width: 100%;
    }
    .topbar-user__info strong {
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .a11y-panel {
        right: auto;
        left: 0;
        max-width: calc(100vw - 2rem);
    }
}

@media (max-width: 640px) {
    .app-main { padding: 1rem; }
    .topbar {
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr);
        align-items: center;
        gap: .55rem .75rem;
        height: auto;
        min-height: var(--topbar-h);
        padding: .65rem 1rem;
    }
    .topbar-toggle { grid-column: 1; }
    .topbar-title {
        grid-column: 2;
        min-width: 0;
    }
    .topbar-title h1 { font-size: .95rem; }
    .topbar-actions {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: flex-start;
        gap: .4rem;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .topbar-actions::-webkit-scrollbar { display: none; }
    .theme-switcher { flex-shrink: 0; }
    .theme-switcher button {
        min-height: 34px;
        padding: 0 .62rem;
    }
    .dept-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-grid { grid-template-columns: 1fr; }
    .mod-grid   { grid-template-columns: repeat(2, 1fr); }
    .welcome-section { flex-direction: column; }
    .calendar-card { display: none; }
}

@media (max-width: 420px) {
    .topbar { padding-inline: .85rem; }
    .topbar-user {
        flex-shrink: 0;
        padding: .25rem;
    }
    .topbar-user__info,
    .topbar-user > svg { display: none; }
    .theme-switcher button {
        justify-content: center;
        width: 38px;
        padding: 0;
    }
    .theme-switcher .theme-label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0,0,0,0);
        white-space: nowrap;
    }
}

/* ─── BREADCRUMB ─────────────────────────────────────────── */
.breadcrumb-nav {
    margin-bottom: 1.5rem;
}
.breadcrumb-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.breadcrumb-item {
    display: flex;
    align-items: center;
}
.breadcrumb-separator {
    display: flex;
    align-items: center;
    color: var(--subtle);
}
.breadcrumb-separator svg {
    width: 14px;
    height: 14px;
}
.breadcrumb-link {
    display: flex;
    align-items: center;
    gap: .25rem;
    font-size: .8125rem;
    color: var(--brand-mid);
    text-decoration: none;
    padding: .2rem .4rem;
    border-radius: var(--radius-sm);
    transition: background .15s, color .15s;
}
.breadcrumb-link:hover {
    background: var(--brand-soft);
    color: var(--brand);
}
.breadcrumb-link svg {
    width: 15px;
    height: 15px;
}
.breadcrumb-current {
    font-size: .8125rem;
    color: var(--muted);
    padding: .2rem .4rem;
    font-weight: 500;
}
.breadcrumb-item--current .breadcrumb-current {
    color: var(--ink);
}

/* ─── TOOL BADGES ────────────────────────────────────────── */
.active-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .03em;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--success);
    line-height: 1;
}
.active-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.placeholder-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .03em;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: var(--border-soft);
    color: var(--subtle);
    line-height: 1;
}
.restricted-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .6875rem;
    font-weight: 600;
    letter-spacing: .03em;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: var(--warning-soft);
    color: var(--warning);
    line-height: 1;
}

/* ─── PORTAL VIEWS ───────────────────────────────────────── */
.portal-module-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.portal-module-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.portal-module-icon svg {
    width: 28px;
    height: 28px;
}
.portal-module-meta h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 .25rem;
}
.portal-module-meta p {
    font-size: .875rem;
    color: var(--muted);
    margin: 0;
}

/* Dept subnav inside portal pages */
.dept-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 2rem;
}
.dept-subnav-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .9rem;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}
.dept-subnav-link:hover {
    background: var(--nav-hover-bg);
    color: var(--ink);
}
.dept-subnav-link.is-active {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: var(--brand-soft);
    font-weight: 600;
}
.dept-subnav-link svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* Tool page */
.tool-hero {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}
.tool-hero-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tool-hero-icon svg { width: 32px; height: 32px; }
.tool-hero-body { flex: 1; }
.tool-hero-body h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 .4rem;
}
.tool-hero-body p {
    font-size: .9375rem;
    color: var(--muted);
    margin: 0 0 1rem;
}
.tool-hero-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.25rem;
    background: var(--brand);
    color: #fff;
    font-size: .875rem;
    font-weight: 600;
    border-radius: var(--radius);
    text-decoration: none;
    transition: background .15s;
    border: none;
    cursor: pointer;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary svg { width: 16px; height: 16px; }

.tool-unavailable {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    padding: 3rem 2rem;
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--muted);
}
.tool-unavailable svg {
    width: 48px;
    height: 48px;
    color: var(--subtle);
}
.tool-unavailable strong {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
}
.tool-unavailable span {
    font-size: .875rem;
    color: var(--muted);
}

.regional-structure-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .85rem;
}

.regional-structure-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.regional-structure-card h3 {
    margin: 0 0 .8rem;
    font-size: 1rem;
    color: var(--brand);
}

.regional-structure-card dl {
    display: grid;
    gap: .65rem;
}

.regional-structure-card div {
    display: grid;
    gap: .15rem;
}

.regional-structure-card dt {
    color: var(--subtle);
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.regional-structure-card dd {
    color: var(--ink);
    font-size: .82rem;
    margin: 0;
}

/* Engenharia imported from ENG */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .25rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.py-5 { padding-top: 2rem; padding-bottom: 2rem; }
.p-3 { padding: .85rem; }
.p-4 { padding: 1rem; }
.h3 { font-size: 1.45rem; }
.h5 { font-size: 1rem; }
.fw-semibold { font-weight: 700; }
.small { font-size: .78rem; }
.text-secondary { color: var(--muted); }
.text-center { text-align: center; }
.text-end { text-align: right; }
.text-decoration-none { text-decoration: none; }
.bg-white { background: var(--surface); }
.border { border: 1px solid var(--border); }
.border-top-0 { border-top: 0; }
.rounded-2,
.rounded-bottom-2 { border-radius: var(--radius); }
.row {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: .85rem;
}
.g-3 { gap: .85rem; }
.g-4 { gap: 1rem; }
.col-12 { grid-column: span 12; }
.col-md-2 { grid-column: span 2; }
.col-md-3 { grid-column: span 3; }
.col-md-4 { grid-column: span 4; }
.col-md-6 { grid-column: span 6; }
.col-md-8 { grid-column: span 8; }
.col-md-10 { grid-column: span 10; }
.col-lg-5 { grid-column: span 5; }
.col-lg-7 { grid-column: span 7; }
.form-label {
    display: block;
    margin-bottom: .3rem;
    font-size: .78rem;
    font-weight: 800;
    color: var(--ink);
}
.form-control,
.form-select {
    display: block;
    width: 100%;
}
.table-responsive { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--ink);
}
.table th,
.table td {
    padding: .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table th {
    font-size: .72rem;
    text-transform: uppercase;
    color: var(--subtle);
    background: var(--surface-2);
}
.table tr:last-child td { border-bottom: 0; }
.btn-primary,
.btn-outline-primary,
.btn-outline-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--brand);
    font-size: .83rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}
.btn-primary {
    background: var(--brand);
    color: #fff;
}
.btn-outline-primary,
.btn-outline-secondary {
    background: var(--surface);
    color: var(--brand);
}
.btn-outline-secondary {
    border-color: var(--border);
    color: var(--ink);
}
.btn-sm {
    min-height: 30px;
    padding: .3rem .65rem;
    font-size: .75rem;
}
.input-group {
    display: flex;
    gap: .35rem;
}
.input-group .form-control { min-width: 180px; }
.list-group,
.nav {
    list-style: none;
    padding: 0;
    margin: 0;
}
.list-group-item {
    border-bottom: 1px solid var(--border);
    padding: .65rem 0;
}
.nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    border-bottom: 1px solid var(--border);
}
.nav-link {
    border: 1px solid var(--border);
    border-bottom: 0;
    background: var(--surface-2);
    color: var(--muted);
    padding: .55rem .8rem;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font: inherit;
    font-size: .8rem;
    font-weight: 800;
    cursor: pointer;
}
.nav-link.active {
    background: var(--surface);
    color: var(--brand);
}
.tab-content {
    background: var(--surface);
    border: 1px solid var(--border);
}
.tab-pane { display: none; }
.tab-pane.show,
.tab-pane.active { display: block; }
.badge.text-bg-light {
    background: var(--surface-2);
    color: var(--ink);
    border: 1px solid var(--border);
}
[data-theme="contrast"] .btn-outline-primary,
[data-theme="contrast"] .btn-outline-secondary,
[data-theme="contrast"] .nav-link {
    background: #000000;
    color: #ffffff;
    border-color: #ffffff;
}
[data-theme="contrast"] .nav-link.active {
    background: #ffff00;
    color: #000000;
}

/* Theme hardening for legacy inline styles */
.check-row,
.check-row span {
    color: var(--ink) !important;
}

.check-row {
    border: 1px solid transparent;
}

.check-row:hover {
    background: color-mix(in srgb, var(--brand) 8%, transparent);
    border-color: color-mix(in srgb, var(--brand) 20%, transparent);
}

[data-theme="contrast"] .check-row,
[data-theme="contrast"] .check-row span {
    color: #ffffff !important;
}

[data-theme="contrast"] .check-row:hover {
    background: #111111;
    border-color: #ffff00;
}

[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background: #f8fafc"],
[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] [style*="background: #ffffff"],
[data-theme="dark"] [style*="background:#e5e7eb"],
[data-theme="dark"] [style*="background: #e5e7eb"] {
    background: var(--surface-2) !important;
}

[data-theme="dark"] [style*="border:1px solid #e2e8f0"],
[data-theme="dark"] [style*="border: 1px solid #e2e8f0"] {
    border-color: var(--border) !important;
}

[data-theme="dark"] [style*="color:#6b7280"],
[data-theme="dark"] [style*="color: #6b7280"],
[data-theme="dark"] [style*="color:#9ca3af"],
[data-theme="dark"] [style*="color: #9ca3af"] {
    color: #cbd5e1 !important;
}

[data-theme="dark"] [style*="color:#ef4444"],
[data-theme="dark"] [style*="color: #ef4444"] {
    color: #fca5a5 !important;
}

[data-theme="dark"] [style*="background:#6366f1"],
[data-theme="dark"] [style*="background: #6366f1"] {
    background: #38bdf8 !important;
}

[data-theme="dark"] [style*="background:#1e3a5f"],
[data-theme="dark"] [style*="background: #1e3a5f"] {
    background: #0b4f71 !important;
}

[data-theme="dark"] [style*="background:#dc2626"],
[data-theme="dark"] [style*="background: #dc2626"] {
    background: #991b1b !important;
}

[data-theme="contrast"] [style*="background:#f8fafc"],
[data-theme="contrast"] [style*="background: #f8fafc"],
[data-theme="contrast"] [style*="background:#ffffff"],
[data-theme="contrast"] [style*="background: #ffffff"],
[data-theme="contrast"] [style*="background:#e5e7eb"],
[data-theme="contrast"] [style*="background: #e5e7eb"] {
    background: #000000 !important;
}

[data-theme="contrast"] [style*="border:1px solid #e2e8f0"],
[data-theme="contrast"] [style*="border: 1px solid #e2e8f0"] {
    border-color: #ffffff !important;
}

[data-theme="contrast"] [style*="color:#6b7280"],
[data-theme="contrast"] [style*="color: #6b7280"],
[data-theme="contrast"] [style*="color:#9ca3af"],
[data-theme="contrast"] [style*="color: #9ca3af"] {
    color: #ffffff !important;
}

[data-theme="contrast"] [style*="color:#ef4444"],
[data-theme="contrast"] [style*="color: #ef4444"] {
    color: #ff8080 !important;
}

[data-theme="contrast"] [style*="background:#6366f1"],
[data-theme="contrast"] [style*="background: #6366f1"] {
    background: #ffff00 !important;
}

[data-theme="contrast"] [style*="background:#1e3a5f"],
[data-theme="contrast"] [style*="background: #1e3a5f"],
[data-theme="contrast"] [style*="background:#dc2626"],
[data-theme="contrast"] [style*="background: #dc2626"] {
    background: #000000 !important;
    color: #ffff00 !important;
    border: 1px solid #ffff00 !important;
}

[data-theme="contrast"] [style*="color:#fff"],
[data-theme="contrast"] [style*="color: #fff"],
[data-theme="contrast"] [style*="color:#ffffff"],
[data-theme="contrast"] [style*="color: #ffffff"] {
    color: #ffffff !important;
}

[data-theme="dark"] .badge.text-bg-light,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .tab-content {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--border);
}

[data-theme="contrast"] .badge.text-bg-light,
[data-theme="contrast"] .list-group-item,
[data-theme="contrast"] .tab-content {
    background: #000000;
    color: #ffffff;
    border-color: #ffffff;
}

/* Tool card badge overlay */
.tool-card { position: relative; }
.tool-card--active { border-color: color-mix(in srgb, var(--brand) 25%, transparent) !important; }

/* Administrative processes */
.process-flow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem;
}

.process-step {
    display: grid;
    gap: .25rem;
    min-height: 96px;
    padding: .85rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.process-step strong {
    color: var(--ink);
    font-size: .86rem;
}

.process-step small {
    color: var(--muted);
}

.process-step span {
    justify-self: flex-start;
    align-self: end;
    padding: .12rem .45rem;
    border-radius: 20px;
    background: color-mix(in srgb, var(--muted) 14%, transparent);
    color: var(--muted);
    font-size: .66rem;
    font-weight: 800;
    text-transform: uppercase;
}

.process-step--in_progress {
    border-color: color-mix(in srgb, var(--info) 45%, var(--border));
}

.process-step--in_progress span {
    background: var(--info-soft);
    color: var(--info);
}

.process-step--completed,
.process-step--approved {
    border-color: color-mix(in srgb, var(--success) 45%, var(--border));
}

.process-step--completed span,
.process-step--approved span {
    background: var(--success-soft);
    color: var(--success);
}

[data-theme="dark"] .process-step--in_progress span {
    background: #082f49;
    color: #bae6fd;
}

[data-theme="dark"] .process-step--completed span,
[data-theme="dark"] .process-step--approved span {
    background: #052e1a;
    color: #86efac;
}

[data-theme="contrast"] .process-step {
    background: #000000;
    border-color: #ffffff;
}

[data-theme="contrast"] .process-step span,
[data-theme="contrast"] .process-step--in_progress span,
[data-theme="contrast"] .process-step--completed span,
[data-theme="contrast"] .process-step--approved span {
    background: #ffff00;
    color: #000000;
}

@media (max-width: 640px) {
    .dept-subnav { gap: .375rem; }
    .dept-subnav-link { font-size: .75rem; padding: .375rem .7rem; }
    .tool-hero { flex-direction: column; }
    .regional-structure-grid { grid-template-columns: 1fr; }
    .row { grid-template-columns: 1fr; }
    .col-12,
    .col-md-2,
    .col-md-3,
    .col-md-4,
    .col-md-6,
    .col-md-8,
    .col-md-10,
    .col-lg-5,
    .col-lg-7 { grid-column: span 1; }
    .d-flex { flex-wrap: wrap; }
    .input-group { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════════════
   CARTA MUSICAL — TELA + IMPRESSÃO
   ═══════════════════════════════════════════════════════════════ */

.letter-preview {
  background: #dadada;
  padding: 1.5rem 1rem;
}

.letter-toolbar {
  max-width: 21cm;
  margin: 0 auto .75rem;
  display: flex;
  gap: .5rem;
  align-items: center;
}

/* ── Papel A4 ─────────────────────────────────── */
.official-letter {
  max-width: 21cm;
  margin: 0 auto;
  background: #fff;
  color: #000;
  padding: 1.4cm 1.8cm;
  box-shadow: 0 2px 24px rgba(0,0,0,.2);
  font-family: 'Times New Roman', Times, serif;
  font-size: 10.5pt;
  line-height: 1.45;
  min-height: 27cm;
  box-sizing: border-box;
}

/* ── Cabeçalho ─────────────────────────────────── */
.official-letter__header {
  display: flex;
  align-items: center;
  gap: .8rem;
  border-bottom: 1.5px solid #000;
  padding-bottom: .3cm;
  margin-bottom: .45cm;
}

.official-letter__logo {
  width: 56px;
  height: auto;
  flex-shrink: 0;
}

.official-letter__header h1 {
  flex: 1;
  margin: 0;
  font-size: 17pt;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: #000;
}

/* ── Saudação / linha de data ──────────────────── */
.official-letter__greeting {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: .35cm;
}

.official-letter__greeting > strong {
  font-size: 11pt;
  white-space: nowrap;
}

.date-line {
  display: inline-flex;
  align-items: baseline;
  gap: .1cm;
  white-space: nowrap;
  font-size: 10.5pt;
}

.date-line i {
  display: inline-block;
  font-style: normal;
  border-bottom: 1px solid #000;
}

.date-line i:nth-child(1) { min-width: 3.6cm; }  /* cidade */
.date-line i:nth-child(2) { min-width: .85cm; }   /* dia */
.date-line i:nth-child(3) { min-width: 2.6cm; }   /* mês */
.date-line i:nth-child(4) { min-width: 1.1cm; }   /* ano */

/* ── Parágrafo de solicitação ──────────────────── */
.official-letter__request {
  margin: .1cm 0 .3cm;
  line-height: 1.6;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: .15cm;
  margin-right: .55cm;
  white-space: nowrap;
}

/* ── Tabelas de seção (Identificação, Professora, Troca) ─ */
.letter-box-table {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  width: 100%;
  border: 1px solid #000;
  box-sizing: border-box;
  margin: .3cm 0;
}

.letter-box-table h2 {
  flex: 0 0 100%;
  margin: 0;
  background: #000;
  color: #fff;
  font-size: 10.5pt;
  font-weight: 700;
  text-align: center;
  padding: 3px 6px;
  box-sizing: border-box;
}

.letter-cell {
  flex: 1;
  border-right: 1px solid #000;
  border-top: 1px solid #000;
  padding: 3px 6px 6px;
  min-height: 1.15cm;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.letter-cell:last-child { border-right: none; }
.letter-cell--full      { flex: 0 0 100%; border-right: none; }
.letter-cell--small     { flex: 0 0 30%; border-right: none; }

.letter-cell > span {
  display: block;
  font-size: 8.5pt;
  line-height: 1.2;
}

.letter-cell > em {
  font-size: 8pt;
  font-style: italic;
}

.letter-cell > strong {
  display: block;
  font-weight: 400;
  font-size: 10pt;
  margin-top: 2px;
}

/* ── Caixa LGPD ────────────────────────────────── */
.lgpd-box {
  border: 2px solid #000;
  text-align: center;
  font-size: 9.5pt;
  font-weight: 700;
  line-height: 1.4;
  padding: 5px 10px;
  margin: .3cm 0;
}

/* ── Parágrafo declaratório ────────────────────── */
.official-letter__statement {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  margin: .3cm 0;
  font-size: 10.5pt;
}

.official-letter__statement--tight { font-size: 10pt; }

/* ── Assinatura do candidato ───────────────────── */
.candidate-signature {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: .25cm;
  margin: .45cm 0 .65cm;
}

.candidate-signature span {
  display: inline-block;
  border-bottom: 1px solid #000;
  min-width: 7.5cm;
}

/* ── Ministério local (assinaturas) ────────────── */
.official-signature-box {
  width: 100%;
  border: 1px solid #000;
  box-sizing: border-box;
  margin: .3cm 0;
}

.official-signature-box h2 {
  background: #000;
  color: #fff;
  font-size: 10.5pt;
  font-weight: 700;
  text-align: center;
  padding: 3px 6px;
  margin: 0;
}

.official-signature-row {
  display: flex;
  border-top: 1px solid #000;
  min-height: 1.6cm;
}

.official-signature-slot {
  flex: 1;
  border-right: 1px solid #000;
  padding: .3cm .45cm .12cm;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.official-signature-slot:last-child { border-right: none; }

.official-signature-slot > span { flex: 1; }

.official-signature-slot > small {
  display: block;
  font-size: 8.5pt;
  font-weight: 700;
}

.official-signature-slot > strong {
  display: block;
  font-size: 8.5pt;
  font-weight: 400;
  border-top: 1px solid #000;
  padding-top: 2px;
}

/* ── Caixa Resultado ───────────────────────────── */
.official-result-box {
  width: 100%;
  border: 1px solid #000;
  box-sizing: border-box;
  margin: .3cm 0;
}

.official-result-box h2 {
  background: #000;
  color: #fff;
  font-size: 10.5pt;
  font-weight: 700;
  text-align: center;
  padding: 3px 6px;
  margin: 0;
}

.official-result-head {
  display: flex;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
}

.official-result-head > div {
  padding: 3px 6px;
  border-right: 1px solid #000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: .9cm;
}

.official-result-head > div:nth-child(1) { width: 2.8cm; min-width: 2.8cm; flex-shrink: 0; }
.official-result-head > div:nth-child(2) { flex: 1; }
.official-result-head > div:last-child {
  border-right: none;
  width: 2.5cm;
  min-width: 2.5cm;
  flex-shrink: 0;
  align-items: center;
  text-align: center;
}

.official-result-head > div > span   { font-size: 8.5pt; }
.official-result-head > div > strong { font-size: 9pt; font-weight: 700; }

.result-check { text-align: center; }

.official-result-box .official-signature-row { min-height: 1.4cm; }

/* ── Rodapé da carta ───────────────────────────── */
.official-letter__footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 9pt;
  border-top: 1px solid #000;
  padding-top: 3px;
  margin-top: .5cm;
}

/* ── Seção de anexo manual (tela apenas) ───────── */
.manual-attachment {
  max-width: 21cm;
  margin: 1.5rem auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .5rem;
  padding: 1.25rem;
}

.manual-attachment h2 {
  font-size: 1rem;
  margin: 0 0 .75rem;
}

/* ═══════════════════════════════════════════════════════════════
   IMPRESSÃO
   ═══════════════════════════════════════════════════════════════ */
@media print {
  @page { size: A4 portrait; margin: 0; }

  .no-print,
  .letter-toolbar,
  .manual-attachment,
  .topbar,
  .app-sidebar,
  .sidebar-backdrop,
  .a11y-panel,
  .notice { display: none !important; }

  body, html {
    background: #fff !important;
    margin: 0;
    padding: 0;
  }

  .app-shell {
    display: block !important;
    grid-template-columns: none !important;
  }

  .app-main,
  .letter-preview {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .official-letter {
    max-width: none !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 1.2cm 1.8cm !important;
    box-shadow: none !important;
    margin: 0 !important;
  }

  .official-signature-box,
  .official-result-box,
  .letter-box-table,
  .lgpd-box {
    page-break-inside: avoid;
    break-inside: avoid;
  }
}

/* ─── CHAMADOS ───────────────────────────────────────────── */

/* Status badges */
.status-chamado-aberto              { background: var(--info-soft);    color: var(--info);    border: 1px solid var(--info); }
.status-chamado-em_analise          { background: var(--brand-soft);   color: var(--brand);   border: 1px solid var(--brand); }
.status-chamado-encaminhado         { background: var(--border);       color: var(--muted);   border: 1px solid var(--border-soft); }
.status-chamado-em_atendimento      { background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning); }
.status-chamado-aguardando_solicitante { background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning); }
.status-chamado-resolvido           { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.status-chamado-encerrado           { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.status-chamado-cancelado           { background: var(--danger-soft);  color: var(--danger);  border: 1px solid var(--danger); }

/* Priority badges */
.status-prioridade-baixa   { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.status-prioridade-media   { background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning); }
.status-prioridade-alta    { background: var(--danger-soft);  color: var(--danger);  border: 1px solid var(--danger); }
.status-prioridade-critica { background: var(--danger);       color: #fff;           border: 1px solid var(--danger); }

/* Notice variant for internal comments */
.notice--internal {
    background: var(--warning-soft);
    color: var(--warning);
    border-left-color: var(--warning);
}
[data-theme="dark"] .notice--internal { background: #422006; color: #fde68a; border-left-color: #facc15; }

/* Split layout: main + sidebar */
.split-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 900px) {
    .split-grid { grid-template-columns: 1fr; }
}

/* Progress bar */
.ticket-progress { margin: .5rem 0 0; }
.ticket-progress__track {
    background: var(--border);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}
.ticket-progress__bar {
    height: 8px;
    border-radius: 4px;
    background: var(--brand);
    transition: width .3s;
}
.ticket-progress__bar--low    { background: var(--danger); }
.ticket-progress__bar--mid    { background: var(--warning); }
.ticket-progress__bar--high   { background: var(--info); }
.ticket-progress__bar--done   { background: var(--success); }
.ticket-progress__label {
    display: flex;
    justify-content: space-between;
    font-size: .75rem;
    color: var(--muted);
    margin-bottom: .25rem;
}

/* Avatar com iniciais */
.ticket-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
}

/* Comentários */
.ticket-comment {
    display: flex;
    gap: .75rem;
    padding: .85rem 0;
    border-bottom: 1px solid var(--border-soft);
}
.ticket-comment:last-child { border-bottom: none; }
.ticket-comment__body { flex: 1; min-width: 0; }
.ticket-comment__meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .3rem;
    font-size: .8rem;
}
.ticket-comment__author { font-weight: 700; color: var(--ink); }
.ticket-comment__time   { color: var(--muted); margin-left: auto; }
.ticket-comment__text   { font-size: .88rem; color: var(--ink); white-space: pre-wrap; }
.ticket-comment--internal .ticket-comment__body {
    background: var(--warning-soft);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
}

/* Timeline de histórico */
.ticket-timeline { padding: .25rem 0; }
.ticket-timeline__item {
    display: flex;
    gap: .75rem;
    padding-bottom: 1rem;
    position: relative;
}
.ticket-timeline__item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 14px;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.ticket-timeline__dot {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--brand);
    margin-top: 3px;
}
.ticket-timeline__content { flex: 1; }
.ticket-timeline__who  { font-size: .8rem; font-weight: 700; color: var(--ink); }
.ticket-timeline__when { font-size: .75rem; color: var(--muted); }
.ticket-timeline__desc { font-size: .82rem; color: var(--ink); margin-top: .15rem; }
.ticket-timeline__change {
    font-size: .78rem;
    color: var(--muted);
    margin-top: .15rem;
}
.ticket-timeline__change-old { color: var(--danger); }
.ticket-timeline__change-new { color: var(--success); }

/* Anexos list */
.ticket-attachments__item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: .88rem;
}
.ticket-attachments__item:last-child { border-bottom: none; }
.ticket-attachments__name { flex: 1; min-width: 0; }
.ticket-attachments__size { color: var(--muted); font-size: .78rem; flex-shrink: 0; }

/* Info list lateral */
.ticket-info-list { list-style: none; padding: 0; margin: 0; }
.ticket-info-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: .83rem;
    gap: .5rem;
}
.ticket-info-list li:last-child { border-bottom: none; }
.ticket-info-list dt { color: var(--muted); flex-shrink: 0; }
.ticket-info-list dd { text-align: right; font-weight: 600; color: var(--ink); margin: 0; }

/* Dark theme adjustments */
[data-theme="dark"] .ticket-progress__track { background: var(--surface-2); }
[data-theme="dark"] .ticket-comment--internal .ticket-comment__body { background: #422006; }

/* ── Seletor de perfis agrupado ───────────────────────────────────────────── */
.profile-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: .55rem;
    margin-top: .5rem;
}

.profile-selector__group {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.profile-selector__group-label {
    padding: .3rem .6rem;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: var(--surface-2);
    color: var(--muted);
    border-bottom: 1px solid var(--border);
}

.profile-selector__group--gae .profile-selector__group-label {
    background: var(--brand-soft);
    color: var(--brand);
    border-bottom-color: #c2dff0;
}

.profile-selector__group--cae .profile-selector__group-label {
    background: #d1fae5;
    color: #065f46;
    border-bottom-color: #a7f3d0;
}

.profile-selector__group--muted .profile-selector__group-label {
    opacity: .65;
}

.profile-selector__options {
    padding: .35rem .4rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
    background: var(--surface);
}

.profile-selector__item {
    font-size: .83rem;
    padding: .18rem .3rem;
    border-radius: .2rem;
    gap: .4rem;
}

[data-theme="dark"] .profile-selector__group--gae .profile-selector__group-label {
    background: rgba(3,61,96,.3);
    color: #7ec8ef;
    border-bottom-color: rgba(3,61,96,.5);
}
[data-theme="dark"] .profile-selector__group--cae .profile-selector__group-label {
    background: rgba(6,78,59,.3);
    color: #6ee7b7;
    border-bottom-color: rgba(6,78,59,.5);
}
[data-theme="dark"] .profile-selector__options {
    background: var(--surface);
}
[data-theme="contrast"] .profile-selector__group {
    border-color: #ffff00;
}
[data-theme="contrast"] .profile-selector__group-label {
    background: #000 !important;
    color: #ffff00 !important;
    border-bottom-color: #ffff00 !important;
}

/* ─── CHAMADOS 3.0 ───────────────────────────────────────── */

/* Page shell */
.ch-page { display: flex; flex-direction: column; gap: 0; }
.ch-page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.ch-page-header h1 { font-size: 1.5rem; font-weight: 800; margin: 0 0 .2rem; color: var(--ink); }
.ch-page-header p  { font-size: .82rem; color: var(--muted); margin: 0; }

/* Sub-navigation tabs */
.ch-subnav {
    display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none;
    margin-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.ch-subnav::-webkit-scrollbar { display: none; }
.ch-subnav__item {
    display: flex; align-items: center; gap: .35rem;
    padding: .55rem .9rem; font-size: .82rem; font-weight: 600;
    color: var(--muted); text-decoration: none; white-space: nowrap;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: color .15s;
}
.ch-subnav__item:hover { color: var(--brand); }
.ch-subnav__item.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.ch-subnav__count {
    background: var(--surface-2); color: var(--muted);
    border-radius: 99px; font-size: .68rem; padding: .05rem .4rem;
    font-weight: 700; min-width: 18px; text-align: center;
}
.ch-subnav__item.is-active .ch-subnav__count { background: var(--brand); color: #fff; }

/* Dashboard grid */
.ch-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: .75rem; margin-bottom: 1.25rem;
}
.ch-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem 1.25rem;
    display: flex; flex-direction: column; gap: .35rem;
    transition: box-shadow .15s, border-color .15s;
    cursor: default;
}
.ch-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.07); border-color: var(--border-soft); }
.ch-card__icon-row {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: .15rem;
}
.ch-card__icon {
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ch-card__icon svg { width: 18px; height: 18px; }
.ch-card__icon--blue   { background: var(--info-soft); color: var(--info); }
.ch-card__icon--orange { background: var(--warning-soft); color: var(--warning); }
.ch-card__icon--red    { background: var(--danger-soft); color: var(--danger); }
.ch-card__icon--green  { background: var(--success-soft); color: var(--success); }
.ch-card__icon--purple { background: #ede9fe; color: #6d28d9; }
.ch-card__icon--gray   { background: var(--surface-2); color: var(--muted); }
.ch-card__value { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--ink); }
.ch-card__label { font-size: .76rem; color: var(--muted); font-weight: 500; }
.ch-card__sub   { font-size: .7rem; font-weight: 600; }
.ch-card__sub--danger  { color: var(--danger); }
.ch-card__sub--warning { color: var(--warning); }
.ch-card__sub--success { color: var(--success); }
.ch-card__sub--info    { color: var(--info); }
.ch-card__sub--muted   { color: var(--muted); }

/* Two-column layout: filter panel + main */
.ch-content-split {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1rem;
    align-items: start;
}
@media (max-width: 960px) { .ch-content-split { grid-template-columns: 1fr; } }

/* Filter panel (left column) */
.ch-filters {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem;
    display: flex; flex-direction: column; gap: .75rem; position: sticky; top: 1rem;
}
.ch-filters__title {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--muted); display: flex;
    align-items: center; gap: .35rem; margin-bottom: .25rem;
}
.ch-filters__title svg { width: 14px; height: 14px; }
.ch-filters label { font-size: .78rem; color: var(--muted); font-weight: 500; margin-bottom: .2rem; display: block; }
.ch-filters input,
.ch-filters select { font-size: .82rem; padding: .4rem .6rem; }
.ch-filters__search { position: relative; }
.ch-filters__search input { padding-left: 2rem; }
.ch-filters__search-icon {
    position: absolute; left: .6rem; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; color: var(--muted); pointer-events: none;
}
.ch-filters__sep { border: none; border-top: 1px solid var(--border-soft); margin: .15rem 0; }
.ch-filters__tip {
    background: var(--surface-2); border-radius: var(--radius-sm);
    padding: .6rem .75rem; font-size: .75rem; color: var(--muted);
}
.ch-filters__tip strong { color: var(--brand); }
.ch-filters__tip a { color: var(--brand); font-size: .75rem; font-weight: 600; }
.ch-filters__actions { display: flex; gap: .5rem; }
.ch-filters__actions button,
.ch-filters__actions a { flex: 1; text-align: center; font-size: .8rem; padding: .45rem; }

/* Main panel (right column) */
.ch-main-panel { display: flex; flex-direction: column; gap: .75rem; }

/* Status tab bar */
.ch-tabs {
    display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .35rem;
}
.ch-tabs::-webkit-scrollbar { display: none; }
.ch-tab {
    display: flex; align-items: center; gap: .3rem; padding: .35rem .7rem;
    border-radius: var(--radius-sm); font-size: .8rem; font-weight: 600;
    color: var(--muted); text-decoration: none; white-space: nowrap;
    transition: background .12s, color .12s;
}
.ch-tab:hover { background: var(--surface-2); color: var(--ink); }
.ch-tab.is-active { background: var(--brand); color: #fff; }
.ch-tab__count {
    background: rgba(255,255,255,.25); border-radius: 99px;
    font-size: .67rem; padding: .05rem .35rem; font-weight: 700;
}
.ch-tab:not(.is-active) .ch-tab__count { background: var(--border); color: var(--muted); }

/* Table wrapper */
.ch-table-wrap {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.ch-table-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .65rem 1rem; border-bottom: 1px solid var(--border-soft); gap: .75rem;
    flex-wrap: wrap;
}
.ch-table-title { font-size: .82rem; font-weight: 700; color: var(--muted); }
.ch-view-switch {
    display: flex; border: 1px solid var(--border);
    border-radius: var(--radius-sm); overflow: hidden;
}
.ch-view-switch__btn {
    padding: .3rem .7rem; font-size: .78rem; border: none;
    background: none; color: var(--muted); cursor: pointer;
    display: flex; align-items: center; gap: .3rem;
    transition: background .12s, color .12s;
}
.ch-view-switch__btn svg { width: 14px; height: 14px; }
.ch-view-switch__btn:hover { background: var(--surface-2); color: var(--ink); }
.ch-view-switch__btn.is-active { background: var(--brand); color: #fff; }

/* Compact table */
.ch-table { width: 100%; border-collapse: collapse; }
.ch-table th {
    padding: .55rem 1rem; font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); text-align: left; border-bottom: 1px solid var(--border);
    white-space: nowrap; background: var(--surface-2);
}
.ch-table td {
    padding: .6rem 1rem; font-size: .84rem; color: var(--ink);
    border-bottom: 1px solid var(--border-soft); vertical-align: middle;
}
.ch-table tbody tr:last-child td { border-bottom: none; }
.ch-table tbody tr { cursor: pointer; transition: background .1s; }
.ch-table tbody tr:hover { background: var(--surface-2); }
.ch-table__code { font-family: monospace; font-size: .78rem; color: var(--muted); white-space: nowrap; }
.ch-table__title { font-weight: 600; max-width: 220px; }
.ch-table__title div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-table__sub { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.ch-table__date { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.ch-table__person { font-size: .82rem; }
.ch-table__person-sub { font-size: .7rem; color: var(--muted); }
.ch-table__avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--brand); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .65rem; font-weight: 700; flex-shrink: 0; vertical-align: middle;
    margin-right: .3rem;
}
.ch-table td:last-child { padding: .4rem .75rem; text-align: right; white-space: nowrap; }

/* Empty state */
.ch-empty {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 3rem 1.5rem; text-align: center; gap: .75rem;
}
.ch-empty svg { width: 48px; height: 48px; color: var(--border); }
.ch-empty p { font-size: .88rem; color: var(--muted); margin: 0; }

/* Modern badges: priority */
.ch-badge {
    display: inline-flex; align-items: center; padding: .2rem .55rem;
    border-radius: 99px; font-size: .72rem; font-weight: 600;
    white-space: nowrap; letter-spacing: .01em;
}
.status-prioridade-urgente { background: #7c3aed; color: #fff; border: 1px solid #7c3aed; }

/* Missing status badges */
.status-chamado-em-triagem             { background: #e0e7ff; color: #3730a3; border: 1px solid #a5b4fc; }
.status-chamado-em_triagem             { background: #e0e7ff; color: #3730a3; border: 1px solid #a5b4fc; }
.status-chamado-aguardando-informacoes { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.status-chamado-aguardando_informacoes { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.status-chamado-aguardando-terceiros   { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.status-chamado-aguardando_terceiros   { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.status-chamado-concluido              { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* Criticidade badges */
.status-criticidade-baixa   { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.status-criticidade-media   { background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning); }
.status-criticidade-alta    { background: var(--danger-soft);  color: var(--danger);  border: 1px solid var(--danger); }
.status-criticidade-critica { background: var(--danger);       color: #fff;           border: 1px solid var(--danger); }

/* Kanban board */
.ch-kanban {
    display: flex; gap: 1rem; overflow-x: auto;
    padding-bottom: 1rem; align-items: flex-start; min-height: 400px;
}
.ch-kanban::-webkit-scrollbar { height: 6px; }
.ch-kanban::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.ch-kanban-col {
    min-width: 240px; max-width: 280px; flex-shrink: 0;
    background: var(--surface-2); border-radius: var(--radius);
    border: 1px solid var(--border);
}
.ch-kanban-col__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .65rem .85rem; border-bottom: 1px solid var(--border);
}
.ch-kanban-col__label {
    font-size: .75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted);
}
.ch-kanban-col__badge {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 99px; font-size: .68rem; font-weight: 700;
    padding: .05rem .4rem; color: var(--muted);
}
.ch-kanban-col__body { padding: .5rem; min-height: 80px; }
.ch-kanban-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .75rem; margin-bottom: .5rem;
    display: flex; flex-direction: column; gap: .4rem;
    cursor: pointer; transition: box-shadow .12s, border-color .12s;
}
.ch-kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); border-color: var(--brand); }
.ch-kanban-card__code { font-size: .68rem; color: var(--muted); font-family: monospace; }
.ch-kanban-card__title { font-size: .82rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.ch-kanban-card__meta { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.ch-kanban-card__footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: .2rem;
}
.ch-kanban-card__date { font-size: .7rem; color: var(--muted); }
.ch-kanban-empty { padding: .75rem; font-size: .78rem; color: var(--muted); text-align: center; }

/* Form blocks (create/edit) */
.ch-form-grid { display: flex; flex-direction: column; gap: 1rem; max-width: 860px; }
.ch-block {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.ch-block__header {
    display: flex; align-items: center; gap: .5rem;
    padding: .75rem 1.25rem; border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.ch-block__icon { width: 22px; height: 22px; color: var(--brand); }
.ch-block__title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); }
.ch-block__body { padding: 1.25rem; display: flex; flex-direction: column; gap: .85rem; }
.ch-block__row { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.ch-block__row--3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 680px) {
    .ch-block__row, .ch-block__row--3 { grid-template-columns: 1fr; }
}

/* Upload drop zone */
.ch-upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 1.75rem 1rem; text-align: center; cursor: pointer;
    transition: border-color .15s, background .15s;
    display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.ch-upload-zone:hover, .ch-upload-zone.is-drag-over {
    border-color: var(--brand); background: var(--brand-soft);
}
.ch-upload-zone svg { width: 32px; height: 32px; color: var(--muted); }
.ch-upload-zone p  { margin: 0; font-size: .82rem; color: var(--muted); }
.ch-upload-zone strong { color: var(--brand); }
.ch-upload-zone input[type=file] { display: none; }
.ch-upload-file-list { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.ch-upload-file-item {
    display: flex; align-items: center; gap: .5rem; font-size: .82rem;
    padding: .4rem .6rem; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.ch-upload-file-item svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.ch-upload-file-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-upload-file-item small { color: var(--muted); flex-shrink: 0; }
.ch-upload-file-item button {
    width: 20px; height: 20px; border: none; background: none;
    color: var(--danger); cursor: pointer; display: flex; align-items: center;
    justify-content: center; border-radius: 3px; flex-shrink: 0;
}
.ch-upload-file-item button:hover { background: var(--danger-soft); }

/* Dark theme */
[data-theme="dark"] .ch-card { background: var(--surface); }
[data-theme="dark"] .ch-filters { background: var(--surface); }
[data-theme="dark"] .ch-table-wrap { background: var(--surface); }
[data-theme="dark"] .ch-kanban-col { background: var(--surface-2); }
[data-theme="dark"] .ch-kanban-card { background: var(--surface); }
[data-theme="dark"] .ch-card__icon--purple { background: rgba(109,40,217,.2); }
[data-theme="dark"] .status-chamado-em_triagem { background: rgba(55,48,163,.2); color: #a5b4fc; border-color: rgba(55,48,163,.4); }
[data-theme="dark"] .status-chamado-concluido  { background: rgba(22,101,52,.2); color: #86efac; border-color: rgba(22,101,52,.4); }

/* Pagination wrapper */
.ch-pagination { padding: .6rem 1rem; border-top: 1px solid var(--border-soft); }

/* ── Notification bell ─────────────────────────────────────── */
.notif-bell { position: relative; }
.notif-badge {
    position: absolute;
    top: 3px; right: 3px;
    min-width: 16px; height: 16px;
    padding: 0 3px;
    background: #ef4444;
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    line-height: 16px;
    border-radius: 8px;
    text-align: center;
    pointer-events: none;
}

/* ── Notification index page ───────────────────────────────── */
.notif-list { display: flex; flex-direction: column; gap: .5rem; padding: 1rem 0; }
.notif-item {
    display: flex; align-items: flex-start; gap: .875rem;
    padding: .875rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: background .15s;
}
.notif-item.unread { border-left: 3px solid var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.notif-item__icon {
    flex-shrink: 0;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--surface-alt);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
}
.notif-item__body { flex: 1; min-width: 0; }
.notif-item__msg { font-size: .875rem; line-height: 1.4; color: var(--text); }
.notif-item__time { font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.notif-item__link { text-decoration: none; color: inherit; }
.notif-item__link:hover .notif-item { background: var(--surface-hover); }

/* ─── PROCESSOS — filter bar ─────────────────────────────── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .6rem;
    margin-bottom: 1.25rem;
    padding: .875rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.filter-bar__fields {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    flex: 1;
}
.filter-bar__input {
    padding: .45rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-size: .83rem;
    min-width: 140px;
}
.filter-bar__input--wide { min-width: 220px; flex: 1; }
.filter-bar__actions { display: flex; gap: .4rem; align-items: center; }

.action-button--ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    font-size: .82rem;
}
.action-button--ghost:hover { color: var(--ink); border-color: var(--muted); }

.metric-grid--4 { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.table-card__count {
    font-size: .8rem;
    color: var(--muted);
}

/* Processos — piloto RMA */
.rma-subnav { margin-bottom: .75rem; }
.rma-region-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .5rem;
}
.rma-region-shortcuts__item {
    padding: .3rem .7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: .78rem;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
}
.rma-region-shortcuts__item:hover,
.rma-region-shortcuts__item.is-active {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, var(--surface));
    color: var(--primary);
}
.rma-filter-bar {
    display: block;
    margin-bottom: .75rem;
    padding: .65rem .75rem;
}
.rma-filter-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.rma-filter-group + .rma-filter-group { margin-top: .65rem; padding-top: .65rem; border-top: 1px solid var(--border); }
.rma-filter-group legend { margin-bottom: .35rem; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.rma-filter-context { margin: -.15rem 0 .7rem; color: var(--muted); font-size: .76rem; }
.rma-filter-bar__fields {
    display: grid;
    grid-template-columns: minmax(240px, 1.6fr) repeat(3, minmax(150px, 1fr));
    gap: .5rem .65rem;
    align-items: end;
}
.rma-filter-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: .2rem;
}
.rma-filter-field > span {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.2;
}
.rma-filter-field .filter-bar__input {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: .35rem .55rem;
}
.rma-filter-bar__actions {
    grid-column: span 2;
    justify-content: flex-end;
    min-height: 34px;
}
.table-card--scroll { overflow-x: auto; }
.rma-matrix { min-width: 1480px; }
.validation-matrix { min-width: 1120px; }
.rma-work-panel { margin-top: 1rem; border-left: 4px solid var(--primary); }
.rma-work-panel__header { display: flex; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap; }
.rma-work-panel__header h3 { margin: .15rem 0; }
.rma-work-panel__header p { margin: .35rem 0; max-width: 76ch; }
.rma-work-panel__eyebrow { color: var(--muted); font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.rma-work-panel__status { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; min-width: 230px; }
.rma-work-panel__hint { margin: -.2rem 0 .8rem; color: var(--muted); font-size: .82rem; }
.rma-checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-bottom: .8rem; }
.rma-checklist__item { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.rma-checklist__item > div { min-width: 0; }
.rma-checklist__item strong, .rma-checklist__item small { display: block; }
.rma-checklist__item small { margin-top: .15rem; color: var(--muted); font-size: .72rem; }
.rma-checklist__item--rejected { border-color: var(--danger); }
.rma-actions { display: flex; align-items: flex-start; flex-wrap: wrap; gap: .55rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.rma-inline-action { display: flex; flex-wrap: wrap; gap: .4rem; }
.rma-inline-action input { min-width: 220px; }
.rma-action-form { width: min(100%, 620px); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .65rem; }
.rma-action-form summary { cursor: pointer; font-weight: 700; }
.rma-action-form form, .rma-origin-form form { display: grid; gap: .6rem; margin-top: .7rem; }
.rma-action-form select, .rma-action-form input, .rma-action-form textarea,
.rma-origin-form input, .rma-origin-form textarea { width: 100%; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.rma-origin-form { margin-top: 1rem; }

/* Processos — Matriz RA */
.ra-matrix-filters { display: block; margin-bottom: .65rem; padding: .65rem .75rem; }
.ra-matrix-filters__grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: .5rem .65rem; align-items: end; }
.ra-matrix-filters__grid--territorial { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
.ra-matrix-filter-check { display: flex; align-items: center; gap: .4rem; min-height: 34px; color: var(--ink); font-size: .8rem; }
.ra-matrix-filters .filter-bar__actions { justify-content: flex-end; min-height: 34px; }
.ra-matrix-legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin: 0 0 .55rem; color: var(--muted); font-size: .74rem; }
.ra-matrix-legend span { display: inline-flex; align-items: center; gap: .3rem; }
.ra-cell-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.ra-cell-dot--pending { background: var(--warning); }
.ra-cell-dot--success { background: var(--success); }
.ra-cell-dot--muted { background: var(--muted); }
.ra-matrix-wrap { position: relative; max-height: 68vh; overflow: auto; }
.ra-matrix-wrap .table-card__header { position: sticky; left: 0; z-index: 8; min-width: max-content; gap: 1rem; }
.ra-matrix-table { min-width: 4300px; border-collapse: separate; border-spacing: 0; }
.ra-matrix-table th, .ra-matrix-table td { min-width: 130px; max-width: 210px; padding: .45rem .5rem; border-right: 1px solid var(--border); vertical-align: top; }
.ra-matrix-table thead th { position: sticky; top: 0; z-index: 4; background: var(--surface-2); font-size: .72rem; line-height: 1.2; }
.ra-matrix-table thead .ra-matrix-table__groups th { top: 0; height: 28px; padding: .35rem .5rem; background: color-mix(in srgb, var(--primary) 9%, var(--surface)); color: var(--primary); text-align: center; }
.ra-matrix-table thead tr:last-child th { top: 28px; }
.ra-matrix-table thead tr:last-child th:nth-child(1), .ra-matrix-table tbody td:nth-child(1) { position: sticky; left: 0; min-width: 120px; max-width: 120px; z-index: 3; background: var(--surface); }
.ra-matrix-table thead tr:last-child th:nth-child(2), .ra-matrix-table tbody td:nth-child(2) { position: sticky; left: 120px; min-width: 160px; max-width: 160px; z-index: 3; background: var(--surface); }
.ra-matrix-table thead tr:last-child th:nth-child(3), .ra-matrix-table tbody td:nth-child(3) { position: sticky; left: 280px; min-width: 145px; max-width: 145px; z-index: 3; background: var(--surface); box-shadow: 5px 0 8px rgb(15 23 42 / 7%); }
.ra-matrix-table thead tr:last-child th:nth-child(-n+3) { z-index: 7; background: var(--surface-2); }
.ra-matrix-cell { position: relative; font-size: .74rem; }
.ra-matrix-cell > small, .ra-matrix-cell > a { display: block; margin-top: .25rem; }
.ra-matrix-cell--pending { background: color-mix(in srgb, var(--warning) 8%, var(--surface)); }
.ra-matrix-cell--success { background: color-mix(in srgb, var(--success) 7%, var(--surface)); }
.ra-matrix-cell--danger { background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.ra-matrix-cell--muted { background: var(--surface-2); }
.ra-matrix-status { white-space: normal; line-height: 1.15; }
.ra-matrix-status--pending { color: var(--warning-dark, #92400e); background: color-mix(in srgb, var(--warning) 18%, var(--surface)); }
.ra-matrix-status--success { color: var(--success); background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.ra-matrix-status--danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.ra-matrix-status--muted { color: var(--muted); background: var(--surface-2); }
.ra-matrix-status--review { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.ra-matrix-edit { display: block; margin-top: .3rem; padding: 0; border: 0; background: transparent; color: var(--primary); cursor: pointer; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.ra-matrix-document { color: var(--primary); font-size: .7rem; }
.ra-matrix-empty { color: var(--muted); }
.ra-matrix-dialog { width: min(720px, calc(100% - 2rem)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgb(15 23 42 / 25%); }
.ra-matrix-dialog::backdrop { background: rgb(15 23 42 / 55%); }
.ra-matrix-dialog form { padding: 1rem; }
.ra-matrix-dialog__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.ra-matrix-dialog__header small { color: var(--muted); }
.ra-matrix-dialog__header h3 { margin: .15rem 0 0; }
.ra-matrix-dialog__close { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.5rem; }
.ra-matrix-dialog__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.ra-matrix-dialog__grid label { display: flex; flex-direction: column; gap: .25rem; color: var(--muted); font-size: .76rem; font-weight: 700; }
.ra-matrix-dialog__grid input, .ra-matrix-dialog__grid select, .ra-matrix-dialog__grid textarea { width: 100%; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-weight: 400; }
.ra-matrix-dialog__wide { grid-column: 1 / -1; }
.ra-matrix-dialog__actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--border); }

@media (max-width: 760px) {
    .ra-matrix-filters__grid, .ra-matrix-dialog__grid { grid-template-columns: 1fr; }
    .ra-matrix-dialog__wide { grid-column: auto; }
    .ra-matrix-filters .filter-bar__actions .action-button { flex: 1; text-align: center; }
    .ra-matrix-wrap { max-height: 62vh; }
    .rma-filter-bar__fields { grid-template-columns: 1fr; }
    .rma-filter-bar__actions { grid-column: auto; justify-content: stretch; }
    .rma-filter-bar__actions .action-button { flex: 1; text-align: center; }
    .rma-checklist { grid-template-columns: 1fr; }
    .rma-checklist__item { align-items: flex-start; flex-direction: column; }
    .rma-work-panel__status { min-width: 0; width: 100%; }
    .rma-actions, .rma-actions form, .rma-inline-action, .rma-action-form { width: 100%; }
    .rma-actions .action-button, .rma-inline-action input { width: 100%; min-width: 0; }
}

/* ─── PROCESSOS — wizard CEPI ────────────────────────────── */
.wizard-bar {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}
.wizard-bar__step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    padding: .65rem .5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-right: 1px solid var(--border);
    font-size: .75rem;
    color: var(--muted);
    transition: background .12s, color .12s;
}
.wizard-bar__step:last-child { border-right: none; }
.wizard-bar__step:hover { background: var(--surface-hover); color: var(--ink); }
.wizard-bar__step.is-done { background: color-mix(in srgb, var(--success,#166534) 8%, var(--surface)); color: var(--success,#166534); }
.wizard-bar__step.is-active { background: var(--brand,#1d4ed8); color: #fff; }
.wizard-bar__num {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
}
.wizard-bar__label { font-size: .68rem; text-align: center; }

.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.form-label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .3rem; color: var(--ink); }
.form-input {
    width: 100%;
    padding: .45rem .65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    background: var(--surface);
    color: var(--ink);
    box-sizing: border-box;
}
.form-input:focus { outline: 2px solid var(--brand,.1d4ed8); outline-offset: 1px; }
.req { color: var(--danger, #991b1b); }

/* Validação — tabela */
.val-row--overdue { background: color-mix(in srgb, var(--danger,#991b1b) 5%, transparent); }

/* ─── PROCESSOS — show layout ─────────────────────────────── */
.split-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 860px) {
    .split-grid { grid-template-columns: 1fr; }
}

/* Cabeçalho do processo */
.proc-header {
    display: flex;
    gap: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex-wrap: wrap;
}
.proc-header__main { flex: 1; min-width: 0; }
.proc-header__code { font-size: .75rem; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; margin-bottom: .25rem; }
.proc-header__title { margin: 0 0 .3rem; font-size: 1.1rem; }
.proc-header__desc { margin: 0; color: var(--muted); font-size: .83rem; }
.proc-header__meta { display: flex; flex-direction: column; gap: .5rem; align-items: flex-end; flex-shrink: 0; }
.proc-header__fields { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.proc-header__fields span { display: flex; flex-direction: column; }

/* Abas */
.proc-tabs { min-width: 0; }

/* Caderno digital – checklist */
.proc-checklist {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: .75rem;
}
.proc-checklist__item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: .35rem .75rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    transition: background .12s;
}
.proc-checklist__item:last-child { border-bottom: none; }
.proc-checklist__item--ok { background: color-mix(in srgb, var(--success, #166534) 6%, var(--surface)); }
.proc-checklist__item--pending { background: color-mix(in srgb, var(--danger, #991b1b) 5%, var(--surface)); }

.proc-checklist__name { grid-column: 1; grid-row: 1; display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.proc-checklist__req { font-size: .68rem; color: var(--muted); font-weight: 500; }
.proc-checklist__desc { font-size: .78rem; color: var(--muted); display: block; margin-top: .15rem; }

.proc-checklist__status { grid-column: 2; grid-row: 1; align-self: center; }

.proc-checklist__file { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: .1rem; font-size: .79rem; }
.proc-checklist__download { color: var(--accent); text-decoration: none; font-weight: 500; }
.proc-checklist__download:hover { text-decoration: underline; }
.proc-checklist__reject-reason { color: var(--danger, #991b1b); font-style: italic; }

.proc-checklist__actions { grid-column: 2; grid-row: 2; display: flex; flex-direction: column; gap: .35rem; align-items: flex-end; }

/* Formulários inline (details/summary) */
.proc-inline-form > summary {
    cursor: pointer;
    font-size: .8rem;
    color: var(--accent);
    font-weight: 500;
    list-style: none;
    padding: .25rem .5rem;
    border-radius: var(--radius-sm);
}
.proc-inline-form > summary::-webkit-details-marker { display: none; }
.proc-inline-form > summary:hover { text-decoration: underline; }
.proc-inline-form__trigger--danger { color: var(--danger, #991b1b) !important; }

.proc-inline-form__body {
    margin-top: .5rem;
    padding: .6rem .7rem;
    background: var(--surface-hover, var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: .4rem;
    min-width: 220px;
    font-size: .82rem;
}

/* Tramitação – fluxo */
.proc-flow {
    margin-top: .75rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.proc-step { position: relative; padding-left: 1.25rem; }
.proc-step__dot {
    position: absolute;
    left: -1.45rem;
    top: .3rem;
    width: .75rem;
    height: .75rem;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px var(--border);
}
.proc-step--done .proc-step__dot { background: var(--success, #166534); box-shadow: 0 0 0 2px var(--success, #166534); }
.proc-step--active .proc-step__dot { background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.proc-step__body { display: flex; flex-direction: column; gap: .1rem; font-size: .83rem; }
.proc-step__body strong { font-size: .88rem; }
.proc-step__body small { color: var(--muted); }
.proc-step__comment { margin: .25rem 0 0; font-style: italic; color: var(--muted); font-size: .81rem; }

/* Pareceres */
.proc-opinion {
    padding: .9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    background: var(--surface);
}
.proc-opinion__header { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.proc-opinion__type { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.proc-opinion__meta { margin-left: auto; font-size: .77rem; color: var(--muted); }
.proc-opinion__content { margin: 0 0 .4rem; font-size: .85rem; line-height: 1.55; }
.proc-opinion__rec { margin: 0; font-size: .82rem; color: var(--muted); }

/* Histórico */
.proc-history { display: flex; flex-direction: column; gap: 0; margin-top: .75rem; }
.proc-history__item {
    display: grid;
    grid-template-columns: 110px 1fr 1fr auto;
    gap: .5rem;
    padding: .5rem .25rem;
    border-bottom: 1px solid var(--border);
    font-size: .8rem;
    align-items: center;
}
.proc-history__item:last-child { border-bottom: none; }
.proc-history__time { color: var(--muted); }
.proc-history__action { font-weight: 500; text-transform: capitalize; }
.proc-history__value { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proc-history__user { color: var(--muted); text-align: right; }

/* Sidebar – resumo */
.proc-summary { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; font-size: .82rem; margin: 0; }
.proc-summary dt { color: var(--muted); font-weight: 500; }
.proc-summary dd { margin: 0; font-weight: 500; }

/* Grade 2 colunas genérica */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 600px) { .form-grid-2 { grid-template-columns: 1fr; } }

/* ─── CEPI — Grid de aprovações prévias (Etapa 5) ─────────── */
.cepi-aprovacoes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 680px) {
    .cepi-aprovacoes-grid { grid-template-columns: 1fr; }
}

.cepi-aprovacao-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.cepi-aprovacao-card__header {
    padding: .6rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.cepi-aprovacao-card__header strong {
    font-size: .95rem;
}

.cepi-aprovacao-card__header small {
    font-size: .75rem;
    opacity: .75;
}

.cepi-aprovacao-card__header--rma {
    background: color-mix(in srgb, var(--brand) 12%, white);
    border-bottom: 2px solid var(--brand);
    color: var(--brand);
}

.cepi-aprovacao-card__header--rrm {
    background: color-mix(in srgb, #6b7280 12%, white);
    border-bottom: 2px solid #6b7280;
    color: #374151;
}

.cepi-aprovacao-card__body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.cepi-aprovacao-card__hint {
    margin: .5rem 0 0;
    font-size: .76rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    padding-top: .5rem;
}

@media (max-width: 1100px) {
    .cae-dept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cae-dept-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .cae-admin-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .cae-dept-grid,
    .cae-resource-list {
        grid-template-columns: 1fr;
    }

    .cae-dept-card {
        min-height: 0;
    }
}
/* ─── DARK MODE: correção de textos com --brand (#033d60) ilegível ────── */
[data-theme="dark"] .sidebar-brand__text strong,
[data-theme="dark"] .section-link,
[data-theme="dark"] .overview-metrics strong,
[data-theme="dark"] .module-card span,
[data-theme="dark"] .workspace-card__kicker,
[data-theme="dark"] .regional-structure-card h3,
[data-theme="dark"] .inline-details > summary,
[data-theme="dark"] .user-edit summary,
[data-theme="dark"] .page-title-icon,
[data-theme="dark"] .signature-flow > .field-label,
[data-theme="dark"] .auth-kicker,
[data-theme="dark"] .nav-link.active,
[data-theme="dark"] .dept-subnav-link.is-active,
[data-theme="dark"] .breadcrumb-link,
[data-theme="dark"] .icon-action--edit { color: #7dd3fc; }

[data-theme="dark"] .dept-subnav__item:hover { color: #7dd3fc; border-color: rgba(125,211,252,.4); }

[data-theme="dark"] .status-chamado-em_analise {
    background: rgba(125,211,252,.12);
    color: #7dd3fc;
    border-color: rgba(125,211,252,.3);
}

[data-theme="dark"] .breadcrumb-link:hover { color: #bae6fd; }
[data-theme="dark"] .a11y-panel button:hover { border-color: #7dd3fc; color: #7dd3fc; }
