:root {
    --brand: #ff6f00;
    --brand-dark: #e65a00;
    --brand-soft: rgba(255, 111, 0, 0.12);
    --bg: #f4f6fb;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --sidebar-w: 268px;
    --navbar-h: 64px;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
}

* { box-sizing: border-box; }
html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}
html, body { height: 100%; }
body.app-body,
body.legacy-page,
body:has(.app-sidebar) {
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    /* Sobrescreve style.css: body { display:flex } que limita a largura */
    display: block !important;
    overflow-x: hidden;
}

/* ═══ SIDEBAR ═══ */
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: linear-gradient(165deg, #0f172a 0%, #1e293b 42%, #111827 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    border-right: 1px solid rgba(255,255,255,.06);
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
}
.app-sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), #ffb366, var(--brand));
}

.sidebar-brand { padding: 1.1rem 1rem .85rem; }
.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: #fff;
    padding: .5rem;
    border-radius: 12px;
    transition: background .2s;
}
.sidebar-brand-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-brand-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: rgba(255,111,0,.15);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255,111,0,.25);
}
.sidebar-logo { max-height: 32px; width: auto; }
.sidebar-brand-meta { display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand-name { font-weight: 800; font-size: .92rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand-tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; font-weight: 600; }

.sidebar-search {
    position: relative;
    margin: 0 .85rem .65rem;
}
.sidebar-search i {
    position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
    color: #64748b; pointer-events: none; font-size: .85rem;
}
.sidebar-search input {
    width: 100%;
    border: 1px solid rgba(255,255,255,.1);
    background: rgba(15,23,42,.5);
    color: #f1f5f9;
    border-radius: 10px;
    padding: .5rem .75rem .5rem 2.15rem;
    font-size: .84rem;
    transition: border-color .2s, box-shadow .2s;
}
.sidebar-search input::placeholder { color: #64748b; }
.sidebar-search input:focus {
    outline: none;
    border-color: rgba(255,111,0,.45);
    box-shadow: 0 0 0 3px rgba(255,111,0,.12);
}
.sidebar-search-kbd {
    position: absolute; right: .55rem; top: 50%; transform: translateY(-50%);
    font-size: .65rem; padding: .15rem .35rem; border-radius: 4px;
    background: rgba(255,255,255,.08); color: #94a3b8; border: 1px solid rgba(255,255,255,.1);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .25rem .65rem 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar-section {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #64748b;
    padding: .85rem .55rem .35rem;
    font-weight: 700;
}
.sidebar-section::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,.06);
}

.sidebar-link-root,
.sidebar-group-toggle {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    border: 0;
    background: transparent;
    color: #cbd5e1;
    text-decoration: none;
    padding: .55rem .65rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: .88rem;
    text-align: left;
    transition: background .15s, color .15s;
    position: relative;
}
.sidebar-link-root:hover,
.sidebar-group-toggle:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-link-root.is-active,
.sidebar-group.has-active > .sidebar-group-toggle {
    background: linear-gradient(90deg, rgba(255,111,0,.22), rgba(255,111,0,.08));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--brand);
}
.sidebar-link-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,.05);
    display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.sidebar-link-root.is-active .sidebar-link-icon,
.sidebar-group.has-active .sidebar-link-icon {
    background: rgba(255,111,0,.25);
    color: #ffb366;
}
.sidebar-link-text { flex: 1; min-width: 0; }
.sidebar-active-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--brand);
    flex-shrink: 0;
}
.sidebar-chevron {
    font-size: .75rem;
    opacity: .6;
    transition: transform .25s;
}
.sidebar-group.is-open .sidebar-chevron { transform: rotate(180deg); }

.sidebar-group { margin-bottom: .15rem; }
.sidebar-group-items {
    display: none;
    padding: .2rem 0 .35rem .45rem;
    margin-left: 1rem;
    border-left: 1px solid rgba(255,255,255,.08);
}
.sidebar-group.is-open .sidebar-group-items { display: block; }
.sidebar-link-child {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #94a3b8;
    text-decoration: none;
    padding: .4rem .65rem .4rem .85rem;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 500;
    transition: all .15s;
}
.sidebar-link-child i { font-size: .7rem; opacity: .7; }
.sidebar-link-child:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.sidebar-link-child.is-active {
    background: rgba(255,111,0,.12);
    color: #ffb366;
    font-weight: 600;
}

.sidebar-footer {
    padding: .75rem 1rem 1rem;
    border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-footer-hint {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .75rem;
    color: #64748b;
    justify-content: center;
}
.sidebar-footer-hint i { color: #22c55e; }
.sidebar-link-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 .35rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-footer-logout {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: .84rem;
    font-weight: 600;
    padding: .5rem .65rem;
    border-radius: 10px;
    transition: background .15s, color .15s;
}
.sidebar-footer-logout:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(2px);
    z-index: 1035;
}
body.sidebar-open .sidebar-backdrop { display: block; }
body.sidebar-open .app-sidebar { transform: translateX(0); }

/* ═══ NAVBAR HORIZONTAL ═══ */
.app-main {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    max-width: none;
    min-height: 100vh;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    flex: none; /* não herdar flex shrink do body legado */
}
.app-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    width: 100%;
    min-height: var(--navbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.25rem;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(15,23,42,.04);
}
.navbar-left,
.navbar-right {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-shrink: 0;
}
.navbar-center { flex: 1; max-width: 420px; margin: 0 auto; }

.navbar-title-block { min-width: 0; }
.navbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .72rem;
    color: var(--muted);
    margin-bottom: .1rem;
}
.navbar-breadcrumb a {
    color: var(--muted);
    text-decoration: none;
}
.navbar-breadcrumb a:hover { color: var(--brand); }
.navbar-breadcrumb i { font-size: .55rem; opacity: .5; }
.navbar-page-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.navbar-search {
    position: relative;
    width: 100%;
}
.navbar-search i {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: .9rem;
}
.navbar-search input {
    width: 100%;
    border: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 999px;
    padding: .5rem 3rem .5rem 2.35rem;
    font-size: .86rem;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.navbar-search input:focus {
    outline: none;
    background: #fff;
    border-color: rgba(255,111,0,.4);
    box-shadow: 0 0 0 3px rgba(255,111,0,.1);
}
.navbar-search kbd {
    position: absolute;
    right: .65rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .65rem;
    padding: .12rem .4rem;
    border-radius: 4px;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--muted);
}

