/* ================================================================
   CC Gestão — Tema v2 (identidade "documental hospitalar")
   Carregado depois de style.css e ativo só com <html data-tema="v2">.
   Remover o link no header (ou usar ?tema=classico) restaura o visual anterior.
   Tokens: ver docs/design/COMPONENTES.md
   ================================================================ */

@font-face { font-family: 'Source Sans 3'; font-weight: 200 900; font-style: normal; font-display: swap;
    src: url('../fonts/sourcesans3-latin.woff2') format('woff2'); }
@font-face { font-family: 'Merriweather'; font-weight: 300 900; font-style: normal; font-display: swap;
    src: url('../fonts/merriweather-latin.woff2') format('woff2'); }

html[data-tema="v2"] {
    /* superfícies e linhas */
    --cc-bg:        #F7F3EA;
    --cc-surface:   #FFFCF7;
    --cc-surface-2: #F1ECE0;
    --cc-line:      #DCD7CD;
    --cc-line-strong: #BDB6A6;
    /* texto (todos ≥ 4.5:1 sobre --cc-surface e --cc-bg) */
    --cc-ink:       #243035;
    --cc-ink-2:     #4B5A5F;
    --cc-ink-3:     #5C6A6E;
    /* navegação */
    --cc-nav:       #153C40;
    --cc-nav-hover: #24555A;
    --cc-nav-ink:   #EAF1EE;
    --cc-nav-muted: #A9C2BE;
    /* semânticas: cor de preenchimento + versão escura para TEXTO (contraste AA) */
    --cc-primary:   #20676D;  --cc-primary-ink: #1B575C;  --cc-primary-bg: #DDEBEA;
    --cc-ok:        #2F7456;  --cc-ok-ink:      #276148;  --cc-ok-bg:      #E0EEE5;
    --cc-warn:      #AA782E;  --cc-warn-ink:    #805617;  --cc-warn-bg:    #F4E7CC;
    --cc-risk:      #AE4F43;  --cc-risk-ink:    #9A4136;  --cc-risk-bg:    #F4DDD8;
    --cc-info:      #5E7B8C;  --cc-info-ink:    #3F5B6B;  --cc-info-bg:    #E0E8EC;
    --cc-focus:     #0B5FA5;
    --cc-radius:    8px;
    --cc-radius-sm: 4px;
    --cc-font-ui:   'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --cc-font-ed:   'Merriweather', Georgia, 'Times New Roman', serif;
    --cc-ease:      140ms ease-out;

    /* remapeia as variáveis do tema anterior para o novo — style.css passa a pintar com a nova paleta */
    --cc-azul:         var(--cc-primary);
    --cc-azul-escuro:  var(--cc-primary-ink);
    --cc-azul-claro:   var(--cc-primary-bg);
    --cc-verde:        var(--cc-ok);
    --cc-verde-claro:  var(--cc-ok-bg);
    --cc-cinza-bg:     var(--cc-bg);
    --cc-borda:        var(--cc-line);
    --cc-texto:        var(--cc-ink);
    --cc-texto-leve:   var(--cc-ink-3);
    --sidebar-bg:      var(--cc-nav);
    --sidebar-hover:   var(--cc-nav-hover);
    --sidebar-active:  var(--cc-primary);
    --sidebar-muted:   var(--cc-nav-muted);
    --sidebar-width:   264px;
    --topbar-height:   64px;
    --bs-body-font-family: var(--cc-font-ui);
    --bs-primary: var(--cc-primary); --bs-primary-rgb: 32,103,109;
    --bs-success: var(--cc-ok);      --bs-success-rgb: 47,116,86;
    --bs-warning: var(--cc-warn);    --bs-warning-rgb: 170,120,46;
    --bs-danger:  var(--cc-risk);    --bs-danger-rgb: 174,79,67;
    --bs-info:    var(--cc-info);    --bs-info-rgb: 94,123,140;
    --bs-link-color: var(--cc-primary-ink);
    font-family: var(--cc-font-ui);
}

