:root {
    --bg: #0f1420;
    --bg-elev: #171d2b;
    --bg-elev-2: #1f2637;
    --border: #2a3244;
    --text: #e7ebf3;
    --text-muted: #8b95ab;
    --primary: #4f7cff;
    --primary-hover: #3d68f0;
    --danger: #ef4d5a;
    --success: #2fb37a;
    --radius: 10px;
    --sidebar-w: 250px;
    --sidebar-w-collapsed: 68px;
    --topbar-h: 60px;
    --transition: 0.2s ease;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
    --bg: #f4f6fb;
    --bg-elev: #ffffff;
    --bg-elev-2: #eef1f7;
    --border: #d9dee9;
    --text: #1a2233;
    --text-muted: #64708a;
    --primary: #3d68f0;
    --primary-hover: #2f55d4;
    --danger: #e0384a;
    --success: #1f9d6b;
    --shadow: 0 8px 24px rgba(31, 41, 66, 0.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Roboto, -apple-system, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
.muted { color: var(--text-muted); }

/* ---------- Login ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(79, 124, 255, 0.18), transparent),
        var(--bg);
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 34px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo {
    width: 56px; height: 56px;
    margin: 0 auto 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #7a5cff);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 22px; color: #fff;
}
.login-logo-img { background: none; overflow: hidden; }
.login-logo-img img { width: 100%; height: 100%; object-fit: contain; }
.login-brand h1 { font-size: 20px; margin: 0 0 4px; }
.login-brand p { color: var(--text-muted); margin: 0; font-size: 14px; }

/* ---------- Fields ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.field input, .field textarea, .field select, .search-form input, .search-form select {
    width: 100%;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 11px 13px;
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.field input[type="checkbox"],
.field input[type="radio"] {
    width: auto;
    min-width: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
/* Textos text/textarea sempre em maiusculas (valor real via JS em app.js) */
.field input[type="text"],
.field textarea,
form input[type="text"],
form textarea {
    text-transform: uppercase;
}
.field select { appearance: none; -webkit-appearance: none; cursor: pointer; }
.field input:focus, .field textarea:focus, .field select:focus, .search-form input:focus, .search-form select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.2);
}
.field-error { display: block; color: var(--danger); font-size: 12px; margin-top: 5px; }

