/* Bootstrap 5.3 + tema Difermática (v2) */
:root {
    --bs-primary: #e30613;
    --bs-primary-rgb: 227, 6, 19;
    --bs-primary-dark: #b8000f;
    --difermatica-sidebar-bg: #1a1d21;
    --difermatica-sidebar-bg-2: #23272d;
    --difermatica-sidebar-width: 264px;
    --difermatica-bg: #f5f6f8;
}

body { background: var(--difermatica-bg); }

/* ===== Login ===== */
.body-login {
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(227,6,19,.18), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(227,6,19,.12), transparent 50%),
        linear-gradient(135deg, #0a0a0a 0%, #15171b 60%, #0d0d0d 100%);
    display: flex; align-items: center; justify-content: center; padding: 1.25rem;
}
.login-card {
    width: 100%;
    max-width: 400px;
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 28px 70px -18px rgba(0,0,0,.55);
    border: 1px solid rgba(255,255,255,.08);
}
.login-brand {
    padding: 2rem 2rem 0;
    text-align: center;
}
.login-brand img {
    display: block;
    width: min(250px, 100%);
    height: auto;
    margin: 0 auto;
}
.login-product {
    margin: 0.55rem 0 0;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #6c757d;
}
.login-card .card-body { padding: 1.15rem 2rem 1.85rem; }
.login-card .form-label { font-weight: 600; font-size: .85rem; color: #343a40; margin-bottom: .35rem; }
.login-card .form-control {
    border-radius: 10px;
    padding: .65rem .8rem;
}
.login-card .form-control:focus { border-color: var(--bs-primary); box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.18); }
.login-card .btn-primary {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    padding: 0.7rem;
    font-weight: 600;
    letter-spacing: .01em;
    border-radius: 10px;
}
.login-card .btn-primary:hover { background: var(--bs-primary-dark); border-color: var(--bs-primary-dark); }
.login-card .alert { border-radius: 10px; }
.login-card .login-links { font-size: .85rem; margin-top: 1.1rem; }
.login-card .login-links a { color: var(--bs-primary-dark); text-decoration: none; font-weight: 600; }
.login-card .login-links a:hover { text-decoration: underline; }