.btn-navbar-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    position: relative;
    transition: background .15s, border-color .15s;
}
.btn-navbar-icon:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.navbar-status {
    align-items: center;
    gap: .4rem;
    font-size: .75rem;
    font-weight: 600;
    color: #047857;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    padding: .35rem .65rem;
    border-radius: 999px;
}
.navbar-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

.navbar-notif-btn .navbar-notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.navbar-dropdown-menu {
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15,23,42,.12);
    padding: 0;
    min-width: 320px;
    overflow: hidden;
}
.navbar-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}
.navbar-notif-list { max-height: 340px; overflow-y: auto; }
.navbar-notif-item {
    display: flex;
    gap: .75rem;
    padding: .85rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f1f5f9;
    transition: background .15s;
}
.navbar-notif-item:hover { background: #f8fafc; }
.navbar-notif-item:last-child { border-bottom: 0; }
.navbar-notif-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.navbar-notif-icon-atraso { background: #fef2f2; color: #dc2626; }
.navbar-notif-icon-info { background: #eff6ff; color: #2563eb; }
.navbar-notif-body { min-width: 0; flex: 1; }
.navbar-notif-title { display: block; font-weight: 700; font-size: .86rem; }
.navbar-notif-msg { display: block; font-size: .8rem; color: var(--muted); margin-top: .15rem; line-height: 1.35; }
.navbar-notif-time { display: block; font-size: .7rem; color: #94a3b8; margin-top: .25rem; }
.navbar-notif-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}
.navbar-notif-empty i { font-size: 2rem; opacity: .35; display: block; margin-bottom: .5rem; }
.navbar-dropdown-footer {
    padding: .5rem 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
    background: #fafafa;
}

.navbar-user-btn {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .35rem .5rem .35rem .35rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    transition: background .15s, box-shadow .15s;
}
.navbar-user-btn:hover { background: #f8fafc; box-shadow: 0 2px 8px rgba(15,23,42,.06); }
.navbar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), #ff9f43);
    color: #fff;
    font-weight: 800;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.navbar-user-avatar-lg { width: 44px; height: 44px; font-size: .95rem; }
.navbar-user-info { text-align: left; line-height: 1.2; }
.navbar-user-name { display: block; font-weight: 700; font-size: .84rem; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navbar-user-role { display: block; font-size: .7rem; color: var(--muted); text-transform: capitalize; }
.navbar-user-chevron { font-size: .7rem; color: var(--muted); }
.navbar-user-menu { min-width: 260px; }
.navbar-user-menu-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
}

.app-content {
    padding: 1.25rem 1.5rem 2rem;
    flex: 1;
    width: 100%;
    max-width: none;
    min-width: 0;
}

/* Legacy compat — anula margens do style.css antigo */
body.legacy-page .content,
.app-main .content,
.app-content .content,
.legacy-content .content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    background: transparent !important;
    flex: none !important;
}

/* Legacy: esconder sidebar antigo */
body.legacy-page .sidebar,
body:has(.app-sidebar) .sidebar {
    display: none !important;
}

/* Garantir largura total — carregar depois de style.css via especificidade */
body.app-body .app-main,
body.legacy-page .app-main,
body:has(.app-sidebar) .app-main {
    width: calc(100% - var(--sidebar-w)) !important;
    max-width: none !important;
}

@media (max-width: 991.98px) {
    body.app-body .app-main,
    body.legacy-page .app-main,
    body:has(.app-sidebar) .app-main {
        width: 100% !important;
    }
}

/* Page */
.page-kicker { color: var(--brand); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin: 0 0 .25rem; }
.page-title { margin: 0; font-size: 1.65rem; font-weight: 800; }
.page-subtitle { color: var(--muted); margin: .35rem 0 0; }
.page-header { margin-bottom: 1.25rem; }

/* Cards / panels */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.stat-grid-compact { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat-card {
    background: var(--surface); border-radius: var(--radius); padding: 1rem 1.1rem;
    box-shadow: var(--shadow); display: flex; justify-content: space-between; align-items: center;
    border: 1px solid var(--border); position: relative; overflow: hidden;
}
.stat-card-link { text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.stat-card-link:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(15,23,42,.12); }
.stat-card-link.is-active { outline: 2px solid var(--brand); }
.stat-label { display: block; color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat-value { font-size: 1.65rem; font-weight: 800; line-height: 1.1; }
.stat-value--money { font-size: 1.35rem; }
.stat-value--date { font-size: 1.25rem; }
.stat-value--name { font-size: 1.05rem; line-height: 1.25; }
.stat-value-sub { font-size: .95rem; font-weight: 700; color: var(--muted); }
.stat-card-body { min-width: 0; }
.stat-icon { font-size: 1.6rem; opacity: .55; }

.turma-ocupacao-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .08);
    overflow: hidden;
}
.turma-ocupacao-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    transition: width .3s ease;
}
.stat-rose .turma-ocupacao-bar > span {
    background: linear-gradient(90deg, #f43f5e, #e11d48);
}

.turma-info-panel .panel-header h5 i.text-brand { color: var(--brand); }
.turma-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.turma-detail-item {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafbfc;
}
.turma-detail-item--highlight {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(255, 140, 0, .06), rgba(255, 140, 0, .02));
    border-color: rgba(255, 140, 0, .2);
}
.turma-detail-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.text-bg-brand-soft {
    background: rgba(255, 140, 0, .14);
    color: #c2410c;
}
.turma-detail-label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: .15rem;
}
.turma-detail-value {
    font-weight: 700;
    font-size: .95rem;
    line-height: 1.35;
    color: var(--text);
}