/* Campo obrigatorio invalido (vazio ao salvar ou erro do servidor) */
.field.has-error > span { color: var(--danger); }
.field.has-error input,
.field.has-error textarea,
.field.has-error select,
.input-error {
    border-color: var(--danger) !important;
    background: rgba(239, 77, 90, 0.06);
}
.field.has-error input:focus,
.field.has-error textarea:focus,
.field.has-error select:focus {
    box-shadow: 0 0 0 3px rgba(239, 77, 90, 0.2);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.btn:hover { background: #262f43; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: transparent; border-color: rgba(239, 77, 90, 0.4); color: var(--danger); }
.btn-danger:hover { background: rgba(239, 77, 90, 0.12); }
.btn-accent {
    background: rgba(122, 92, 255, 0.14);
    border-color: rgba(122, 92, 255, 0.45);
    color: #c4b5fd;
}
.btn-accent:hover {
    background: rgba(122, 92, 255, 0.24);
    border-color: #7a5cff;
    color: #e0d7ff;
}
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 13px; }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius); padding: 11px 14px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: rgba(239, 77, 90, 0.12); border: 1px solid rgba(239, 77, 90, 0.4); color: #ff9aa2; }
.alert-success { background: rgba(47, 179, 122, 0.12); border: 1px solid rgba(47, 179, 122, 0.4); color: #7ee0b4; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 30;
    transition: width var(--transition), transform var(--transition);
    overflow: hidden;
}
.sidebar-head {
    display: flex; align-items: center; gap: 10px;
    height: var(--topbar-h);
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo {
    width: 36px; height: 36px; flex: 0 0 36px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--primary), #7a5cff);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; font-size: 15px;
}
.sidebar-logo-img { background: none; overflow: hidden; }
.sidebar-logo-img img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-title { font-weight: 600; white-space: nowrap; flex: 1; }
.sidebar-toggle {
    background: transparent; border: none; color: var(--text-muted);
    cursor: pointer; padding: 6px; border-radius: 6px;
}
.sidebar-toggle:hover { background: var(--bg-elev-2); color: var(--text); }
.icon-chevron {
    display: inline-block; width: 9px; height: 9px;
    border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); transition: transform var(--transition);
}

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-foot { padding: 12px 10px; border-top: 1px solid var(--border); }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    white-space: nowrap;
    width: 100%;
    background: transparent; border: none; cursor: pointer;
    font-size: 14px; font-family: inherit;
    transition: background var(--transition), color var(--transition);
}
.nav-item:hover { background: var(--bg-elev-2); color: var(--text); }
.nav-item.is-active { background: rgba(79, 124, 255, 0.15); color: #cdd9ff; }
.nav-icon { flex: 0 0 22px; text-align: center; font-size: 16px; }
.nav-logout { color: var(--text-muted); }
.nav-logout:hover { color: var(--danger); }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-toggle { position: relative; }
.nav-caret {
    margin-left: auto;
    width: 8px; height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform var(--transition);
    opacity: 0.7;
}
.nav-group.is-open > .nav-group-toggle .nav-caret { transform: rotate(-135deg); }
.nav-submenu {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 4px 12px;
}
.nav-group.is-open > .nav-submenu { display: flex; }
.nav-subitem {
    padding-left: 34px;
    font-size: 13px;
}
.sidebar-collapsed .nav-caret,
.sidebar-collapsed .nav-submenu { display: none; }
.sidebar-collapsed .nav-group.is-open > .nav-submenu { display: none; }

/* Estado recolhido: apenas icones */
.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.sidebar-collapsed .sidebar-title,
.sidebar-collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }
.sidebar-collapsed .sidebar-toggle .icon-chevron { transform: rotate(-135deg); }
.sidebar-collapsed .sidebar-head { justify-content: center; padding: 0; }
.sidebar-collapsed .nav-item { justify-content: center; }

/* ---------- Main ---------- */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    transition: margin-left var(--transition);
    min-width: 0;
}
.sidebar-collapsed .main { margin-left: var(--sidebar-w-collapsed); }

.topbar {
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 22px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 17px; margin: 0; flex: 1; }
.topbar-toggle { display: none; background: transparent; border: none; color: var(--text); font-size: 22px; cursor: pointer; }

.session-expiry {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px 12px; border-radius: 999px;
    background: var(--bg-elev-2); border: 1px solid var(--border);
    font-size: 13px; color: var(--text-muted); flex-shrink: 0;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.session-expiry-time {
    font-variant-numeric: tabular-nums; color: var(--text);
    min-width: 4.5ch; font-weight: 600;
}
.session-expiry.is-warning {
    border-color: #d97706; color: #d97706; background: rgba(217, 119, 6, 0.08);
}
.session-expiry.is-warning .session-expiry-time { color: #d97706; }
.session-expiry.is-danger {
    border-color: var(--danger); color: var(--danger); background: rgba(220, 38, 38, 0.08);
}
.session-expiry.is-danger .session-expiry-time { color: var(--danger); }

/* ---------- Alternador de tema ---------- */
.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    background: transparent; border: 1px solid var(--border);
    border-radius: 50%; color: var(--text); cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-elev-2); color: var(--primary); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
.theme-toggle-fixed { position: fixed; top: 18px; right: 18px; z-index: 30; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-name { color: var(--text-muted); font-size: 14px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; text-transform: uppercase; flex-shrink: 0;
}

/* ---------- Menu do usuario (topbar) ---------- */
.user-menu { position: relative; }
.user-menu-trigger {
    display: flex; align-items: center; gap: 10px;
    background: transparent; border: 1px solid transparent;
    color: var(--text); cursor: pointer;
    padding: 6px 10px; border-radius: var(--radius);
    font-family: inherit; font-size: 14px;
    transition: background var(--transition), border-color var(--transition);
}
.user-menu-trigger:hover,
.user-menu.is-open .user-menu-trigger {
    background: var(--bg-elev-2);
    border-color: var(--border);
}
.user-chevron {
    width: 8px; height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform var(--transition);
}
.user-menu.is-open .user-chevron { transform: rotate(-135deg) translateY(2px); }
.user-menu-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px);
    min-width: 220px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    padding: 6px;
    z-index: 40;
}
.user-menu-item {
    display: block; width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    text-align: left;
    background: transparent; border: none;
    cursor: pointer; font-family: inherit;
    transition: background var(--transition);
}
a.user-menu-item { text-decoration: none; }
.user-menu-item:hover { background: var(--bg-elev-2); }
.user-menu-item-danger { color: var(--danger); }
.user-menu-logout { margin: 0; }

