/* Identidade visual COB + modos claro e escuro — layout original preservado */
    html { transition: background-color .2s ease, color .2s ease; }
    body, .login-page, .sidebar, .main, .card, .queue-item, .modal, .call-popup,
    .field input, .field select, .field textarea, table, th, td, .calendar-day,
    .calendar-week-column, .calendar-day-item, .calendar-day-kpi { transition: background-color .2s ease, color .2s ease, border-color .2s ease; }

    .login-page {
      background: radial-gradient(circle at top left, var(--primary), transparent 35%),
        radial-gradient(circle at bottom right, var(--accent), transparent 30%),
        linear-gradient(135deg, var(--bg), var(--surface-2)); background: radial-gradient(circle at top left, color-mix(in srgb, var(--primary) 17%, transparent), transparent 35%),
        radial-gradient(circle at bottom right, color-mix(in srgb, var(--accent) 17%, transparent), transparent 30%),
        linear-gradient(135deg, var(--bg), var(--surface-2));
    }
    .login-card { border-color: var(--border); border-color: color-mix(in srgb, var(--border) 72%, transparent); }
    .login-hero {
      background:
        linear-gradient(150deg, rgba(76, 20, 29, .98), rgba(145, 45, 58, .95)),
        radial-gradient(circle at 80% 10%, rgba(255,255,255,.13), transparent 32%);
    }
    .login-logo-wrap { width: 224px; max-width: 76%; display: flex; align-items: center; }
    .login-logo { width: 100%; height: auto; display: block; filter: drop-shadow(0 8px 18px rgba(0,0,0,.18)); }
    .app-logo { width: 29px; height: 54px; object-fit: contain; object-position: center; display: block; flex: 0 0 auto; }
    .monitor-logo { width: 36px; height: 66px; object-fit: contain; display: block; flex: 0 0 auto; }
    .field label { color: var(--muted); }
    .field input, .field select, .field textarea { background: var(--field-bg); color: var(--text); border-color: var(--border); }
    .field input:focus, .field select:focus, .field textarea:focus { box-shadow: 0 0 0 4px var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
    input::placeholder, textarea::placeholder { color: var(--muted); color: color-mix(in srgb, var(--muted) 72%, transparent); }
    select option { background: var(--surface-elevated); color: var(--text); }

    .btn-primary { box-shadow: 0 7px 18px var(--primary); box-shadow: 0 7px 18px color-mix(in srgb, var(--primary) 28%, transparent); }
    .btn-secondary { background: var(--primary-soft); color: var(--primary); }
    .btn-danger { background: var(--danger); background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
    .btn-success { background: var(--success); background: color-mix(in srgb, var(--success) 14%, var(--surface)); color: var(--success); }
    .btn-warning { background: var(--warning); background: color-mix(in srgb, var(--warning) 14%, var(--surface)); color: var(--warning); }
    .btn-info { background: var(--info); background: color-mix(in srgb, var(--info) 14%, var(--surface)); color: var(--info); }
    .demo-box { border-color: var(--primary); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); background: var(--surface-2); }

    .appbar { background: linear-gradient(100deg, #551923, #8f2f3c 62%, #b34755); box-shadow: 0 6px 24px rgba(73, 17, 27, .31); }
    .app-brand { min-width: 230px; }
    .sidebar { background: var(--sidebar-bg); }
    .nav-section-title { color: var(--muted); }
    .nav-btn { color: var(--muted); }
    .nav-btn:hover { background: var(--surface-hover); color: var(--text); }
    .nav-btn.active { color: var(--primary); }
    .sidebar-footer { background: var(--surface-2); }
    .card { box-shadow: 0 5px 18px var(--primary-dark); box-shadow: 0 5px 18px color-mix(in srgb, var(--primary-dark) 8%, transparent); }
    .current-call { background: linear-gradient(160deg, var(--surface), var(--surface-2)); }
    .queue-item { background: var(--surface); }
    .queue-item:hover { border-color: var(--primary); border-color: color-mix(in srgb, var(--primary) 48%, var(--border)); box-shadow: 0 5px 16px var(--primary); box-shadow: 0 5px 16px color-mix(in srgb, var(--primary) 10%, transparent); }
    .queue-order { background: var(--primary-soft); color: var(--primary); }
    th, td { border-color: var(--border); }
    th { background: var(--table-head); color: var(--muted); }
    tbody tr:nth-child(even) { background: var(--surface-2); }
    tbody tr:hover { background: var(--surface-hover); }
    .date-chip { border-color: var(--border); background: var(--surface-2); color: var(--primary); }
    .lawyer-name, .lawyer-badge-name, .call-popup-lawyer { color: var(--text); }
    .lawyer-card.inactive { background: var(--surface-2); }
    .lawyer-badge { background: var(--lawyer-color); background: color-mix(in srgb, var(--lawyer-color) 14%, var(--surface)); border-color: var(--lawyer-color); border-color: color-mix(in srgb, var(--lawyer-color) 34%, var(--surface)); }
    .lawyer-badge-label { color: var(--muted); }
    .selected-lawyer-preview { border-color: var(--border); background: var(--surface-2); }
    .settings-icon, .waiting-index { color: var(--primary); }
    .checkbox-row { background: var(--field-bg); }

    .monitor-page { background: var(--bg); }
    .monitor-call { background: linear-gradient(145deg, #5a1a25, #9d3745); }
    .modal { background: var(--surface-elevated); }
    .close-btn { background: var(--surface-2); color: var(--text); }
    .toast { background: #25272a; }
    .floating-call-alert { background: linear-gradient(100deg, #751f2d, #bd4a59); box-shadow: 0 14px 30px rgba(117,31,45,.28); }
    .call-popup { background: var(--surface-elevated); border-color: var(--border); }
    .call-popup-top { background: linear-gradient(135deg, #561722, #922f3d 62%, #bd4b59); }
    .call-popup-message { background: var(--surface-2); color: var(--muted); }
    .outcome-card.success .outcome-count, .report-kpi.attended .kpi-icon, .report-result.CONCLUIDO { background: var(--success); background: color-mix(in srgb, var(--success) 14%, var(--surface)); }
    .outcome-card.danger .outcome-count, .report-kpi.absent .kpi-icon, .report-result.FALTOU, .report-result.CANCELADO { background: var(--danger); background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
    .report-result.REAGENDADO, .status-SITUACAO_CORRIGIDA { background: var(--warning); background: color-mix(in srgb, var(--warning) 14%, var(--surface)); }
    .outcome-row { border-color: var(--border); }
    .config-note { background: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); border-left-color: var(--primary); color: var(--text); }
    code { background: var(--surface-2); color: var(--text); }

    .calendar-toolbar { background: linear-gradient(180deg, var(--surface), var(--surface-2)); }
    .calendar-view-switch, .calendar-weekday { background: var(--surface-2); }
    .calendar-view-btn.active { background: var(--surface-elevated); color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.10); }
    .calendar-legend, .calendar-day, .calendar-week-column, .calendar-day-kpi, .calendar-day-item, .calendar-empty { background: var(--surface); }
    .calendar-day:hover { background: var(--surface-hover); box-shadow: inset 0 0 0 2px var(--primary); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent); }
    .calendar-day.outside { background: var(--surface-2); color: var(--muted); }
    .calendar-day.today { background: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
    .calendar-event { background:#1a2328; color: var(--text); }
    html[data-theme="dark"] .calendar-event.calendar-status-AGENDADO { background:#273238; border-color:#495860; }
    html[data-theme="dark"] .calendar-event.calendar-status-PRESENTE { background:#1f3b2b; border-color:#2d6947; }
    html[data-theme="dark"] .calendar-event.calendar-status-CHAMADO { background:#4a3813; border-color:#8f6a21; }
    html[data-theme="dark"] .calendar-event.calendar-status-EM_ATENDIMENTO { background:#21334f; border-color:#4c77bf; }
    html[data-theme="dark"] .calendar-event.calendar-status-CONCLUIDO { background:#153b40; border-color:#2e7f88; }
    html[data-theme="dark"] .calendar-event.calendar-status-FALTOU,
    html[data-theme="dark"] .calendar-event.calendar-status-CANCELADO { background:#452229; border-color:#8d3d49; }
    html[data-theme="dark"] .calendar-event.calendar-status-REAGENDADO { background:#352848; border-color:#7558a6; }
    html[data-theme="dark"] .calendar-event-lawyer { color:#f1f4f6; }
    .calendar-week-head { background: var(--surface-2); }
    .calendar-week-head.today { color: var(--primary); background: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
    .correction-note { background: var(--warning); background: color-mix(in srgb, var(--warning) 13%, var(--surface)); border-color: var(--warning); border-color: color-mix(in srgb, var(--warning) 48%, var(--border)); color: var(--text); }
    .status-correction-current { background: var(--surface-2); }

    .theme-toggle { white-space: nowrap; }
    .login-top-controls { position: fixed; top: 18px; right: 18px; z-index: 20; display: flex; align-items: center; gap: 8px; }
    .login-theme-toggle { position: static; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
    .login-compat-toggle { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
    [data-open-compat][data-compat-active="true"] { box-shadow: inset 0 0 0 2px #7bf2b6; }
    .theme-toggle-label { display: inline; }
    .appbar .theme-toggle { width: 40px; min-width: 40px; padding: 0; display: grid; place-items: center; }
    .appbar .theme-toggle-label { display: none; }
    .monitor-theme-toggle { min-width: 132px; }
    .btn-monitor-close { background: linear-gradient(135deg, #b34755 0%, #c85c73 100%); color: #fff; border: 1px solid #b34755; border: 1px solid color-mix(in srgb, #b34755 72%, white); box-shadow: 0 8px 20px rgba(179,71,85,.22); }
    .btn-monitor-close:hover { background: linear-gradient(135deg, #a23e4d 0%, #bb5269 100%); color: #fff; }
    .btn-monitor-close:focus-visible { outline: 3px solid #c85c73; outline: 3px solid color-mix(in srgb, #c85c73 35%, white); outline-offset: 2px; }

    html[data-theme="dark"] .login-logo, html[data-theme="dark"] .app-logo, html[data-theme="dark"] .monitor-logo { filter: drop-shadow(0 8px 18px rgba(0,0,0,.3)); }
    html[data-theme="dark"] .status-AGENDADO { background: rgba(165,170,174,.13); color: #c3c7ca; }
    html[data-theme="dark"] .status-PRESENTE { background: rgba(87,184,135,.14); color: var(--success); }
    html[data-theme="dark"] .status-CHAMADO { background: rgba(227,173,81,.14); color: var(--warning); }
    html[data-theme="dark"] .status-EM_ATENDIMENTO { background: rgba(162,126,230,.17); color: #c6abff; }
    html[data-theme="dark"] .status-CONCLUIDO { background: rgba(67,190,199,.16); color: #86e1e7; }
    html[data-theme="dark"] .status-FALTOU, html[data-theme="dark"] .status-CANCELADO { background: rgba(225,106,118,.14); color: var(--danger); }
    html[data-theme="dark"] .status-REAGENDADO { background: rgba(159,123,201,.18); color: #c7abef; }
    html[data-theme="dark"] .queue-item.queue-rescheduled {
      background: linear-gradient(180deg, #2b1c22, #24181d);
      border-color: #855060;
      box-shadow: inset 4px 0 0 #d2768e, 0 7px 20px rgba(0,0,0,.22);
    }
    html[data-theme="dark"] .queue-item.queue-rescheduled:hover { border-color: #b9697e; box-shadow: inset 4px 0 0 #e08aa0, 0 8px 22px rgba(0,0,0,.28); }
    html[data-theme="dark"] .queue-item.queue-in-service { background: linear-gradient(180deg, rgba(91,68,145,.28), rgba(63,47,105,.22)); border-color: rgba(160,132,218,.62); box-shadow: inset 4px 0 0 #a084da; }
    html[data-theme="dark"] .queue-item.queue-completed { background: linear-gradient(180deg, rgba(16,117,126,.30), rgba(11,79,86,.24)); border-color: rgba(84,208,219,.58); box-shadow: inset 4px 0 0 #55ced8; }
    html[data-theme="dark"] .queue-item.queue-rescheduled { background: linear-gradient(180deg, rgba(92,62,149,.28), rgba(62,41,104,.22)); border-color: rgba(172,141,232,.58); box-shadow: inset 4px 0 0 #b192ef; }
    html[data-theme="dark"] .queue-item.queue-present { background: linear-gradient(180deg, rgba(50,126,86,.22), rgba(32,87,61,.18)); border-color: rgba(98,190,139,.58); box-shadow: inset 4px 0 0 #62be8b; }
    html[data-theme="dark"] .queue-item.queue-called { background: linear-gradient(180deg, rgba(151,104,25,.24), rgba(111,77,19,.18)); border-color: rgba(224,175,77,.58); box-shadow: inset 4px 0 0 #e0af4d; }
    html[data-theme="dark"] .queue-item.queue-call-viewed { background: linear-gradient(180deg, rgba(42,101,145,.26), rgba(29,72,106,.20)); border-color: rgba(94,164,214,.62); box-shadow: inset 4px 0 0 #5ea4d6; }
    html[data-theme="dark"] .queue-item.queue-missed { background: linear-gradient(180deg, rgba(145,52,64,.28), rgba(102,34,44,.24)); border-color: rgba(220,105,119,.64); box-shadow: inset 4px 0 0 #dc6977; }
    html[data-theme="dark"] .queue-item.queue-present .queue-order,
    html[data-theme="dark"] .queue-item.queue-present .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-present .queue-time,
    html[data-theme="dark"] .queue-item.queue-present .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-present .status-pill,
    html[data-theme="dark"] .queue-item.queue-completed .queue-order,
    html[data-theme="dark"] .queue-item.queue-completed .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-completed .queue-time,
    html[data-theme="dark"] .queue-item.queue-completed .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-completed .status-pill,
    html[data-theme="dark"] .queue-item.queue-rescheduled .queue-order,
    html[data-theme="dark"] .queue-item.queue-rescheduled .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-rescheduled .queue-time,
    html[data-theme="dark"] .queue-item.queue-rescheduled .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-rescheduled .status-pill,
    html[data-theme="dark"] .queue-item.queue-missed .queue-order,
    html[data-theme="dark"] .queue-item.queue-missed .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-missed .queue-time,
    html[data-theme="dark"] .queue-item.queue-missed .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-missed .status-pill,
    html[data-theme="dark"] .queue-item.queue-in-service .queue-order,
    html[data-theme="dark"] .queue-item.queue-in-service .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-in-service .queue-time,
    html[data-theme="dark"] .queue-item.queue-in-service .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-in-service .status-pill,
    html[data-theme="dark"] .queue-item.queue-called .queue-order,
    html[data-theme="dark"] .queue-item.queue-called .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-called .queue-time,
    html[data-theme="dark"] .queue-item.queue-called .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-called .status-pill,
    html[data-theme="dark"] .queue-item.queue-call-viewed .queue-order,
    html[data-theme="dark"] .queue-item.queue-call-viewed .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-call-viewed .queue-time,
    html[data-theme="dark"] .queue-item.queue-call-viewed .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-call-viewed .status-pill { border-color: rgba(255,255,255,.12); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset; }
    html[data-theme="dark"] .queue-item.queue-present .queue-order,
    html[data-theme="dark"] .queue-item.queue-completed .queue-order,
    html[data-theme="dark"] .queue-item.queue-rescheduled .queue-order,
    html[data-theme="dark"] .queue-item.queue-missed .queue-order,
    html[data-theme="dark"] .queue-item.queue-in-service .queue-order,
    html[data-theme="dark"] .queue-item.queue-called .queue-order,
    html[data-theme="dark"] .queue-item.queue-call-viewed .queue-order { background: rgba(18,22,30,.34); }
    html[data-theme="dark"] .queue-item.queue-present .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-completed .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-rescheduled .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-missed .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-in-service .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-called .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-call-viewed .queue-created-by,
    html[data-theme="dark"] .queue-item.queue-present .queue-time,
    html[data-theme="dark"] .queue-item.queue-completed .queue-time,
    html[data-theme="dark"] .queue-item.queue-rescheduled .queue-time,
    html[data-theme="dark"] .queue-item.queue-missed .queue-time,
    html[data-theme="dark"] .queue-item.queue-in-service .queue-time,
    html[data-theme="dark"] .queue-item.queue-called .queue-time,
    html[data-theme="dark"] .queue-item.queue-call-viewed .queue-time { background: rgba(10,14,20,.22); }
    html[data-theme="dark"] .queue-item.queue-present .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-completed .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-rescheduled .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-missed .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-in-service .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-called .lawyer-badge,
    html[data-theme="dark"] .queue-item.queue-call-viewed .lawyer-badge { background: rgba(10,14,20,.18); }
    html[data-theme="dark"] .queue-item.queue-present:hover { border-color: #76d29f; box-shadow: inset 4px 0 0 #76d29f, 0 8px 22px rgba(0,0,0,.28); }
    html[data-theme="dark"] .queue-item.queue-called:hover { border-color: #efc768; box-shadow: inset 4px 0 0 #efc768, 0 8px 22px rgba(0,0,0,.28); }
    html[data-theme="dark"] .queue-item.queue-call-viewed:hover { border-color: #78b8e5; box-shadow: inset 4px 0 0 #78b8e5, 0 8px 22px rgba(0,0,0,.28); }
    html[data-theme="dark"] .queue-item.queue-missed:hover { border-color: #ef8290; box-shadow: inset 4px 0 0 #ef8290, 0 8px 22px rgba(0,0,0,.28); }
    html[data-theme="dark"] .queue-item.queue-in-service:hover { border-color: #b49ae7; box-shadow: inset 4px 0 0 #b49ae7, 0 8px 22px rgba(0,0,0,.28); }
    html[data-theme="dark"] .queue-item.queue-completed:hover { border-color: #78c9c0; box-shadow: inset 4px 0 0 #78c9c0, 0 8px 22px rgba(0,0,0,.28); }
    html[data-theme="dark"] .queue-order.rescheduled { background: rgba(210,118,142,.18); color: #f0a5b9; }
    html[data-theme="dark"] .login-card { border-color: var(--border); }
    html[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,.66); }
    html[data-theme="dark"] .call-popup-backdrop { background: rgba(0,0,0,.76); }

    @media (max-width: 920px) { .app-logo { width: 25px; height: 48px; } .mobile-menu-toggle { display:grid; } }
    @media (max-width: 650px) {
      .login-theme-toggle .theme-toggle-label, .login-compat-toggle [data-compat-label], .appbar .theme-toggle-label { display: none; }
      .login-theme-toggle, .login-compat-toggle { width: 42px; padding: 0; }
      .app-brand { min-width: auto; }
      .app-logo { width: 23px; height: 44px; }
    }
    @media print { html { color-scheme: light !important; } }


    @media (max-width: 900px) {
      .monitor-top { align-items:stretch; flex-direction:column; }
      .monitor-filter { width:100%; min-width:0; }
    }