.stat-amber { border-left: 4px solid #f59e0b; }
.stat-violet { border-left: 4px solid #8b5cf6; }
.stat-blue { border-left: 4px solid #3b82f6; }
.stat-green { border-left: 4px solid #22c55e; }
.stat-orange { border-left: 4px solid var(--brand); }
.stat-rose { border-left: 4px solid #f43f5e; }
.stat-neutral { border-left: 4px solid #94a3b8; }

.metric-panel {
    background: var(--surface); border-radius: var(--radius); padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow); border: 1px solid var(--border);
}
.metric-panel small { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .72rem; letter-spacing: .04em; }
.metric-panel h3 { margin: .35rem 0 0; font-size: 1.25rem; font-weight: 800; }
.metric-success { border-top: 4px solid var(--success); }
.metric-danger { border-top: 4px solid var(--danger); }
.metric-warning { border-top: 4px solid var(--warning); }
.metric-alert { border-top: 4px solid #be123c; }

.panel {
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    border: 1px solid var(--border); overflow: hidden;
}
.panel-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.panel-header h5 { margin: 0; font-weight: 700; }
.panel-body { padding: 1.25rem; }
.app-panel {
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    border: 1px solid var(--border); overflow: hidden;
}
.app-panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #fafafa;
}
.app-panel-title { margin: 0; font-size: .95rem; font-weight: 700; color: #334155; }
.app-panel-title i { color: var(--brand); margin-right: .35rem; }
.app-panel-body { padding: 1rem 1.25rem; }

/* Faixa de acções rápidas (portal + páginas internas) */
.app-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem;
    margin-bottom: 1.25rem;
}
.app-action-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .25rem;
    padding: .9rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: .88rem;
    box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s;
}
.app-action-card:hover {
    color: var(--text);
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(15,23,42,.1);
}
.app-action-card i { font-size: 1.15rem; color: var(--brand); }
.app-action-card small { font-size: .72rem; color: var(--muted); font-weight: 500; }
.app-action-card em { font-size: .72rem; color: var(--danger); font-style: normal; font-weight: 600; }

/* Dicas rotativas — estilo alinhado ao sistema */
.app-tip-strip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.app-tip-strip .portal-tips-track { min-height: 2.25rem; position: relative; }
.app-tip-slide {
    display: none;
    align-items: flex-start;
    gap: .65rem;
    font-size: .88rem;
    font-weight: 500;
    color: #475569;
    line-height: 1.45;
}
.app-tip-slide.is-active { display: flex; }
.app-tip-slide i { font-size: 1.1rem; color: var(--brand); flex-shrink: 0; margin-top: .1rem; }
.app-tips-dots { display: flex; gap: .35rem; justify-content: center; margin-top: .65rem; }
.app-tips-dot {
    width: 7px; height: 7px; border-radius: 999px; border: 0; padding: 0;
    background: #cbd5e1; cursor: pointer; transition: transform .2s, background .2s;
}
.app-tips-dot.is-active { background: var(--brand); transform: scale(1.2); }

/* Listagens — pesquisa rápida */
.modern-listing-shell .listing-searchbar,
.listing-searchbar {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-wrap: wrap;
    margin-bottom: .85rem;
    padding: .65rem .85rem;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.listing-searchbar.is-filtering {
    border-color: rgba(255, 111, 0, .35);
    box-shadow: 0 0 0 3px rgba(255, 111, 0, .08);
}
.listing-searchbar--server { margin-bottom: 1rem; }
.listing-searchbar,
.listing-searchbar--server,
.listing-search-field,
.listing-search-field--suggest {
    overflow: visible;
}
.panel:has(.listing-searchbar),
.panel-body:has(.listing-searchbar),
.panel:has([data-listing-suggest]),
.panel-body:has([data-listing-suggest]),
form.panel:has([data-listing-suggest]),
.app-panel:has(.listing-searchbar),
.app-panel:has([data-listing-suggest]) {
    overflow: visible;
}
.listing-search-field {
    position: relative;
    flex: 1 1 240px;
    min-width: 180px;
}
.listing-search-field > i {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    z-index: 1;
}
.listing-search-field .form-control,
.listing-search-input {
    border-radius: 10px;
    min-height: 38px;
    padding-left: 2.15rem;
    border-color: var(--border);
    font-size: .9rem;
}
.listing-search-field .form-control:focus,
.listing-search-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(255, 111, 0, .12);
}
.listing-suggest-dropdown {
    z-index: 1060;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .12);
    max-height: min(240px, calc(100vh - 1rem));
    overflow-y: auto;
    padding: .35rem;
}
.listing-search-field--suggest .listing-suggest-dropdown:not(.is-portal) {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
}
.listing-suggest-dropdown.is-portal {
    position: fixed;
}
.listing-suggest-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: .5rem .65rem;
    border-radius: 8px;
    font-size: .88rem;
    color: var(--text);
    cursor: pointer;
}
.listing-col-num {
    width: 3rem;
    min-width: 3rem;
    max-width: 3.5rem;
    text-align: center;
    color: var(--muted);
    font-size: .82rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
table.listing-table thead .listing-col-num,
table thead .listing-col-num {
    font-weight: 600;
    color: var(--muted);
}
.listing-clear-btn,
.listing-submit-btn { min-height: 38px; border-radius: 10px; white-space: nowrap; }
.listing-results-count {
    margin-left: auto;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}
table.listing-table thead th {
    background: #f8fafc;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--muted);
}
.listing-filter-hidden,
.listing-page-hidden {
    display: none !important;
}
.listing-pagination-nav {
    margin-top: 1rem;
    padding-top: .25rem;
}
.listing-pagination-nav .page-link {
    min-width: 2.1rem;
    text-align: center;
}
.progress-row { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px dashed var(--border); }
.progress-row:last-child { border-bottom: 0; }

/* ── Dashboard fullscreen (sem scroll com poucos elementos) ── */
.app-main:has(.dash-shell) {
    height: 100vh;
    overflow: hidden;
}
.app-content:has(.dash-shell) {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1.35rem 1.25rem;
    overflow: hidden;
    min-height: 0;
}

.dash-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .9rem;
    min-height: 0;
    width: 100%;
}

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.dash-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.025em;
}
.dash-meta {
    margin: .2rem 0 0;
    font-size: .82rem;
    color: var(--muted);
    font-weight: 500;
}

/* KPIs — faixa larga, legível */
.dash-kpi-strip {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: .75rem;
    flex-shrink: 0;
}
.dash-kpi {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: .35rem;
    padding: 1rem 1.1rem;
    min-height: 96px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.dash-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    width: 100%;
}
.dash-kpi-icon {
    font-size: 1.35rem;
    opacity: .5;
}
.dash-kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.02em;
}
.dash-kpi-label {
    font-size: .78rem;
    color: var(--muted);
    font-weight: 600;
}
.dash-kpi.stat-amber { border-left: 4px solid #f59e0b; }
.dash-kpi.stat-violet { border-left: 4px solid #8b5cf6; }
.dash-kpi.stat-blue { border-left: 4px solid #3b82f6; }
.dash-kpi.stat-green { border-left: 4px solid #22c55e; }
.dash-kpi.stat-orange { border-left: 4px solid var(--brand); }
.dash-kpi.stat-rose { border-left: 4px solid #f43f5e; }
a.dash-kpi-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}
a.dash-kpi-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15,23,42,.1);
}
a.dash-kpi-link:active { transform: translateY(0); }

/* Financeiro — barra única, valores destacados */
.dash-finance-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.dash-finance-item {
    padding: .95rem 1.2rem;
    border-right: 1px solid var(--border);
    position: relative;
}
.dash-finance-item:last-child { border-right: 0; }
.dash-finance-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--fi-color, #94a3b8);
}
.dash-fi-success { --fi-color: var(--success); }
.dash-fi-danger { --fi-color: var(--danger); }
.dash-fi-warning { --fi-color: var(--warning); }
.dash-fi-alert { --fi-color: #be123c; }
.dash-fi-label {
    display: block;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
}
.dash-fi-value {
    display: block;
    font-size: 1.05rem;
    font-weight: 800;
    margin-top: .25rem;
    letter-spacing: -.01em;
}

/* Gráficos — ocupam o espaço restante da viewport */
.dash-charts {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr minmax(300px, 24%);
    gap: .9rem;
}
.dash-chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.dash-chart-main { min-height: 0; }
.dash-chart-insights {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.dash-insights-block {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.dash-insights-donut {
    flex: 1;
    min-height: 0;
    padding-bottom: .5rem;
}
.dash-insights-certs {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: #fafbfc;
    padding-bottom: .75rem;
}
.dash-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.1rem .6rem;
    flex-shrink: 0;
}
.dash-chart-head--sub {
    padding-top: .75rem;
    padding-bottom: .5rem;
}
.dash-chart-head h3 {
    margin: 0;
    font-size: .88rem;
    font-weight: 700;
    color: #334155;
}
.dash-chart-badge,
.dash-chart-pct {
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
    background: #f1f5f9;
    padding: .2rem .55rem;
    border-radius: 999px;
}
.dash-chart-pct { color: var(--success); background: #ecfdf5; }

.dash-chart-canvas {
    position: relative;
    flex: 1;
    min-height: 0;
    padding: .25rem 1rem .75rem;
}
.dash-chart-canvas--bar { padding-bottom: 1rem; }
.dash-chart-canvas--donut {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .5rem 1rem;
    min-height: 140px;
}

.dash-donut-legend {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: 0 1.1rem .25rem;
    font-size: .8rem;
    color: var(--muted);
    flex-shrink: 0;
}
.dash-donut-legend strong { color: #1e293b; font-weight: 700; }
.dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: .35rem;
    vertical-align: middle;
}
.dot-green { background: #22c55e; }
.dot-muted { background: #cbd5e1; }

.dash-cert-list {
    padding: .25rem 1.1rem 0;
    max-height: 160px;
    overflow-y: auto;
}
.dash-cert-row { margin-bottom: .65rem; }
.dash-cert-row:last-child { margin-bottom: 0; }
.dash-cert-meta {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    margin-bottom: .3rem;
    color: #475569;
}
.dash-cert-meta strong { color: #1e293b; font-weight: 700; font-size: .88rem; }
.dash-cert-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}
.dash-cert-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), #fb923c);
    border-radius: 999px;
}
.dash-cert-empty {
    margin: 0;
    font-size: .8rem;
    color: var(--muted);
    text-align: center;
    padding: .75rem 0;
}

@media (max-width: 1199.98px) {
    .app-main:has(.dash-shell) { height: auto; overflow: visible; }
    .app-content:has(.dash-shell) { overflow: visible; }
    .dash-kpi-strip { grid-template-columns: repeat(3, 1fr); }
    .dash-charts {
        grid-template-columns: 1fr;
        flex: none;
    }
    .dash-chart-canvas--bar { min-height: 260px; }
    .dash-insights-certs { border-top: 1px solid var(--border); }
}
@media (max-width: 767.98px) {
    .dash-kpi-strip { grid-template-columns: repeat(2, 1fr); }
    .dash-kpi-value { font-size: 1.45rem; }
    .dash-finance-bar { grid-template-columns: repeat(2, 1fr); }
    .dash-finance-item:nth-child(2) { border-right: 0; }
    .dash-finance-item:nth-child(1),
    .dash-finance-item:nth-child(2) { border-bottom: 1px solid var(--border); }
    .dash-fi-value { font-size: .92rem; }
}
@media (max-width: 575.98px) {
    .app-content:has(.dash-shell) { padding: .85rem; }
    .dash-kpi { min-height: 82px; padding: .85rem; }
}

.app-table thead th {
    background: #f8fafc; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); border-bottom-width: 1px;
}
.app-table td, .app-table th { padding: .85rem 1rem; vertical-align: middle; }

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
}

/* Auth */
.auth-body { min-height: 100vh; background: var(--bg); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-visual {
    display: flex;
    background: linear-gradient(135deg, #111827, #1f2937 55%, #7c2d12);
    color: #fff;
    padding: 3rem;
    align-items: center;
    position: relative;
    overflow: hidden;
}
.auth-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255, 111, 0, .18), transparent 45%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, .06), transparent 40%);
    pointer-events: none;
}
.auth-visual-content { max-width: 560px; position: relative; z-index: 1; width: 100%; }
.auth-brand-name {
    font-size: .95rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255, 140, 60, .95);
    margin: 0;
}
.auth-logo,
.auth-logo-mobile {
    display: block;
    width: auto;
    height: auto;
    max-width: min(220px, 100%);
    max-height: 72px;
    object-fit: contain;
    object-position: left center;
    flex-shrink: 0;
    align-self: flex-start;
    margin-bottom: 1.5rem;
}
.auth-logo-mobile { max-height: 56px; max-width: min(180px, 100%); }
.auth-features { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.auth-features li { margin: .65rem 0; opacity: .92; display: flex; align-items: center; gap: .5rem; }
.auth-features li i { color: var(--brand); }

/* Slideshow login portal */
.auth-visual--slideshow {
    padding: 2.5rem 3rem;
    align-items: center;
    justify-content: flex-start;
    font-size: 1.0625rem;
}
.auth-visual--slideshow .auth-visual-content {
    max-width: 560px;
    margin: 0;
    text-align: left;
    width: 100%;
}
.auth-slideshow-brand {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}
.auth-slideshow-brand .auth-logo {
    max-height: 80px;
    margin-bottom: .55rem;
    object-position: left center;
    align-self: flex-start;
}
.auth-slideshow {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.auth-slideshow-stage {
    position: relative;
    min-height: 340px;
    margin-bottom: 1.15rem;
    width: 100%;
}
.auth-slide-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .85rem;
    margin-bottom: .65rem;
    text-align: left;
}
.auth-slide-badge {
    flex-shrink: 0;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .35rem .65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: rgba(255, 255, 255, .9);
    border: 1px solid rgba(255, 255, 255, .15);
}
.auth-slide-badge.is-hot {
    background: rgba(251, 191, 36, .18);
    border-color: rgba(251, 191, 36, .35);
    color: #fde68a;
}
.auth-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .45s ease, transform .45s ease, visibility .45s;
}
.auth-slide.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    position: relative;
}
.auth-slide-kicker {
    font-size: .88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: rgba(255, 183, 120, .95);
    margin: 0 0 .65rem;
    display: flex;
    align-items: center;
    gap: .45rem;
}
.auth-slide-kicker i { font-size: 1.05rem; }
.auth-slide-title {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
    flex: 1;
    min-width: 0;
}
.auth-slide--curso .auth-slide-text {
    font-size: 1.05rem;
    line-height: 1.55;
    opacity: .92;
    margin: 0 0 .65rem;
    font-weight: 500;
}
.auth-slide-text {
    font-size: 1.05rem;
    line-height: 1.6;
    opacity: .94;
    margin: 0 0 .85rem;
}
.auth-slide-desc {
    font-size: .98rem;
    line-height: 1.6;
    opacity: .86;
    margin: 0 0 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.auth-slide-destaque {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.55;
    margin: .65rem 0 0;
    padding: .75rem .95rem;
    border-left: 3px solid var(--brand);
    background: rgba(255, 255, 255, .08);
    border-radius: 0 10px 10px 0;
}
.auth-slide-bullets { margin-top: .65rem; }
.auth-slideshow .auth-features li {
    font-size: 1.02rem;
    margin: .75rem 0;
    gap: .6rem;
}
.auth-slideshow .auth-features li i { font-size: 1.1rem; }
.auth-slide-meta {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    font-size: .9rem;
}
.auth-slide-meta li {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .12);
    opacity: .95;
}
.auth-slide-meta li i { color: rgba(255, 183, 120, .95); font-size: .95rem; }
.auth-slide-meta-hot { color: #fde68a; font-weight: 700; }
.auth-slide-tip {
    font-size: .95rem;
    line-height: 1.55;
    margin: 0 0 1rem;
    padding: .75rem .9rem;
    background: rgba(0, 0, 0, .22);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    font-style: normal;
    display: flex;
    gap: .55rem;
    align-items: flex-start;
}
.auth-slide-tip span { flex: 1; min-width: 0; }
.auth-slide-tip i { color: #fbbf24; flex-shrink: 0; margin-top: .1rem; font-size: 1.15rem; }
.auth-slide-cta {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .98rem;
    font-weight: 700;
    color: rgba(255, 183, 120, .98);
    text-decoration: none;
    margin-top: .25rem;
    transition: color .15s, transform .15s;
}
.auth-slide-cta:hover {
    color: #fff;
    transform: translateX(3px);
}
.auth-slide-cta-hint {
    font-size: .92rem;
    font-weight: 600;
    margin: 0;
    opacity: .9;
    display: flex;
    align-items: center;
    gap: .4rem;
    color: rgba(255, 183, 120, .95);
}
.auth-slideshow-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: .85rem;
    margin-top: 1rem;
    padding-top: 0;
}
.auth-slideshow-btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    font-size: 1.05rem;
}
.auth-slideshow-btn:hover {
    background: rgba(255, 111, 0, .25);
    border-color: rgba(255, 111, 0, .45);
}
.auth-slideshow-dots { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.auth-slideshow-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    border: 0;
    padding: 0;
    background: rgba(255, 255, 255, .35);
    cursor: pointer;
    transition: transform .2s, background .2s;
}
.auth-slideshow-dot.is-active {
    background: var(--brand);
    transform: scale(1.25);
}