.content { padding: 24px; }

/* ---------- Cards / stats ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 18px; }
.card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 18px;
}
.card h2 { margin: 0 0 8px; font-size: 17px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--text-muted); font-size: 13px; }
.stat-value { font-size: 30px; font-weight: 700; }
.stat-value-sm { font-size: 22px; line-height: 1.3; }
.stat-link { color: var(--primary); font-size: 13px; }

/* ---------- Toolbar / tabela ---------- */
.toolbar { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search-form { display: flex; gap: 8px; flex: 1; max-width: 1000px; min-width: 0; }
.search-form input { flex: 2; min-width: 220px; }
.search-form .filter-select { flex: 1; min-width: 180px; max-width: 260px; }

.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--bg-elev-2); }
.table tbody tr:hover, .table tbody tr:hover { background: var(--bg-elev-2); }
.table .empty { text-align: center; color: var(--text-muted); padding: 30px; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.col-check { width: 1%; white-space: nowrap; text-align: center; }
.col-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.col-logo { width: 56px; }
.table-logo {
    width: 40px; height: 40px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    display: block;
}
.table-logo-empty {
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 14px;
}
.inline-form { display: inline; }

/* ---------- Celulas com truncamento ---------- */
.table td.cell-truncate {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pagination { display: flex; gap: 6px; flex-wrap: wrap; }
.page { padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-muted); }
.page.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}
.badge-on {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.35);
}
.badge-off {
    background: rgba(139, 149, 171, 0.12);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ---------- Form grid ---------- */
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.form-grid .field { margin-bottom: 0; }
.form-section {
    grid-column: 1 / -1;
    font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); border-bottom: 1px solid var(--border);
    padding-bottom: 6px; margin-top: 6px;
}
.form-section-with-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    text-transform: none;
    letter-spacing: normal;
}
.form-section-with-action .form-section-label {
    flex: 0 1 auto;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.form-section-with-action .btn {
    flex-shrink: 0;
    margin-left: auto;
}
.span-2 { grid-column: span 2; }
.span-4 { grid-column: 1 / -1; }
.form-row-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}
.form-row-5 .field { margin-bottom: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.form-actions-split { justify-content: space-between; }
.report-filter-actions { justify-content: flex-start; margin-top: 8px; }
.report-dep-toolbar {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    margin: 8px 0 10px;
}
.report-dep-list {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elev-2);
    padding: 8px 10px;
    max-height: 320px;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px 12px;
    align-content: start;
}
.report-dep-hint { margin: 0; grid-column: 1 / -1; }
.report-check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.25;
    cursor: pointer;
    transition: background 0.12s ease;
}
.report-check-item:hover { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.report-check-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    max-width: 18px;
    margin: 0;
    padding: 0 !important;
    flex-shrink: 0;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    cursor: pointer;
    position: relative;
    box-shadow: none;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.report-check-item input[type="checkbox"]:hover {
    border-color: var(--primary);
}
.report-check-item input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}
.report-check-item input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.report-check-item input[type="checkbox"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.report-check-item span {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.report-print-mode {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 24px;
    margin-top: 6px;
}
.report-print-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text);
    user-select: none;
}
.report-print-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
}
.report-print-radio {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--bg);
    position: relative;
    box-sizing: border-box;
}
.report-print-option input[type="radio"]:checked + .report-print-radio {
    border-color: var(--primary);
}
.report-print-option input[type="radio"]:checked + .report-print-radio::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    transform: translate(-50%, -50%);
}
.report-print-option:hover .report-print-radio {
    border-color: var(--primary);
}
@media (max-width: 980px) {
    .report-dep-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .report-dep-list { grid-template-columns: 1fr; }
}
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.report-preview { display: flex; flex-direction: column; gap: 16px; }
.report-preview-card .report-orgao-head {
    display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
    border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 12px;
}
.report-preview-card .report-orgao-head-text { min-width: 0; flex: 1 1 auto; }
.report-preview-card .report-orgao-head h2 { margin: 0 0 4px; font-size: 18px; }
.report-preview-card .report-meta { margin: 0; color: var(--text-muted); font-size: 13px; }
.report-preview-card .report-logo {
    flex: 0 0 auto;
    margin-left: auto;
    text-align: right;
}
.report-preview-card .report-logo img {
    display: block;
    max-width: 110px;
    max-height: 80px;
    object-fit: contain;
}
.report-preview-card h3 {
    margin: 16px 0 8px; font-size: 13px; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-muted);
}
.report-preview .report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.report-preview .report-field {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    background: var(--bg-elev-2);
}
.report-preview .report-field-full { grid-column: 1 / -1; }
.report-preview .report-field span {
    display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 2px;
}
.report-preview .report-field strong { display: block; font-weight: 600; word-break: break-word; }
.report-table { width: 100%; border-collapse: collapse; margin-bottom: 4px; }
.report-table th, .report-table td {
    border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top;
}
.report-table th { width: 28%; background: var(--bg-elev-2); color: var(--text-muted); font-weight: 600; }
.report-alunos-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 8px;
    font-size: 13px;
}
.report-alunos-table th,
.report-alunos-table td {
    border: 1px solid var(--border);
    padding: 7px 8px;
    text-align: left;
    vertical-align: top;
}
.report-alunos-table th {
    background: var(--bg-elev-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.report-alunos-table td:first-child,
.report-alunos-table th:first-child {
    width: 36px;
    text-align: center;
}
.report-empty {
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ---------- Sub-abas de navegacao (licitacoes) ---------- */
.subtabs {
    display: flex; gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.subtabs .subtab {
    color: var(--text-muted);
    padding: 14px 18px;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition), border-color var(--transition);
}
.subtabs .subtab:hover { color: var(--text); }
.subtabs .subtab.is-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.qtd-form { display: inline-flex; align-items: center; gap: 6px; }
.qtd-input { width: 84px; }
.meia-check-label { display: inline-flex; align-items: center; margin: 0; }
.field-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 10px;
    cursor: pointer;
}

/* ---------- Linhas de produtos (licitacao) ---------- */
.produto-row {
    align-items: end;
    margin-bottom: 12px;
    grid-template-columns: 2fr 1fr auto;
}
.produto-row .produto-remove {
    margin-bottom: 2px;
    width: 42px; height: 42px;
    padding: 0;
    font-size: 20px; line-height: 1;
}
.form-hint { margin: -8px 0 0; font-size: 13px; }

/* ---------- Linhas de pessoas (salas) ---------- */
.text-muted { color: var(--text-muted); }
.capacity-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.pessoa-row {
    align-items: end;
    margin-bottom: 12px;
    grid-template-columns: repeat(4, 1fr) auto;
}
.pessoa-row .pessoa-remove { margin-bottom: 2px; }
.pessoa-row-licitacao {
    grid-template-columns: minmax(160px, 1.4fr) minmax(110px, 0.8fr) repeat(auto-fit, minmax(120px, 1fr)) auto;
}
.tamanho-row {
    align-items: end;
    margin-bottom: 12px;
    grid-template-columns: 2fr auto;
    max-width: 420px;
}
.tamanho-row .tamanho-remove {
    margin-bottom: 2px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}
.btn.is-disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Logo empresa ---------- */
.logo-field { display: flex; flex-direction: column; gap: 14px; }
.logo-field-row {
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
}
.logo-field-row .logo-upload { flex: 1; margin-bottom: 0; min-width: 0; }
.logo-field-row .logo-preview { flex-shrink: 0; }
.logo-preview {
    width: 160px; height: 160px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-elev-2);
    overflow: hidden;
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview-sm {
    width: 64px;
    height: 64px;
    border-radius: 8px;
}
.logo-preview-sm.logo-preview-empty {
    font-size: 11px;
    text-align: center;
    padding: 4px;
}
.logo-preview-empty { color: var(--text-muted); font-size: 13px; }
.logo-remove {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}
.logo-remove input { width: auto; margin: 0; }

/* ---------- Abas (tabs) ---------- */
.tabs { margin-bottom: 0; }
.tabs-nav {
    display: flex; gap: 4px;
    border-bottom: 1px solid var(--border);
    margin: -20px -20px 20px;
    padding: 0 16px;
}
.tab-btn {
    background: transparent; border: none;
    color: var(--text-muted);
    padding: 14px 18px;
    font-size: 14px; font-family: inherit;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.is-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.form-actions-tabs {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ---------- Toggle ativo/inativo ---------- */
.form-status-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 18px 0 4px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
}
.form-status-control {
    display: flex;
    align-items: center;
    gap: 12px;
}
.toggle-status-text {
    font-size: 14px;
    font-weight: 600;
    text-align: left;
}
.toggle-status-text.is-on { color: #4ade80; }
.toggle-status-text.is-off { color: var(--text-muted); }

.toggle-switch {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    flex-shrink: 0;
}
.toggle-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-track {
    width: 54px;
    height: 30px;
    border-radius: 999px;
    background: #3d4559;
    position: relative;
    transition: background var(--transition);
    display: block;
}
.toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    transition: transform var(--transition);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    z-index: 2;
}
.toggle-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    z-index: 1;
    pointer-events: none;
}
.toggle-icon-on {
    left: 9px;
    color: rgba(255, 255, 255, 0);
    transition: color var(--transition);
}
.toggle-icon-off {
    right: 9px;
    color: #6b7a94;
    transition: color var(--transition);
}
.toggle-switch input:checked + .toggle-track {
    background: #22c55e;
}
.toggle-switch input:checked + .toggle-track .toggle-knob {
    transform: translateX(24px);
}
.toggle-switch input:checked + .toggle-track .toggle-icon-on {
    color: rgba(255, 255, 255, 0.95);
}
.toggle-switch input:not(:checked) + .toggle-track .toggle-icon-off {
    color: #9aa8bc;
}

/* ---------- Responsivo ---------- */
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
    .sidebar-open .sidebar { transform: translateX(0); }
    .main { margin-left: 0; }
    .sidebar-collapsed .main { margin-left: 0; }
    .topbar-toggle { display: block; }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .span-2, .span-4 { grid-column: 1 / -1; }
    .form-row-5 { grid-template-columns: 1fr 1fr; }
    .user-name { display: none; }
    .user-menu-dropdown { right: -8px; min-width: 200px; }
}
@media (max-width: 520px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-row-5 { grid-template-columns: 1fr; }
}