/* ===== Layout área restrita ===== */
.app-wrapper { display: flex; min-height: 100vh; }
.app-sidebar {
    width: var(--difermatica-sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, var(--difermatica-sidebar-bg) 0%, var(--difermatica-sidebar-bg-2) 100%);
    color: rgba(255,255,255,.85);
    flex-shrink: 0; position: sticky; top: 0; z-index: 1030;
    border-right: 1px solid rgba(0,0,0,.2);
    box-shadow: 1px 0 0 rgba(255,255,255,.04) inset;
}
.app-sidebar .sidebar-brand {
    padding: 1.1rem 1rem 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-cota {
    margin-top: 0.4rem;
    font-size: .72rem;
    font-weight: 650;
    letter-spacing: .04em;
    color: rgba(255,255,255,.5);
}
.sidebar-cota.is-warn { color: #ffc107; }
.sidebar-cota.is-full { color: #ff8a8a; }
.app-sidebar .sidebar-brand img {
    max-width: 100%; height: auto; background: #fff; padding: 6px 8px; border-radius: 8px;
}
.sidebar-user {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    background: rgba(255,255,255,.02);
}
a.sidebar-user { color: inherit; text-decoration: none; }
a.sidebar-user:hover { background: rgba(255,255,255,.06); }
a.sidebar-user.active { background: rgba(255,255,255,.08); }
.sidebar-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-primary-dark) 100%);
    color: #fff; font-weight: 700; font-size: .85rem; letter-spacing: .03em;
    box-shadow: 0 2px 6px rgba(227,6,19,.35);
    flex-shrink: 0;
}
.sidebar-user-name { color: #fff; font-weight: 600; font-size: .9rem; line-height: 1.1; }
.sidebar-user-role { color: rgba(255,255,255,.5); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }

.app-sidebar .nav { flex-direction: column; padding: 0.5rem 0; }
.app-sidebar .nav-link {
    color: rgba(255,255,255,.72);
    padding: 0.6rem 1.1rem;
    border-left: 3px solid transparent;
    font-weight: 500; font-size: 0.92rem;
    display: flex; align-items: center; gap: 0.75rem;
    transition: color .15s, background .15s, border-color .15s;
    border-radius: 0;
}
.app-sidebar .nav-link i { font-size: 1.05rem; width: 1.2rem; flex: 0 0 auto; }
.app-sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.05); border-left-color: rgba(255,255,255,.25); }
.app-sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(227,6,19,.22) 0%, rgba(227,6,19,.05) 100%);
    border-left-color: var(--bs-primary);
}
.app-sidebar .nav-link:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: -2px; }
.sidebar-logout {
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 0.5rem 0;
}
.sidebar-logout .nav-logout {
    background: transparent; border: none; cursor: pointer;
    color: rgba(255,255,255,.6); font-size: 0.88rem; font-weight: 500;
    padding: 0.6rem 1.1rem;
    display: flex; align-items: center; gap: 0.75rem;
    border-left: 3px solid transparent;
}
.sidebar-logout .nav-logout:hover { color: #fca5a5; background: rgba(239,68,68,.12); border-left-color: #ef4444; }

.app-main {
    flex: 1; min-width: 0;
    padding: 1.5rem;
    background: var(--difermatica-bg);
    max-width: 1400px;
    margin-inline: auto;
    width: 100%;
}

/* ===== Hamburger + backdrop (mobile) ===== */
.app-sidebar-toggle {
    display: none;
    position: fixed; top: 12px; left: 12px;
    z-index: 1040;
    padding: 0.45rem 0.7rem;
    background: var(--difermatica-sidebar-bg);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.app-sidebar-toggle i { font-size: 1.3rem; line-height: 1; }
.app-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(2px);
    z-index: 1029;
}
.app-backdrop.show { display: block; }

@media (max-width: 991.98px) {
    .app-sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .app-sidebar {
        position: fixed; left: 0; top: 0; height: 100vh;
        transform: translateX(-100%); transition: transform .25s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,.3);
    }
    .app-sidebar.show { transform: translateX(0); }
    .app-main { margin-top: 56px; padding-top: 1rem; }
}