.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card {
    width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px;
    padding: 2rem; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.auth-title { font-weight: 800; }
.auth-card--wide { max-width: 560px; }
.auth-card--welcome { max-width: 480px; }
.auth-shell--form .auth-form-wrap { align-items: flex-start; padding-top: 2.5rem; padding-bottom: 2.5rem; }

.portal-welcome-options { display: flex; flex-direction: column; gap: .75rem; }
.portal-welcome-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    background: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.portal-welcome-option:hover {
    border-color: rgba(var(--brand-rgb, 255, 140, 0), .35);
    box-shadow: var(--shadow-sm, 0 4px 12px rgba(15, 23, 42, .06));
    transform: translateY(-1px);
    color: inherit;
}
.portal-welcome-option__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.portal-welcome-option__body { flex: 1; min-width: 0; }
.portal-success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: .75rem;
}

/* Portal do formando — layout lateral (reutiliza app-sidebar / app-main) */
.portal-body { background: var(--bg); }
.portal-app-main { min-height: 100vh; }
.portal-app-content { flex: 1; min-width: 0; }
.portal-app-main .portal-chat {
    min-height: calc(100vh - var(--navbar-h) - 11rem);
    max-height: calc(100vh - var(--navbar-h) - 8rem);
}
.portal-app-main .portal-chat-messages { max-height: none; }
.portal-notif-btn { position: relative; }
.portal-notif-menu {
    min-width: 300px;
    max-width: 360px;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 16px 40px rgba(15,23,42,.12);
}