/* ── Base ───────────────────────────────────────────────────── */
html[data-tema="v2"] body { background: var(--cc-bg); color: var(--cc-ink); font-family: var(--cc-font-ui); font-size: 1rem; line-height: 1.45; }
html[data-tema="v2"] h1, html[data-tema="v2"] h2, html[data-tema="v2"] h3, html[data-tema="v2"] h4, html[data-tema="v2"] h5, html[data-tema="v2"] h6 { font-family: var(--cc-font-ed); color: var(--cc-ink); font-weight: 700; }
html[data-tema="v2"] .fw-bold, html[data-tema="v2"] .fw-semibold { font-family: var(--cc-font-ui); }
html[data-tema="v2"] .text-muted { color: var(--cc-ink-3) !important; }
html[data-tema="v2"] .text-cc { color: var(--cc-primary) !important; }
html[data-tema="v2"] a { color: var(--cc-primary-ink); }
html[data-tema="v2"] :focus-visible { outline: 3px solid var(--cc-focus); outline-offset: 2px; border-radius: 3px; }
html[data-tema="v2"] .skip-link { position: absolute; left: -999px; top: 8px; background: var(--cc-surface); color: var(--cc-ink); padding: 8px 14px; border: 2px solid var(--cc-focus); border-radius: 6px; z-index: 2000; }
html[data-tema="v2"] .skip-link:focus { left: 8px; }
@media (prefers-reduced-motion: reduce) { html[data-tema="v2"] * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ── Navegação lateral ──────────────────────────────────────── */
html[data-tema="v2"] #sidebar { background: var(--cc-nav); }
html[data-tema="v2"] .sidebar-brand { border-bottom: 1px solid rgba(255,255,255,.10); padding: 1rem 1rem .9rem !important; }
html[data-tema="v2"] .cc-marca { display: flex; align-items: center; gap: .65rem; color: var(--cc-nav-ink); text-decoration: none; min-width: 0; }
html[data-tema="v2"] .cc-marca svg { flex: none; }
html[data-tema="v2"] .cc-marca-nome { font-family: var(--cc-font-ed); font-weight: 700; font-size: 1.12rem; line-height: 1.1; color: #fff; }
html[data-tema="v2"] .cc-marca-sub { font-size: .74rem; color: var(--cc-nav-muted); display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-tema="v2"] #sidebar .nav-link { color: var(--cc-nav-ink); border-radius: 6px; padding: .55rem .75rem; font-size: .93rem; font-weight: 500; transition: background var(--cc-ease); border-left: 3px solid transparent; }
html[data-tema="v2"] #sidebar .nav-link:hover { background: var(--cc-nav-hover); color: #fff; }
html[data-tema="v2"] #sidebar .nav-link.active { background: var(--cc-nav-hover); color: #fff; font-weight: 700; border-left-color: #E3B866; border-radius: 0 6px 6px 0; }
html[data-tema="v2"] #sidebar .nav-link .bi { color: var(--cc-nav-muted); font-size: 1.05rem; width: 1.25rem; }
html[data-tema="v2"] #sidebar .nav-link.active .bi { color: #fff; }
html[data-tema="v2"] .nav-section-label { font-family: var(--cc-font-ui); color: var(--cc-nav-muted); font-size: .72rem; letter-spacing: .1em; padding: 1rem .75rem .3rem; }
html[data-tema="v2"] .sidebar-divider { border-color: rgba(255,255,255,.10); }
html[data-tema="v2"] .avatar-circle { background: var(--cc-primary); border: 2px solid rgba(255,255,255,.25); }
html[data-tema="v2"] .sidebar-footer { border-top-color: rgba(255,255,255,.10); }

/* ── Barra superior ─────────────────────────────────────────── */
html[data-tema="v2"] .topbar { background: var(--cc-surface); border-bottom: 1px solid var(--cc-line); padding: 0 1.5rem; gap: .75rem; }
html[data-tema="v2"] .topbar .page-title { font-family: var(--cc-font-ed); font-size: 1.28rem; font-weight: 700; color: var(--cc-ink); line-height: 1.15; }
html[data-tema="v2"] .topbar .breadcrumb { font-size: .82rem; }
html[data-tema="v2"] .breadcrumb-item + .breadcrumb-item::before { color: var(--cc-ink-3); }
html[data-tema="v2"] #btnToggleSidebarTop { color: var(--cc-ink); }
html[data-tema="v2"] .cc-instituicao { display: flex; align-items: center; gap: .5rem; padding: .3rem .7rem; border: 1px solid var(--cc-line); border-radius: var(--cc-radius); background: var(--cc-bg); font-size: .85rem; color: var(--cc-ink-2); white-space: nowrap; max-width: 280px; }
html[data-tema="v2"] .cc-instituicao strong { color: var(--cc-ink); overflow: hidden; text-overflow: ellipsis; }

/* ── Superfícies, tabelas, formulários, botões ──────────────── */
html[data-tema="v2"] .content-area { padding: 1.5rem; }
html[data-tema="v2"] .card { background: var(--cc-surface); border: 1px solid var(--cc-line); border-radius: var(--cc-radius); box-shadow: none; }
html[data-tema="v2"] .card-header { background: transparent; border-bottom: 1px solid var(--cc-line); font-family: var(--cc-font-ed); font-weight: 700; font-size: 1rem; color: var(--cc-ink); padding: .8rem 1rem; }
html[data-tema="v2"] .table { --bs-table-bg: transparent; color: var(--cc-ink); border-color: var(--cc-line); }
html[data-tema="v2"] .table > thead > tr > th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cc-ink-2); background: var(--cc-surface-2); border-bottom: 1px solid var(--cc-line-strong); font-weight: 700; }
html[data-tema="v2"] .table-hover > tbody > tr:hover > * { --bs-table-hover-bg: var(--cc-primary-bg); }
html[data-tema="v2"] .form-control, html[data-tema="v2"] .form-select { background-color: var(--cc-surface); border: 1px solid var(--cc-line-strong); border-radius: 6px; color: var(--cc-ink); min-height: 40px; }
html[data-tema="v2"] .form-control:focus, html[data-tema="v2"] .form-select:focus { border-color: var(--cc-primary); box-shadow: 0 0 0 3px rgba(11,95,165,.25); }
html[data-tema="v2"] .form-label { font-weight: 600; color: var(--cc-ink-2); font-size: .88rem; }
html[data-tema="v2"] .btn { border-radius: 6px; font-weight: 600; transition: background var(--cc-ease), border-color var(--cc-ease), color var(--cc-ease); }
html[data-tema="v2"] .btn-primary { background: var(--cc-primary); border-color: var(--cc-primary); color: #fff !important; }
html[data-tema="v2"] .btn-primary:hover { background: var(--cc-primary-ink); border-color: var(--cc-primary-ink); }
html[data-tema="v2"] .btn-outline-primary { color: var(--cc-primary-ink); border-color: var(--cc-primary); }
html[data-tema="v2"] .btn-outline-primary:hover { background: var(--cc-primary); color: #fff; }
html[data-tema="v2"] .btn-outline-secondary { color: var(--cc-ink-2); border-color: var(--cc-line-strong); background: var(--cc-surface); }
html[data-tema="v2"] .btn-outline-secondary:hover { background: var(--cc-surface-2); color: var(--cc-ink); border-color: var(--cc-ink-3); }
html[data-tema="v2"] .btn-danger, html[data-tema="v2"] .btn-outline-danger:hover { background: var(--cc-risk); border-color: var(--cc-risk); color: #fff; }
html[data-tema="v2"] .btn-outline-danger { color: var(--cc-risk-ink); border-color: var(--cc-risk); }
html[data-tema="v2"] .alert { border-radius: var(--cc-radius); border-width: 1px; }
html[data-tema="v2"] .alert-success { background: var(--cc-ok-bg); border-color: #B8D5C4; color: var(--cc-ok-ink); }
html[data-tema="v2"] .alert-warning { background: var(--cc-warn-bg); border-color: #E3CC9A; color: var(--cc-warn-ink); }
html[data-tema="v2"] .alert-danger  { background: var(--cc-risk-bg); border-color: #E1B7AF; color: var(--cc-risk-ink); }
html[data-tema="v2"] .alert-info    { background: var(--cc-info-bg); border-color: #BFCDD5; color: var(--cc-info-ink); }
/* badges Bootstrap viram "selos" com texto escuro sobre fundo claro (contraste AA) */
html[data-tema="v2"] .badge.bg-secondary { background: var(--cc-surface-2) !important; color: var(--cc-ink-2) !important; border: 1px solid var(--cc-line-strong); }
html[data-tema="v2"] .badge.bg-success   { background: var(--cc-ok-bg) !important;   color: var(--cc-ok-ink) !important;   border: 1px solid #B8D5C4; }
html[data-tema="v2"] .badge.bg-warning   { background: var(--cc-warn-bg) !important; color: var(--cc-warn-ink) !important; border: 1px solid #E3CC9A; }
html[data-tema="v2"] .badge.bg-danger    { background: var(--cc-risk-bg) !important; color: var(--cc-risk-ink) !important; border: 1px solid #E1B7AF; }
html[data-tema="v2"] .badge.bg-info      { background: var(--cc-info-bg) !important; color: var(--cc-info-ink) !important; border: 1px solid #BFCDD5; }
html[data-tema="v2"] .badge.bg-primary   { background: var(--cc-primary-bg) !important; color: var(--cc-primary-ink) !important; border: 1px solid #B3D0CE; }

/* ── Componentes cc-* ──────────────────────────────────────── */
/* Status: sempre texto + ícone (cor nunca é o único sinal) */
html[data-tema="v2"] .cc-status { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
html[data-tema="v2"] .cc-status-ok   { background: var(--cc-ok-bg);   color: var(--cc-ok-ink);   border-color: #B8D5C4; }
html[data-tema="v2"] .cc-status-warn { background: var(--cc-warn-bg); color: var(--cc-warn-ink); border-color: #E3CC9A; }
html[data-tema="v2"] .cc-status-risk { background: var(--cc-risk-bg); color: var(--cc-risk-ink); border-color: #E1B7AF; }
html[data-tema="v2"] .cc-status-info { background: var(--cc-info-bg); color: var(--cc-info-ink); border-color: #BFCDD5; }
html[data-tema="v2"] .cc-status-neutro { background: var(--cc-surface-2); color: var(--cc-ink-2); border-color: var(--cc-line-strong); }
html[data-tema="v2"] .cc-status-prim { background: var(--cc-primary-bg); color: var(--cc-primary-ink); border-color: #B3D0CE; }

/* Painel */
html[data-tema="v2"] .cc-painel { background: var(--cc-surface); border: 1px solid var(--cc-line); border-radius: var(--cc-radius); }
html[data-tema="v2"] .cc-painel-topo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--cc-line); }
html[data-tema="v2"] .cc-painel-topo h2 { font-size: 1.05rem; margin: 0; display: flex; align-items: center; gap: .5rem; }
html[data-tema="v2"] .cc-painel-corpo { padding: 1rem 1.1rem; }
html[data-tema="v2"] .cc-link-mais { font-size: .86rem; font-weight: 700; text-decoration: none; color: var(--cc-primary-ink); white-space: nowrap; }
html[data-tema="v2"] .cc-link-mais:hover { text-decoration: underline; }

/* Faixa de KPIs clicáveis (sem cartões gigantes) */
html[data-tema="v2"] .cc-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--cc-line); border-radius: var(--cc-radius); background: var(--cc-surface); overflow: hidden; }
html[data-tema="v2"] .cc-kpi { display: flex; flex-direction: column; gap: .15rem; padding: .85rem 1rem; text-decoration: none; color: var(--cc-ink); border-right: 1px solid var(--cc-line); transition: background var(--cc-ease); min-width: 0; }
html[data-tema="v2"] .cc-kpi:last-child { border-right: 0; }
html[data-tema="v2"] .cc-kpi:hover { background: var(--cc-primary-bg); }
html[data-tema="v2"] .cc-kpi-rotulo { font-size: .82rem; color: var(--cc-ink-2); display: flex; align-items: center; gap: .4rem; }
html[data-tema="v2"] .cc-kpi-valor { font-family: var(--cc-font-ed); font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
html[data-tema="v2"] .cc-kpi-nota { font-size: .78rem; color: var(--cc-ink-3); }
html[data-tema="v2"] .cc-kpi.destaque-risco .cc-kpi-valor { color: var(--cc-risk-ink); }
html[data-tema="v2"] .cc-kpi.destaque-ok .cc-kpi-valor { color: var(--cc-ok-ink); }
html[data-tema="v2"] .cc-barra { height: 6px; background: var(--cc-surface-2); border-radius: 3px; overflow: hidden; border: 1px solid var(--cc-line); margin-top: .3rem; }
html[data-tema="v2"] .cc-barra > span { display: block; height: 100%; background: var(--cc-primary); }

/* Atalhos de ação */
html[data-tema="v2"] .cc-acoes { display: flex; flex-wrap: wrap; gap: .5rem; }
html[data-tema="v2"] .cc-acao { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .9rem; background: var(--cc-surface); border: 1px solid var(--cc-line-strong); border-radius: 6px; color: var(--cc-ink); text-decoration: none; font-weight: 600; font-size: .92rem; transition: background var(--cc-ease), border-color var(--cc-ease); min-height: 44px; }
html[data-tema="v2"] .cc-acao:hover { background: var(--cc-primary-bg); border-color: var(--cc-primary); }
html[data-tema="v2"] .cc-acao .bi { color: var(--cc-primary); font-size: 1.1rem; }

/* Cabeçalho de página editorial */
html[data-tema="v2"] .cc-saudacao h1 { font-size: 1.9rem; margin: 0; }
html[data-tema="v2"] .cc-saudacao p { margin: .2rem 0 0; color: var(--cc-ink-2); }

/* Lista de pendências */
html[data-tema="v2"] .cc-pendencia { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem .9rem; text-decoration: none; color: var(--cc-ink); border-bottom: 1px solid var(--cc-line); transition: background var(--cc-ease); }
html[data-tema="v2"] .cc-pendencia:last-child { border-bottom: 0; }
html[data-tema="v2"] .cc-pendencia:hover { background: var(--cc-surface-2); }
html[data-tema="v2"] .cc-pendencia.grave > .bi:first-child { color: var(--cc-risk-ink); }
html[data-tema="v2"] .cc-pendencia.atencao > .bi:first-child { color: var(--cc-warn-ink); }
html[data-tema="v2"] .cc-pendencia .cc-status { margin-bottom: .2rem; }
html[data-tema="v2"] .cc-pendencia strong { display: block; }
html[data-tema="v2"] .cc-pendencia small { color: var(--cc-ink-2); }
html[data-tema="v2"] .cc-vazio { text-align: center; padding: 1.5rem 1rem; color: var(--cc-ink-2); }
html[data-tema="v2"] .cc-vazio .bi { font-size: 1.8rem; color: var(--cc-ok); display: block; margin-bottom: .3rem; }

/* Etapas da CME (stepper vertical) */
html[data-tema="v2"] .cc-etapas { list-style: none; margin: 0; padding: 0; }
html[data-tema="v2"] .cc-etapas li { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; position: relative; }
html[data-tema="v2"] .cc-etapas li + li::before { content: ''; position: absolute; left: 11px; top: -50%; height: 100%; border-left: 2px solid var(--cc-line-strong); }
html[data-tema="v2"] .cc-etapas .ponto { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--cc-primary); background: var(--cc-surface); display: grid; place-items: center; font-size: .8rem; color: var(--cc-primary-ink); z-index: 1; flex: none; }
html[data-tema="v2"] .cc-etapas .ponto.cheio { background: var(--cc-primary); color: #fff; }
html[data-tema="v2"] .cc-etapas .nome { flex: 1; }
html[data-tema="v2"] .cc-etapas .qtd { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Tabela do mapa resumido */
html[data-tema="v2"] .cc-tabela-mapa td, html[data-tema="v2"] .cc-tabela-mapa th { padding: .6rem .7rem; vertical-align: middle; }
html[data-tema="v2"] .cc-sala-tag { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; }
html[data-tema="v2"] .cc-sala-tag::before { content: ''; width: 9px; height: 9px; border-radius: 2px; background: var(--cc-primary); flex: none; }
html[data-tema="v2"] .cc-donut-legenda { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
html[data-tema="v2"] .cc-donut-legenda li { display: flex; align-items: center; gap: .5rem; }
html[data-tema="v2"] .cc-donut-legenda i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
html[data-tema="v2"] .cc-indicador { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--cc-line); }
html[data-tema="v2"] .cc-indicador:last-child { border-bottom: 0; }
html[data-tema="v2"] .cc-indicador b { font-variant-numeric: tabular-nums; }

/* Skeleton / carregando (somente onde há carga assíncrona) */
html[data-tema="v2"] .cc-skeleton { background: linear-gradient(90deg, var(--cc-surface-2), var(--cc-surface), var(--cc-surface-2)); background-size: 200% 100%; animation: cc-sk 1.4s linear infinite; border-radius: 4px; min-height: 1em; }
@keyframes cc-sk { to { background-position: -200% 0; } }

/* Layout do dashboard */
html[data-tema="v2"] .cc-grade-dash { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1rem; }
html[data-tema="v2"] .cc-grade-dash-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }

@media (max-width: 1199.98px) {
    html[data-tema="v2"] .cc-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    html[data-tema="v2"] .cc-kpi:nth-child(3n) { border-right: 0; }
    html[data-tema="v2"] .cc-kpi:nth-child(-n+3) { border-bottom: 1px solid var(--cc-line); }
    html[data-tema="v2"] .cc-grade-dash, html[data-tema="v2"] .cc-grade-dash-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767.98px) {
    html[data-tema="v2"] .content-area { padding: 1rem .85rem; }
    html[data-tema="v2"] .cc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    html[data-tema="v2"] .cc-kpi { border-right: 1px solid var(--cc-line); border-bottom: 1px solid var(--cc-line); }
    html[data-tema="v2"] .cc-kpi:nth-child(2n) { border-right: 0; }
    html[data-tema="v2"] .cc-kpi:nth-last-child(-n+2) { border-bottom: 0; }
    html[data-tema="v2"] .cc-saudacao h1 { font-size: 1.5rem; }
    html[data-tema="v2"] .cc-instituicao { display: none; }
    html[data-tema="v2"] .cc-acao { flex: 1 1 calc(50% - .5rem); justify-content: flex-start; }
}

/* ── Mapa Cirúrgico: linha do tempo + painel lateral ────────── */
html[data-tema="v2"] .cc-mapa-grade { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
html[data-tema="v2"] .cc-navdia { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
html[data-tema="v2"] .cc-navdia .cc-data { font-family: var(--cc-font-ed); font-weight: 700; font-size: 1.05rem; padding: 0 .5rem; }
html[data-tema="v2"] .cc-seg { display: inline-flex; border: 1px solid var(--cc-line-strong); border-radius: 6px; overflow: hidden; background: var(--cc-surface); }
html[data-tema="v2"] .cc-seg a { padding: .45rem .9rem; text-decoration: none; color: var(--cc-ink-2); font-weight: 600; font-size: .9rem; border-right: 1px solid var(--cc-line); min-height: 38px; display: inline-flex; align-items: center; }
html[data-tema="v2"] .cc-seg a:last-child { border-right: 0; }
html[data-tema="v2"] .cc-seg a[aria-current="page"] { background: var(--cc-primary); color: #fff; }
html[data-tema="v2"] .cc-seg a:hover:not([aria-current="page"]) { background: var(--cc-primary-bg); }

html[data-tema="v2"] .cc-tl { overflow-x: auto; border: 1px solid var(--cc-line); border-radius: var(--cc-radius); background: var(--cc-surface); }
html[data-tema="v2"] .cc-tl-inner { min-width: 980px; }
html[data-tema="v2"] .cc-tl-hora.ini { transform: none; left: 6px !important; }
html[data-tema="v2"] .cc-tl-linha { display: grid; grid-template-columns: 150px minmax(0, 1fr); border-bottom: 1px solid var(--cc-line); }
html[data-tema="v2"] .cc-tl-linha:last-child { border-bottom: 0; }
html[data-tema="v2"] .cc-tl-cab { position: sticky; top: 0; z-index: 3; background: var(--cc-surface-2); border-bottom: 1px solid var(--cc-line-strong); }
html[data-tema="v2"] .cc-tl-sala { position: sticky; left: 0; z-index: 2; background: var(--cc-surface); padding: .7rem .8rem; border-right: 1px solid var(--cc-line-strong); display: flex; flex-direction: column; justify-content: center; gap: .15rem; }
html[data-tema="v2"] .cc-tl-cab .cc-tl-sala { background: var(--cc-surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cc-ink-2); font-weight: 700; }
html[data-tema="v2"] .cc-tl-sala strong { font-size: 1rem; }
html[data-tema="v2"] .cc-tl-trilha { position: relative; min-height: 86px; background-image: repeating-linear-gradient(to right, transparent 0, transparent calc(100%/var(--cc-horas, 14) - 1px), var(--cc-line) calc(100%/var(--cc-horas, 14) - 1px), var(--cc-line) calc(100%/var(--cc-horas, 14))); }
html[data-tema="v2"] .cc-tl-horas { position: relative; height: 34px; }
html[data-tema="v2"] .cc-tl-hora { position: absolute; top: 8px; transform: translateX(-50%); font-size: .78rem; font-weight: 600; color: var(--cc-ink-2); font-variant-numeric: tabular-nums; }
html[data-tema="v2"] .cc-tl-agora { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--cc-risk); z-index: 1; pointer-events: none; }
html[data-tema="v2"] .cc-tl-agora::before { content: attr(data-hora); position: absolute; top: -2px; left: 50%; transform: translate(-50%, -100%); background: var(--cc-risk); color: #fff; font-size: .72rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
html[data-tema="v2"] .cc-tl-bloco { position: absolute; top: 8px; bottom: 8px; padding: .3rem .5rem; border-radius: 6px; border: 1px solid var(--cc-line-strong); border-left-width: 5px; background: var(--cc-surface); color: var(--cc-ink); text-align: left; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; gap: 1px; font: inherit; line-height: 1.2; transition: box-shadow var(--cc-ease), transform var(--cc-ease); }
html[data-tema="v2"] .cc-tl-bloco:hover { box-shadow: 0 2px 8px rgba(36,48,53,.18); z-index: 2; }
html[data-tema="v2"] .cc-tl-bloco[aria-pressed="true"] { outline: 3px solid var(--cc-focus); outline-offset: 1px; z-index: 3; }
html[data-tema="v2"] .cc-tl-bloco .h { font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--cc-ink-2); white-space: nowrap; }
html[data-tema="v2"] .cc-tl-bloco .p { font-size: .84rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-tema="v2"] .cc-tl-bloco .s { font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--cc-ink-2); }
html[data-tema="v2"] .cc-tl-bloco.st-agendada { border-left-color: var(--cc-info); background: var(--cc-info-bg); }
html[data-tema="v2"] .cc-tl-bloco.st-paciente_admitido { border-left-color: var(--cc-primary); background: var(--cc-primary-bg); }
html[data-tema="v2"] .cc-tl-bloco.st-em_cirurgia { border-left-color: var(--cc-ok); background: var(--cc-ok-bg); }
html[data-tema="v2"] .cc-tl-bloco.st-limpeza_concorrente, html[data-tema="v2"] .cc-tl-bloco.st-limpeza_terminal { border-left-color: var(--cc-warn); background: var(--cc-warn-bg); }
html[data-tema="v2"] .cc-tl-bloco.st-liberada { border-left-color: var(--cc-ok); background: var(--cc-surface); }
html[data-tema="v2"] .cc-tl-bloco.st-suspensa { border-left-color: var(--cc-risk); background: repeating-linear-gradient(135deg, var(--cc-risk-bg) 0 6px, var(--cc-surface) 6px 12px); }
html[data-tema="v2"] .cc-tl-bloco.st-suspensa .p { text-decoration: line-through; }
html[data-tema="v2"] .cc-tl-bloco.atrasada { border-color: var(--cc-risk); }
html[data-tema="v2"] .cc-tl-bloco.emergencia { box-shadow: inset 0 0 0 2px var(--cc-risk); }

html[data-tema="v2"] .cc-detalhe { position: sticky; top: calc(var(--topbar-height) + 12px); }
html[data-tema="v2"] .cc-detalhe dl { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .4rem .75rem; margin: 0; font-size: .92rem; }
html[data-tema="v2"] .cc-detalhe dt { color: var(--cc-ink-2); font-weight: 600; }
html[data-tema="v2"] .cc-detalhe dd { margin: 0; overflow-wrap: anywhere; }
html[data-tema="v2"] .cc-detalhe h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; font-family: var(--cc-font-ui); color: var(--cc-ink-2); margin: 1rem 0 .4rem; }
html[data-tema="v2"] .cc-detalhe ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
html[data-tema="v2"] .cc-detalhe-acoes { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
html[data-tema="v2"] .cc-legenda { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .82rem; color: var(--cc-ink-2); margin-bottom: .75rem; }
html[data-tema="v2"] .cc-legenda span { display: inline-flex; align-items: center; gap: .4rem; }
html[data-tema="v2"] .cc-legenda i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--cc-line-strong); border-left-width: 5px; flex: none; }

/* lista por sala (celular/tablet estreito) */
html[data-tema="v2"] .cc-tl-lista { display: none; }
html[data-tema="v2"] .cc-tl-lista h3 { font-size: 1rem; margin: 1rem 0 .4rem; display: flex; justify-content: space-between; align-items: center; }
html[data-tema="v2"] .cc-item-lista { display: flex; gap: .75rem; align-items: stretch; width: 100%; text-align: left; background: var(--cc-surface); border: 1px solid var(--cc-line); border-left-width: 5px; border-radius: 6px; padding: .65rem .8rem; margin-bottom: .5rem; font: inherit; color: var(--cc-ink); cursor: pointer; min-height: 56px; }
html[data-tema="v2"] .cc-item-lista .hora { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 4.2rem; }
html[data-tema="v2"] .cc-item-lista.st-agendada { border-left-color: var(--cc-info); }
html[data-tema="v2"] .cc-item-lista.st-paciente_admitido { border-left-color: var(--cc-primary); }
html[data-tema="v2"] .cc-item-lista.st-em_cirurgia, html[data-tema="v2"] .cc-item-lista.st-liberada { border-left-color: var(--cc-ok); }
html[data-tema="v2"] .cc-item-lista.st-limpeza_concorrente, html[data-tema="v2"] .cc-item-lista.st-limpeza_terminal { border-left-color: var(--cc-warn); }
html[data-tema="v2"] .cc-item-lista.st-suspensa { border-left-color: var(--cc-risk); }

@media (max-width: 1199.98px) {
    html[data-tema="v2"] .cc-mapa-grade { grid-template-columns: minmax(0, 1fr); }
    html[data-tema="v2"] .cc-detalhe { position: static; }
}
@media (max-width: 767.98px) {
    html[data-tema="v2"] .cc-tl { display: none; }
    html[data-tema="v2"] .cc-tl-lista { display: block; }
    html[data-tema="v2"] .cc-detalhe { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 1100; max-height: 78vh; overflow-y: auto; border-radius: 14px 14px 0 0; border-bottom: 0; box-shadow: 0 -6px 24px rgba(36,48,53,.25); display: none; }
    html[data-tema="v2"] .cc-detalhe.aberto { display: block; }
    html[data-tema="v2"] .cc-detalhe dl { grid-template-columns: 6.2rem minmax(0, 1fr); }
}
@media print { html[data-tema="v2"] .cc-detalhe, html[data-tema="v2"] .cc-navdia, html[data-tema="v2"] .cc-seg { display: none !important; } }

/* ── CME: fluxo, barras e subtítulos ───────────────────────── */
html[data-tema="v2"] .cc-fluxo { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; border: 1px solid var(--cc-line); border-radius: var(--cc-radius); background: var(--cc-surface); overflow: hidden; }
html[data-tema="v2"] .cc-fluxo li { position: relative; border-right: 1px solid var(--cc-line); }
html[data-tema="v2"] .cc-fluxo li:last-child { border-right: 0; }
html[data-tema="v2"] .cc-fluxo li:not(:last-child)::after { content: '\F285'; font-family: 'bootstrap-icons'; position: absolute; right: -7px; top: 50%; transform: translateY(-50%); background: var(--cc-surface); color: var(--cc-ink-3); font-size: .8rem; z-index: 1; line-height: 1; padding: 2px 0; }
html[data-tema="v2"] .cc-fluxo a { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "n nome" "n qtd" "n un"; column-gap: .6rem; padding: .8rem .9rem; text-decoration: none; color: var(--cc-ink); height: 100%; transition: background var(--cc-ease); }
html[data-tema="v2"] .cc-fluxo a:hover { background: var(--cc-primary-bg); }
html[data-tema="v2"] .cc-fluxo-n { grid-area: n; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--cc-surface-2); color: var(--cc-ink-2); border: 1px solid var(--cc-line-strong); align-self: center; }
html[data-tema="v2"] .cc-fluxo a.ativa .cc-fluxo-n { background: var(--cc-primary); border-color: var(--cc-primary); color: #fff; }
html[data-tema="v2"] .cc-fluxo-nome { grid-area: nome; font-weight: 700; font-size: .88rem; }
html[data-tema="v2"] .cc-fluxo-qtd { grid-area: qtd; font-family: var(--cc-font-ed); font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
html[data-tema="v2"] .cc-fluxo-un { grid-area: un; font-size: .76rem; color: var(--cc-ink-3); }
html[data-tema="v2"] .cc-sub { font-family: var(--cc-font-ui); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--cc-ink-2); margin: 1rem 0 .3rem; }
html[data-tema="v2"] .cc-sub:first-child { margin-top: 0; }
html[data-tema="v2"] .cc-hbar { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) 2.2rem; gap: .6rem; align-items: center; padding: .25rem 0; font-size: .9rem; }
html[data-tema="v2"] .cc-hbar-trilho { height: 10px; background: var(--cc-surface-2); border: 1px solid var(--cc-line); border-radius: 5px; overflow: hidden; }
html[data-tema="v2"] .cc-hbar-trilho > span { display: block; height: 100%; background: var(--cc-primary); }
@media (max-width: 1199.98px) {
    html[data-tema="v2"] .cc-fluxo { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    html[data-tema="v2"] .cc-fluxo li:nth-child(3n) { border-right: 0; }
    html[data-tema="v2"] .cc-fluxo li { border-bottom: 1px solid var(--cc-line); }
    html[data-tema="v2"] .cc-fluxo li:nth-last-child(-n+3) { border-bottom: 0; }
    html[data-tema="v2"] .cc-fluxo li::after { display: none; }
}
@media (max-width: 575.98px) {
    html[data-tema="v2"] .cc-fluxo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    html[data-tema="v2"] .cc-fluxo li:nth-child(3n) { border-right: 1px solid var(--cc-line); }
    html[data-tema="v2"] .cc-fluxo li:nth-child(2n) { border-right: 0; }
    html[data-tema="v2"] .cc-fluxo li:nth-last-child(-n+3) { border-bottom: 1px solid var(--cc-line); }
    html[data-tema="v2"] .cc-fluxo li:nth-last-child(-n+2) { border-bottom: 0; }
    html[data-tema="v2"] .cc-hbar { grid-template-columns: minmax(0, 8rem) minmax(0, 1fr) 2rem; }
}

/* ── Ficha da caixa e histórico ─────────────────────────────── */
html[data-tema="v2"] .cc-ficha { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .45rem .9rem; margin: 0; font-size: .95rem; }
html[data-tema="v2"] .cc-ficha dt { color: var(--cc-ink-2); font-weight: 600; }
html[data-tema="v2"] .cc-ficha dd { margin: 0; overflow-wrap: anywhere; }
html[data-tema="v2"] .cc-hist { list-style: none; margin: 0; padding: .75rem 1.1rem 1rem; }
html[data-tema="v2"] .cc-hist li { display: flex; gap: .85rem; position: relative; padding-bottom: 1rem; }
html[data-tema="v2"] .cc-hist li:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 32px; bottom: 0; border-left: 2px solid var(--cc-line-strong); }
html[data-tema="v2"] .cc-hist-ponto { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--cc-primary-bg); color: var(--cc-primary-ink); border: 1px solid #B3D0CE; z-index: 1; }
@media (max-width: 575.98px) { html[data-tema="v2"] .cc-ficha { grid-template-columns: 7rem minmax(0, 1fr); } }

/* ── CME: tabela empilhada, KPIs de 4 e passos do lote ──────── */
html[data-tema="v2"] .cc-kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 767.98px) {
    html[data-tema="v2"] .cc-kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    html[data-tema="v2"] .cc-tabela-pilha thead { position: absolute; left: -9999px; }
    html[data-tema="v2"] .cc-tabela-pilha, html[data-tema="v2"] .cc-tabela-pilha tbody, html[data-tema="v2"] .cc-tabela-pilha tr, html[data-tema="v2"] .cc-tabela-pilha td { display: block; width: 100%; }
    html[data-tema="v2"] .cc-tabela-pilha tr { padding: .6rem .9rem; border-bottom: 1px solid var(--cc-line); }
    html[data-tema="v2"] .cc-tabela-pilha td { border: 0; padding: .2rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
    html[data-tema="v2"] .cc-tabela-pilha td[data-label]::before { content: attr(data-label); font-weight: 700; color: var(--cc-ink-2); text-align: left; flex: none; }
    html[data-tema="v2"] .cc-tabela-pilha td:not([data-label]) { justify-content: flex-end; padding-top: .5rem; }
}
html[data-tema="v2"] .cc-passos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
html[data-tema="v2"] .cc-passos li { display: flex; gap: .6rem; align-items: flex-start; }
html[data-tema="v2"] .cc-passo-n { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: .85rem; border: 2px solid var(--cc-line-strong); color: var(--cc-ink-2); background: var(--cc-surface); }
html[data-tema="v2"] .cc-passos li.feito .cc-passo-n { background: var(--cc-primary); border-color: var(--cc-primary); color: #fff; }
html[data-tema="v2"] .cc-passos small { display: block; color: var(--cc-ink-3); font-size: .8rem; }
@media (max-width: 767.98px) { html[data-tema="v2"] .cc-passos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

html[data-tema="v2"] .cc-passos-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 767.98px) { html[data-tema="v2"] .cc-passos-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; } html[data-tema="v2"] .cc-passos-3 small { display: none; } }

/* ── Agenda (calendário) ───────────────────────────────────── */
html[data-tema="v2"] .cc-cal { display: grid; }
html[data-tema="v2"] .cc-cal-cab, html[data-tema="v2"] .cc-cal-semana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
html[data-tema="v2"] .cc-cal-cab { background: var(--cc-surface-2); border-bottom: 1px solid var(--cc-line-strong); }
html[data-tema="v2"] .cc-cal-cab span { padding: .55rem .5rem; font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--cc-ink-2); text-align: center; }
html[data-tema="v2"] .cc-cal-dia { min-height: 96px; padding: .45rem .5rem; display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; text-decoration: none; color: var(--cc-ink); border-right: 1px solid var(--cc-line); border-bottom: 1px solid var(--cc-line); transition: background var(--cc-ease); }
html[data-tema="v2"] .cc-cal-semana .cc-cal-dia:last-child { border-right: 0; }
html[data-tema="v2"] .cc-cal-dia:hover { background: var(--cc-primary-bg); }
html[data-tema="v2"] .cc-cal-dia.fora { background: var(--cc-surface-2); color: var(--cc-ink-3); }
html[data-tema="v2"] .cc-cal-dia.hoje { box-shadow: inset 0 0 0 2px var(--cc-primary); }
html[data-tema="v2"] .cc-cal-dia .n { font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: .35rem; }
html[data-tema="v2"] .cc-cal-dia .cc-status { font-size: .72rem; padding: .1rem .45rem; }
html[data-tema="v2"] .cc-agenda-lista { display: none; }
@media (max-width: 767.98px) {
    html[data-tema="v2"] .cc-agenda-grade { display: none; }
    html[data-tema="v2"] .cc-agenda-lista { display: block; }
}

/* ── Conferência ativa (OK / Não OK sem pré-seleção) ───────── */
html[data-tema="v2"] .cc-escolha { border: 0; padding: 0; margin: 0; }
html[data-tema="v2"] .cc-escolha legend { float: none; width: auto; font-size: .9rem; font-weight: 600; color: var(--cc-ink-2); padding: 0; }
html[data-tema="v2"] .cc-escolha .btn { min-height: 44px; display: inline-flex; align-items: center; gap: .4rem; }
html[data-tema="v2"] .btn-check:checked + .btn-outline-success { background: var(--cc-ok); border-color: var(--cc-ok); color: #fff; }
html[data-tema="v2"] .btn-check:checked + .btn-outline-danger { background: var(--cc-risk); border-color: var(--cc-risk); color: #fff; }
html[data-tema="v2"] .btn-check:focus-visible + .btn { outline: 3px solid var(--cc-focus); outline-offset: 2px; }

html[data-tema="v2"] .cc-kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 767.98px) {
    html[data-tema="v2"] .cc-kpis-3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    html[data-tema="v2"] .cc-kpis-3 .cc-kpi { border-right: 0; border-bottom: 1px solid var(--cc-line); }
    html[data-tema="v2"] .cc-kpis-3 .cc-kpi:last-child { border-bottom: 0; }
}

/* Atalhos com selos (hub de cadastros): quebram linha no celular */
html[data-tema="v2"] .cc-pendencia.cc-atalho { flex-wrap: wrap; align-items: center; }
html[data-tema="v2"] .cc-pendencia.cc-atalho > .flex-grow-1 { min-width: 12rem; flex: 1 1 12rem; }

/* Avisos longos (role=alert) quebram linha em vez de estourar a largura */
html[data-tema="v2"] .cc-status[role="alert"] { display: flex; white-space: normal; align-items: flex-start; border-radius: 6px; }

/* Barras de indicadores com valor largo (ex.: "45,3 min") */
html[data-tema="v2"] .cc-hbar.cc-hbar-largo { grid-template-columns: minmax(0, 12rem) minmax(0, 1fr) 4.6rem; }
html[data-tema="v2"] .cc-hbar.cc-hbar-largo b { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 575.98px) {
    html[data-tema="v2"] .cc-hbar.cc-hbar-largo { grid-template-columns: minmax(0, 1fr) 4.6rem; }
    html[data-tema="v2"] .cc-hbar.cc-hbar-largo .cc-hbar-rot { grid-column: 1 / -1; }
    html[data-tema="v2"] .cc-hbar.cc-hbar-largo .cc-hbar-trilho { grid-column: 1; }
}

/* ── Tela de acesso ── */
html[data-tema="v2"] body.cc-login-pagina { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 16px; background: var(--cc-bg); }
html[data-tema="v2"] .cc-login { width: 100%; max-width: 420px; }
html[data-tema="v2"] .cc-login-marca { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.25rem; }
html[data-tema="v2"] .cc-login-marca h1 { font-family: var(--cc-font-ed); font-size: 1.25rem; margin: 0; line-height: 1.25; }
html[data-tema="v2"] .cc-login-marca p { margin: .15rem 0 0; color: var(--cc-ink-2); font-size: .92rem; }
html[data-tema="v2"] .cc-login-rodape { margin-top: 1rem; text-align: center; color: var(--cc-ink-3); font-size: .82rem; }