/* ===== Cards e tabelas ===== */
.app-main .card { border: 1px solid rgba(0,0,0,.06); box-shadow: 0 1px 3px rgba(0,0,0,.04); border-radius: 12px; }
.app-main .card-header { background: #fff; border-bottom: 1px solid rgba(0,0,0,.06); }
.app-main .table thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; color: #6c757d; }
.app-main .btn-primary,
.app-main .btn-primary:visited {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}
.app-main .btn-primary:hover,
.app-main .btn-primary:focus,
.app-main .btn-primary:active {
    background: var(--bs-primary-dark);
    border-color: var(--bs-primary-dark);
    color: #fff;
}
.app-main .btn-outline-primary { color: var(--bs-primary); border-color: var(--bs-primary); }
.app-main .btn-outline-primary:hover { background: var(--bs-primary); color: #fff; }
.remote-cota-hint {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
}
.remote-cota-hint .hint {
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.15;
    margin-top: .25rem;
    color: var(--bs-danger);
    white-space: nowrap;
}
.app-main a:not(.btn) { color: var(--bs-primary-dark); }
.app-main .empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}
.grp-list { display: flex; flex-direction: column; gap: .35rem; }
.grp-nav, .grp-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    width: 100%;
    border: 1px solid rgba(0,0,0,.08);
    background: #fff;
    border-radius: 10px;
    padding: .4rem .5rem;
    text-align: left;
}
.grp-nav { cursor: pointer; }
.grp-nav.is-on, .grp-item.is-on {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}
.grp-nav.is-on .grp-nav-name, .grp-item.is-on .grp-pick { color: #fff; }
.grp-pick {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    border: 0;
    background: transparent;
    padding: 0;
    min-width: 0;
    text-align: left;
    color: inherit;
}
.grp-nav-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-handle {
    cursor: grab;
    color: #8b93a0;
    padding: 0 .15rem;
    flex-shrink: 0;
}
.grp-item.is-on .grp-handle, .grp-item.is-on .grp-tools .btn-link { color: rgba(255,255,255,.85); }
.grp-item.is-dragging, tr.grp-pc.is-dragging { opacity: .45; }
.grp-item.is-over, tr.grp-pc.is-over { outline: 2px dashed var(--bs-primary); }
.grp-tools { display: flex; align-items: center; flex-shrink: 0; }
.grp-rename { display: flex; gap: .4rem; padding: .35rem 0 0 1.6rem; }
.grp-section td {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6c757d;
    background: #f8f9fb;
    padding: .55rem .75rem;
}
.grp-pc-ord {
    white-space: nowrap;
    width: 7.2rem;
}
.grp-pc-ord .js-pc-handle {
    display: inline-block;
    vertical-align: middle;
    padding: .2rem .35rem;
}
.grp-pc-ord .btn {
    padding: .15rem .4rem;
    line-height: 1.1;
    vertical-align: middle;
}
.tv-ghead {
    grid-column: 1 / -1;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #9aa3ad;
    padding: .35rem .15rem 0;
    margin-top: .4rem;
}
.app-main .device-online { color: #198754; }
.app-main .device-offline { color: #6c757d; }

.app-main .breadcrumb { font-size: .85rem; }
.app-main .breadcrumb a { color: #6c757d; text-decoration: none; }
.app-main .breadcrumb a:hover { color: var(--bs-primary-dark); }

/* ===== Stats cards (Dashboard) ===== */
.stat-card {
    display: flex; align-items: center; gap: 0.9rem;
    padding: 1.1rem 1.2rem;
    background: #fff;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    transition: transform .15s ease, box-shadow .15s ease;
    text-decoration: none; color: inherit;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.06); color: inherit; }
.stat-card .stat-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 10px;
    background: rgba(var(--bs-primary-rgb), .1);
    color: var(--bs-primary-dark);
    font-size: 1.3rem; flex-shrink: 0;
}
.stat-card.stat-primary .stat-icon { background: rgba(var(--bs-primary-rgb), .12); color: var(--bs-primary-dark); }
.stat-card.stat-warning .stat-icon { background: #fff3cd; color: #856404; }
.stat-card.stat-info .stat-icon { background: #cfe2ff; color: #084298; }
.stat-card.stat-success .stat-icon { background: #d1e7dd; color: #0f5132; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: #1a1d21; line-height: 1.1; }
.stat-card .stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: #6c757d; font-weight: 600; }

/* ===== Modal custom (compatível com nosso JS) ===== */
.modal-difermatica { display: none; background: rgba(0,0,0,.5); position: fixed; inset: 0; z-index: 1050; backdrop-filter: blur(2px); }
.modal-difermatica.show { display: flex !important; align-items: center; justify-content: center; }
.modal-difermatica .modal-dialog { margin: 0.5rem; }

/* ===== Toolbar de filtro ===== */
.list-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.list-toolbar .filter-input { max-width: 320px; }

/* ===== Badges de estado ===== */
.badge-pendente { background-color: #ffc107; color: #000; }
.badge-em_preparacao { background-color: #0d6efd; color: #fff; }
.badge-enviada { background-color: #6f42c1; color: #fff; }
.badge-entregue { background-color: #198754; color: #fff; }
.badge-cancelada { background-color: #dc3545; color: #fff; }
.badge-em_curso { background-color: #0d6efd; color: #fff; }
.badge-concluido { background-color: #198754; color: #fff; }

.badge-soft-warning { background: #fff3cd; color: #664d03; }
.badge-soft-danger { background: #f8d7da; color: #842029; }
.badge-soft-success { background: #d1e7dd; color: #0f5132; }

/* ===== Calendário ===== */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #dee2e6; border: 1px solid #dee2e6; border-radius: 8px; overflow: hidden; }
.calendar-grid .cal-head { padding: 0.4rem; background: #1a1d21; color: #fff; text-align: center; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.calendar-grid .cal-cell { padding: 0.35rem; min-height: 76px; background: #fff; font-size: 0.8rem; }
.calendar-grid .cal-cell.empty { background: #f8f9fa; }
.calendar-grid .cal-cell .day-num { font-weight: 700; color: #212529; }
.calendar-grid .cal-cell .cal-event {
    display: block; margin-top: 0.2rem; padding: 0.2rem 0.4rem;
    background: rgba(var(--bs-primary-rgb), 0.1); color: var(--bs-primary-dark);
    border-radius: 4px; font-size: 0.7rem; text-decoration: none;
    border-left: 3px solid var(--bs-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calendar-grid .cal-cell .cal-event:hover { background: rgba(var(--bs-primary-rgb), 0.2); }
.calendar-grid .cal-cell .cal-event.ev-em_curso { border-left-color: #0d6efd; background: rgba(13,110,253,.1); color: #084298; }
.calendar-grid .cal-cell .cal-event.ev-concluido { border-left-color: #198754; background: rgba(25,135,84,.1); color: #0f5132; text-decoration: line-through; }
.calendar-grid .cal-cell .cal-event.ev-pendente { border-left-color: #ffc107; background: rgba(255,193,7,.18); color: #664d03; }
.calendar-grid .cal-cell.is-today { box-shadow: inset 0 0 0 2px var(--bs-primary); background: #fff8f8; }
.calendar-grid .cal-cell.is-today .day-num { color: var(--bs-primary); }

/* ===== Dashboard: grelha de credenciais ===== */
.credential-cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .credential-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .credential-cards { grid-template-columns: repeat(3, 1fr); } }
.credential-cards .card { border-radius: 12px; transition: box-shadow .2s ease, transform .2s ease; }
.credential-cards .card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); transform: translateY(-1px); }
.credential-cards .credential-title { font-weight: 600; font-size: .95rem; color: #1a1d21; display: flex; align-items: center; gap: .4rem; }
.credential-cards .credential-title i { color: var(--bs-primary); }
.credential-cards .field-row { display: flex; align-items: center; gap: .35rem; }
.credential-cards .field-row .form-control { font-size: .85rem; }
.credential-cards .copy-btn, .credential-cards .toggle-btn { white-space: nowrap; }

/* ===== Empty states ===== */
.app-main .empty-state {
    border: 1px dashed rgba(0,0,0,.12);
    border-radius: 12px;
    padding: 2.25rem 1.5rem;
    text-align: center;
    color: #6c757d;
    background: #fff;
}
.app-main .empty-state .empty-icon {
    font-size: 2.2rem; color: #adb5bd; display: inline-block; margin-bottom: .35rem;
}
.app-main .empty-state .lead { font-size: 1rem; margin-bottom: 0.5rem; color: #495057; font-weight: 600; }
.credential-cards > .empty-state { grid-column: 1 / -1; max-width: 36rem; margin-inline: auto; }

/* ===== Toasts ===== */
.toast-stack {
    position: fixed; bottom: 1rem; right: 1rem; z-index: 1080;
    display: flex; flex-direction: column; gap: .5rem;
    pointer-events: none;
}
.toast-stack .app-toast {
    pointer-events: auto;
    background: #fff; border: 1px solid rgba(0,0,0,.08);
    border-left: 4px solid var(--bs-primary);
    border-radius: 8px; padding: .65rem .85rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    font-size: .9rem; min-width: 220px; max-width: 360px;
    display: flex; align-items: center; gap: .5rem;
    animation: appToastIn .25s ease;
}
.toast-stack .app-toast.toast-success { border-left-color: #198754; }
.toast-stack .app-toast.toast-danger { border-left-color: #dc3545; }
.toast-stack .app-toast.toast-warning { border-left-color: #ffc107; }
.toast-stack .app-toast i { font-size: 1.1rem; }
.toast-stack .app-toast.toast-success i { color: #198754; }
.toast-stack .app-toast.toast-danger i { color: #dc3545; }
.toast-stack .app-toast.toast-warning i { color: #ffc107; }
@keyframes appToastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Páginas públicas (Termos / Privacidade) ===== */
.body-legal {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--difermatica-bg);
    color: #1a1d21;
}
.legal-header {
    background: linear-gradient(180deg, #1a1d21 0%, #23272d 100%);
    border-bottom: 3px solid var(--bs-primary);
    position: sticky;
    top: 0;
    z-index: 20;
}
.legal-header-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.legal-brand {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    gap: .2rem;
}
.legal-brand img {
    display: block;
    height: 28px;
    width: auto;
    max-width: 180px;
}
.legal-brand-name {
    color: rgba(255,255,255,.7);
    font-weight: 600;
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.legal-brand-sub {
    color: rgba(255,255,255,.5);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-top: 2px;
}
.legal-nav {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}
.legal-nav a {
    color: rgba(255,255,255,.72);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 500;
    padding: .4rem .7rem;
    border-radius: 8px;
}
.legal-nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.legal-nav a.active {
    color: #fff;
    background: rgba(227,6,19,.22);
}
.legal-nav-login {
    background: var(--bs-primary) !important;
    color: #fff !important;
    font-weight: 600 !important;
}
.legal-nav-login:hover { background: var(--bs-primary-dark) !important; }

.legal-main {
    flex: 1;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}
.legal-doc {
    background: #fff;
    border: 1px solid rgba(0,0,0,.06);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    padding: 2rem 2.1rem 2.4rem;
}
.legal-doc .legal-kicker {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 600;
    color: var(--bs-primary);
    margin-bottom: .35rem;
}
.legal-doc h1 {
    font-size: 1.65rem;
    font-weight: 700;
    margin-bottom: .35rem;
}
.legal-doc .legal-updated {
    color: #6c757d;
    font-size: .88rem;
    margin-bottom: 1.5rem;
}
.legal-doc h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 1.65rem;
    margin-bottom: .55rem;
    padding-top: .35rem;
    border-top: 1px solid rgba(0,0,0,.06);
}
.legal-doc h2:first-of-type { border-top: none; padding-top: 0; margin-top: 1.1rem; }
.legal-doc p, .legal-doc li { color: #343a40; font-size: .95rem; line-height: 1.6; }
.legal-doc ul, .legal-doc ol { padding-left: 1.15rem; margin-bottom: 0.75rem; }
.legal-doc li { margin-bottom: .28rem; }
.legal-toc {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1rem 1.15rem;
    margin-bottom: 1.25rem;
}
.legal-toc strong { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: #6c757d; }
.legal-toc ol { margin: .5rem 0 0; padding-left: 1.2rem; }
.legal-toc a { color: #1a1d21; text-decoration: none; font-size: .9rem; }
.legal-toc a:hover { color: var(--bs-primary-dark); text-decoration: underline; }

.legal-footer {
    background: #1a1d21;
    color: rgba(255,255,255,.65);
    font-size: .85rem;
    margin-top: auto;
}
.legal-footer-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 1.35rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}
.legal-footer a { color: rgba(255,255,255,.8); text-decoration: none; margin-right: 1rem; }
.legal-footer a:hover { color: #fff; text-decoration: underline; }
.legal-footer-sep { margin: 0 .4rem; opacity: .45; }
.legal-footer-copy { color: rgba(255,255,255,.4); font-size: .8rem; }

/* ===== Sessão remota (chrome portal, ecrã embutido) ===== */
.sessao-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0e1013;
    color: #fff;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.sessao-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 56px;
    padding: 0 1rem 0 0.85rem;
    background: #fff;
    color: #1a1d21;
    border-bottom: 3px solid var(--bs-primary, #e30613);
    flex-shrink: 0;
}
.sessao-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: #1a1d21;
    flex-shrink: 0;
}
.sessao-brand img {
    height: 28px;
    width: auto;
    display: block;
}
.sessao-brand span {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #6c757d;
}
.sessao-meta {
    flex: 1;
    min-width: 0;
    text-align: center;
}
.sessao-pc {
    font-weight: 700;
    font-size: .95rem;
    color: #1a1d21;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sessao-pc i { color: var(--bs-primary, #e30613); margin-right: .35rem; }
.sessao-empresa {
    font-size: .75rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sessao-end {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--bs-primary, #e30613);
    color: #fff !important;
    text-decoration: none;
    font-weight: 600;
    font-size: .85rem;
    padding: .45rem .85rem;
    border-radius: 8px;
    flex-shrink: 0;
}
.sessao-end:hover { background: #b8000f; color: #fff; }
.sessao-stage {
    flex: 1;
    position: relative;
    min-height: 0;
    background: #0e1013;
}
.sessao-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #0e1013;
}
.sessao-loading, .sessao-fail {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0e1013;
    text-align: center;
    padding: 2rem;
}
.sessao-loading[hidden], .sessao-fail[hidden] { display: none; }
.sessao-loading p, .sessao-fail p { margin: .35rem 0 0; }
.sessao-loading-sub { color: rgba(255,255,255,.45); font-size: .85rem; max-width: 28rem; }
.sessao-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,.15);
    border-top-color: var(--bs-primary, #e30613);
    border-radius: 50%;
    animation: sessao-spin .8s linear infinite;
    margin-bottom: .85rem;
}
@keyframes sessao-spin { to { transform: rotate(360deg); } }

@media (max-width: 575.98px) {
    .legal-doc { padding: 1.35rem 1.15rem 1.75rem; }
    .legal-header-inner { padding: .75rem 1rem; }
    .sessao-brand span { display: none; }
}

/* Dashboard do PC */
.dash-meters .display-6 { font-size: 2rem; line-height: 1.1; }
.dash-facts th {
    width: 38%;
    font-weight: 600;
    color: #6c757d;
    padding: .65rem 1rem;
}
.dash-facts td { padding: .65rem 1rem; }
.dash-facts tr:last-child th,
.dash-facts tr:last-child td { border-bottom: 0; }
.dash-tools .btn { border-radius: 8px; }
.dash-events li {
    padding: .55rem 0;
    border-bottom: 1px solid #eceef1;
}
.dash-events li:last-child { border-bottom: 0; }

/* Mural TV / frota */
.tv-body {
    margin: 0;
    min-height: 100vh;
    background: #0b0d10;
    color: #e8eaed;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
.tv-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: .7rem 1.1rem;
    background: #11141a;
    border-bottom: 3px solid #e30613;
    position: sticky;
    top: 0;
    z-index: 5;
}
.tv-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    text-decoration: none;
    color: #e8eaed;
    flex-shrink: 0;
}
.tv-brand img { height: 28px; width: auto; display: block; }
.tv-brand span {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #9aa0a6;
}
.tv-empresa {
    font-weight: 700;
    font-size: 1.05rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tv-pills { display: flex; flex-wrap: wrap; gap: .4rem; margin-left: auto; }
.tv-filters { display: flex; gap: .35rem; flex-shrink: 0; }
.tv-filter {
    background: #1c2128;
    border: 1px solid #2a3038;
    color: #c4c7cc;
    font-size: .78rem;
    font-weight: 650;
    padding: .32rem .7rem;
    border-radius: 999px;
    cursor: pointer;
}
.tv-filter.is-on { background: #e30613; border-color: #e30613; color: #fff; }
.tv-pill-live { background: #102a3a; color: #80d8ff; }
.tv-pill {
    font-size: .78rem;
    font-weight: 650;
    padding: .28rem .65rem;
    border-radius: 999px;
    background: #1c2128;
    color: #c4c7cc;
}
.tv-pill-crit { background: #3d1214; color: #ff8a80; }
.tv-pill-warn { background: #3a2a0a; color: #ffd54f; }
.tv-pill-ok { background: #0f2e1c; color: #81c784; }
.tv-clock {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: .04em;
    min-width: 5.6rem;
    text-align: right;
}
.tv-full {
    background: transparent;
    border: 1px solid #2a3038;
    color: #c4c7cc;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
}
.tv-full:hover { border-color: #e30613; color: #fff; }
.tv-stage {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: .85rem;
    padding: 1rem;
}
.tv-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    color: #9aa0a6;
    font-size: 1.2rem;
}
.tv-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #151920;
    border: 1px solid #232a33;
    border-radius: 14px;
    padding: .9rem 1rem 1rem;
    border-top: 4px solid #2e7d32;
    min-height: 210px;
}
.tv-card--warn { border-top-color: #f9a825; }
.tv-card--crit, .tv-card.is-off { border-top-color: #e30613; }
.tv-card.is-off { opacity: .88; }
.tv-card.is-sleep { border-top-color: #5a6570; opacity: .92; }
.tv-card:hover { border-color: #3a434e; background: #181d25; }
.tv-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.tv-card-name {
    font-weight: 750;
    font-size: 1.15rem;
    line-height: 1.2;
    word-break: break-word;
}
.tv-tag {
    flex-shrink: 0;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .2rem .45rem;
    border-radius: 6px;
    background: #0f2e1c;
    color: #81c784;
}
.tv-card--warn .tv-tag { background: #3a2a0a; color: #ffd54f; }
.tv-card--crit .tv-tag, .tv-card.is-off .tv-tag { background: #3d1214; color: #ff8a80; }
.tv-card.is-sleep .tv-tag { background: #2a3038; color: #c5cbd3; }
.tv-card.is-help { box-shadow: 0 0 0 1px #e30613 inset; }
.tv-flags { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .65rem; }
.tv-flag {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: .15rem .4rem;
    border-radius: 5px;
    background: #3d1214;
    color: #ff8a80;
}
.tv-flag.is-warn { background: #3a2a0a; color: #ffd54f; }
.tv-flag.is-live { background: #102a3a; color: #80d8ff; }
.tv-flag.is-help { background: #e30613; color: #fff; }
.tv-row {
    display: flex;
    justify-content: space-between;
    font-size: .78rem;
    color: #9aa0a6;
    margin-top: .35rem;
}
.tv-row b { color: #e8eaed; font-variant-numeric: tabular-nums; }
.tv-meter {
    height: 7px;
    background: #232a33;
    border-radius: 99px;
    overflow: hidden;
    margin: .2rem 0 .15rem;
}
.tv-meter-fill { display: block; height: 100%; background: #2e7d32; }
.tv-meter-fill.is-warn { background: #f9a825; }
.tv-meter-fill.is-crit { background: #e30613; }
.tv-meter-fill.is-na { width: 0 !important; }
.tv-foot { margin-top: .75rem; font-size: .75rem; color: #7a8088; }

.prefs-lock-box {
    border: 1px solid #e6e8ec;
    border-radius: 10px;
    padding: .85rem 1rem .35rem;
    background: #fff;
    transition: background .15s ease, opacity .15s ease, border-color .15s ease;
}
.prefs-lock-box.is-locked {
    background: #f5f6f8;
    border-color: #eceef1;
    opacity: .72;
}
.prefs-lock-box.is-locked .form-check-label {
    cursor: not-allowed;
}
@media (min-width: 768px) {
    .prefs-sessao-col + .prefs-sessao-col {
        border-left: 1px solid #eceef1;
    }
}

@media (min-width: 1600px) {
    .tv-stage { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
    .tv-card-name { font-size: 1.28rem; }
}
@media (max-width: 700px) {
    .tv-empresa, .tv-brand span { display: none; }
    .tv-pills { margin-left: 0; }
}

.app-main a.stat-card,
.app-main a.stat-card:hover { color: inherit; text-decoration: none; }
.dash-spark { display: block; max-width: 100%; }
.app-main .nav-tabs { border-bottom-color: rgba(0,0,0,.08); }
.app-main .nav-tabs .nav-link { color: #495057; }
.app-main .nav-tabs .nav-link.active {
    color: var(--bs-primary-dark);
    font-weight: 600;
    border-color: rgba(0,0,0,.08) rgba(0,0,0,.08) #fff;
}

/* Lista de dispositivos: first paint sem esperar Mesh */
.stat-value.is-sk,
.sk {
    background: linear-gradient(90deg, #eceef1 0%, #f7f8fa 40%, #eceef1 80%);
    background-size: 200% 100%;
    animation: rd-sk 1.1s ease-in-out infinite;
    color: transparent !important;
    border-radius: 6px;
}
.stat-value.is-sk {
    display: inline-block;
    min-width: 3.4rem;
    height: 1.45rem;
}
.sk-line { height: 14px; width: 100%; max-width: 42rem; }
@keyframes rd-sk {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
.lista-sk td { padding: 1rem 1rem; }

/* Definições — lista de destinatários */
.settings-people {
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 10px;
    overflow: auto;
    max-height: 16rem;
}
.settings-people label {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    margin: 0;
    padding: .7rem .9rem;
    border-bottom: 1px solid rgba(0,0,0,.06);
    cursor: pointer;
}
.settings-people label:last-child { border-bottom: 0; }
.settings-people label:hover { background: rgba(0,0,0,.02); }
.settings-people .form-check-input { margin-top: .35rem; flex-shrink: 0; }
.settings-card-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(227, 6, 19, .08);
    color: var(--bs-primary);
    font-size: 1rem;
}