/* Cartões do portal = painéis do sistema */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
.portal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
}
.portal-card--wide { grid-column: 1 / -1; }
.portal-card--alert { border-top: 3px solid var(--brand); }
.portal-card h3 {
    font-size: .95rem;
    font-weight: 700;
    margin: 0 0 .75rem;
    color: #334155;
}
.portal-card h3 i { color: var(--brand); margin-right: .35rem; }
.portal-stat { font-size: 1.35rem; font-weight: 800; margin: 0 0 .25rem; }
.portal-freq-row {
    display: flex;
    justify-content: space-between;
    font-size: .85rem;
    padding: .35rem 0;
    border-bottom: 1px dashed var(--border);
}
.portal-freq-row:last-child { border-bottom: 0; }

.portal-chat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 420px;
}
.portal-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    max-height: 55vh;
    background: #f8fafc;
}
.portal-chat-compose {
    display: flex;
    gap: .75rem;
    padding: 1rem;
    align-items: flex-end;
    background: #fff;
    border-top: 1px solid var(--border);
}
.portal-chat-compose textarea { flex: 1; resize: none; }
.portal-chat-bubble {
    max-width: 85%;
    margin-bottom: .75rem;
    padding: .65rem .85rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border);
}
.portal-chat-bubble.is-me {
    margin-left: auto;
    background: var(--brand-soft);
    border-color: rgba(255, 111, 0, .25);
}
.portal-chat-meta {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    font-size: .72rem;
    color: var(--muted);
    margin-bottom: .25rem;
}
.portal-chat-text { font-size: .9rem; white-space: pre-wrap; word-break: break-word; }

/* Catálogo / sugestões — mesmo vocabulário visual */
.portal-discover { margin: 1.25rem 0; }
.portal-discover-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.portal-discover-kicker {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--brand);
    margin: 0 0 .2rem;
}
.portal-discover-title { font-size: 1.25rem; font-weight: 800; margin: 0 0 .25rem; }
.portal-discover-sub { font-size: .88rem; color: var(--muted); margin: 0; }
.portal-carousel-nav { display: flex; gap: .35rem; }
.portal-carousel-btn {
    width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, border-color .15s;
}
.portal-carousel-btn:hover { background: var(--brand-soft); border-color: rgba(255,111,0,.25); }

.portal-courses-track-wrap { margin: 0 -.25rem; padding: 0 .25rem .5rem; }
.portal-courses-track {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: .25rem .25rem .75rem;
    -webkit-overflow-scrolling: touch;
}
.portal-course-card {
    flex: 0 0 min(280px, 85vw);
    scroll-snap-align: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: transform .15s, box-shadow .15s;
}
.portal-course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(15,23,42,.1);
}
.portal-course-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .65rem; }
.portal-course-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--brand-soft); color: var(--brand);
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.portal-course-badge {
    font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    padding: .2rem .45rem; border-radius: 999px; background: #f1f5f9; color: #64748b;
}
.portal-course-badge.is-hot { background: #fef3c7; color: #b45309; }
.portal-course-title { font-size: 1rem; font-weight: 800; margin: 0 0 .3rem; line-height: 1.3; }
.portal-course-tagline { font-size: .8rem; font-weight: 600; color: var(--brand); margin: 0 0 .45rem; line-height: 1.35; }
.portal-course-desc { font-size: .8rem; color: var(--muted); margin: 0 0 .65rem; flex: 1; line-height: 1.45; }
.portal-course-meta {
    list-style: none; padding: 0; margin: 0 0 .65rem;
    display: flex; flex-wrap: wrap; gap: .45rem .65rem;
    font-size: .75rem; color: var(--muted);
}
.portal-course-meta li { display: flex; align-items: center; gap: .25rem; }
.portal-course-tip {
    font-size: .78rem; color: #475569; background: #f8fafc;
    border-left: 3px solid var(--brand); margin: 0 0 .85rem; padding: .45rem .6rem;
    border-radius: 0 8px 8px 0; font-style: normal;
}
.portal-course-cta {
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    width: 100%; padding: .5rem .9rem; border-radius: 10px; font-weight: 700; font-size: .84rem;
    background: var(--brand); color: #fff; text-decoration: none; border: 0; cursor: pointer;
    transition: background .15s;
}
.portal-course-cta:hover { background: var(--brand-dark); color: #fff; }
.portal-inscricao-modal .modal-header { align-items: flex-start; }
.portal-inscricao-modal .modal-body { padding-top: 0; }

.portal-turma-picker {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.portal-turma-card {
    display: block;
    width: 100%;
    text-align: left;
    border: 2px solid var(--border, #e5e7eb);
    border-radius: .75rem;
    padding: .85rem 1rem;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.portal-turma-card:hover {
    border-color: var(--brand, #f97316);
    box-shadow: 0 4px 14px rgba(249, 115, 22, .12);
}
.portal-turma-card.is-selected {
    border-color: var(--brand, #f97316);
    background: #fff7ed;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .15);
}
.portal-turma-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
    margin-bottom: .5rem;
}
.portal-turma-card-meta {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: .8rem;
    color: var(--muted, #6b7280);
    display: grid;
    gap: .25rem;
}
.portal-turma-card-meta li {
    display: flex;
    align-items: center;
    gap: .35rem;
}
.portal-empty-catalog {
    text-align: center; padding: 2rem 1rem; background: var(--surface);
    border: 1px dashed var(--border); border-radius: var(--radius);
}
.portal-empty-catalog i { font-size: 1.75rem; color: var(--brand); display: block; margin-bottom: .65rem; }

/* Alerta de sugestões (fora do fluxo principal) */
.portal-promo-alert {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .9rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid #fcd34d;
    background: linear-gradient(90deg, #fffbeb 0%, #fff 100%);
    box-shadow: 0 2px 10px rgba(245, 158, 11, .12);
}
.portal-promo-alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fef3c7;
    color: #b45309;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.portal-promo-alert-text { flex: 1; min-width: 200px; }
.portal-promo-alert-text strong { display: block; font-size: .92rem; color: #92400e; margin-bottom: .2rem; }
.portal-promo-alert-text p { font-size: .82rem; color: #78716c; line-height: 1.45; }
.portal-promo-alert-btn {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
    font-weight: 700;
    white-space: nowrap;
    align-self: center;
}
.portal-promo-alert-btn:hover {
    background: #d97706;
    border-color: #d97706;
    color: #fff;
}
.portal-sugestoes-modal .modal-body { padding: 1rem 1.25rem 1.25rem; }
.portal-sugestoes-modal .portal-discover { margin: 0; }

.portal-freq-row--ring { align-items: center; padding: .5rem 0; }
.portal-freq-ring { position: relative; width: 38px; height: 38px; flex-shrink: 0; }
.portal-ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.portal-ring-bg { fill: none; stroke: #e2e8f0; stroke-width: 3; }
.portal-ring-fill { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray 1s ease; }
.portal-ring-label {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: .62rem; font-weight: 800; color: #334155;
}

/* Legado: hero antigo → usar page-header nas views */
.portal-hero { margin-bottom: 1.25rem; }
.portal-hero h1 { font-size: 1.65rem; font-weight: 800; margin: 0 0 .25rem; }
.portal-hero p { color: var(--muted); margin: 0; }
.chat-staff-layout .chat-staff-messages { min-height: 360px; max-height: 50vh; }
.chat-conversa-list { max-height: 60vh; overflow-y: auto; }
.navbar-notif-icon-inscricao { background: rgba(59, 130, 246, .12); color: #2563eb; }
.navbar-notif-icon-chat { background: rgba(34, 197, 94, .12); color: #16a34a; }
.navbar-notif-icon-certificado { background: rgba(139, 92, 246, .12); color: #7c3aed; }

@media (max-width: 767.98px) {
    .portal-grid { grid-template-columns: 1fr; }
    .portal-card--wide { grid-column: auto; }
}

/* Responsive */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    .app-main {
        margin-left: 0;
        width: 100%;
    }
    .auth-shell { grid-template-columns: 1fr; }
    .navbar-page-title { max-width: 180px; font-size: .95rem; }
    .navbar-breadcrumb { display: none; }
}
@media (max-width: 575.98px) {
    .app-content { padding: 1rem; }
    .app-navbar { padding: 0 .75rem; }
    .stat-value { font-size: 1.35rem; }
    .navbar-dropdown-menu { min-width: 280px; }
}

/* ═══ DROPDOWN DE ACÇÕES ═══ */
.actions-dropdown .btn-actions {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--muted);
    background: #fff;
}
.actions-dropdown .btn-actions:hover,
.actions-dropdown.show .btn-actions {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-soft);
}
.actions-dropdown .dropdown-menu {
    min-width: 11rem;
    padding: .35rem;
    border: 1px solid var(--border);
    border-radius: 12px;
}
.actions-dropdown .dropdown-item {
    border-radius: 8px;
    font-size: .875rem;
    padding: .45rem .65rem;
    display: flex;
    align-items: center;
}
.actions-dropdown .dropdown-item:hover {
    background: var(--brand-soft);
    color: var(--text);
}
.actions-dropdown .dropdown-form {
    margin: 0;
}
.actions-dropdown .dropdown-form button {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
}

/* ═══ FORMULÁRIOS INTERACTIVOS ═══ */
form.app-form .form-label {
    font-weight: 600;
    font-size: .8125rem;
    color: #334155;
    margin-bottom: .35rem;
}
form.app-form .form-control:focus,
form.app-form .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}
form.app-form .form-control.is-valid,
form.app-form .form-select.is-valid {
    border-color: var(--success);
}
form.app-form .form-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
}
form.app-form .form-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: .9rem;
}
form.app-form .form-section-body {
    padding: 1rem;
}
form.app-form .form-hint {
    font-size: .75rem;
    color: var(--muted);
    margin-top: .25rem;
}

/* ═══ FORM CARD (layout profissional) ═══ */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.form-card .app-form {
    display: flex;
    flex-direction: column;
}
.form-card-body {
    padding: 1.5rem 1.75rem;
}
.form-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    padding: 1rem 1.75rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}
.form-card-footer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-left: auto;
}
.form-section {
    margin-bottom: 1.5rem;
}
.form-section:last-child {
    margin-bottom: 0;
}
.form-section-head {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}
.form-section-head > i {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.form-section-head h6 {
    margin: 0;
    font-weight: 700;
    font-size: .95rem;
    color: var(--text);
}
.form-section-head p {
    margin: .15rem 0 0;
    font-size: .8rem;
    color: var(--muted);
}
.form-req {
    color: var(--danger);
    font-weight: 700;
    margin-left: 2px;
}
.input-icon-group {
    position: relative;
}
.input-icon-group > i {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
    z-index: 2;
}
.input-icon-group .form-control,
.input-icon-group .form-select {
    padding-left: 2.5rem;
}
.input-icon-group .form-select {
    background-position: right .75rem center;
}
form.app-form .form-label {
    display: flex;
    align-items: center;
    gap: .15rem;
}
form.app-form .form-control,
form.app-form .form-select {
    min-height: 42px;
    border-radius: 10px;
    border-color: var(--border);
    font-size: .9rem;
}
form.app-form textarea.form-control {
    min-height: auto;
}
@media (max-width: 575.98px) {
    .form-card-body { padding: 1rem; }
    .form-card-footer {
        padding: .85rem 1rem;
        flex-direction: column;
        align-items: stretch;
    }
    .form-card-footer-actions {
        margin-left: 0;
        width: 100%;
    }
    .form-card-footer-actions .btn {
        flex: 1;
    }
}

/* SweetAlert2 — alinhado ao tema da aplicação */
.app-swal-popup {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif !important;
    border-radius: 16px !important;
    padding: 1.5rem 1.25rem 1.25rem !important;
}
.app-swal-title {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    color: var(--text) !important;
}
.app-swal-text {
    font-size: .92rem !important;
    color: var(--muted) !important;
}
.app-swal-actions {
    gap: .5rem !important;
    margin-top: 1.25rem !important;
}
.swal2-container {
    z-index: 2000 !important;
}
div:where(.swal2-container) .swal2-popup.app-swal-popup {
    box-shadow: 0 20px 50px rgba(15, 23, 42, .18) !important;
}
div:where(.swal2-container) button.swal2-styled:focus {
    box-shadow: 0 0 0 3px rgba(255, 111, 0, .25) !important;
}
