/* ==========================================================================
   Risotolândia · Design System (protótipo)
   Tokens oficiais de cor continuam em style.css (--accent, --surface, --line…,
   com as variantes Rosa/Azul). Aqui: escala tipográfica, espaço, forma,
   profundidade, movimento, componentes e a nova casca (sidebar + cabeçalho).
   Ativado por <body class="ds"> (panel.js), sem afetar o login.
   ========================================================================== */
:root {
  /* Tipografia: 7 níveis */
  --fs-display: 1.75rem;  /* 28 */
  --fs-title: 1.375rem;   /* 22 */
  --fs-section: 1rem;     /* 16 */
  --fs-body: .875rem;     /* 14 */
  --fs-caption: .75rem;   /* 12 */
  --fs-metric: 1.625rem;  /* 26 */
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600;
  /* Espaço (múltiplos de 4) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  /* Forma */
  --r-field: 8px; --r-control: 12px; --r-card: 16px; --r-hero: 20px;
  /* Profundidade: repouso, elevado, flutuante */
  --e-rest: 0 1px 2px rgb(16 24 40 / .04), 0 1px 3px rgb(16 24 40 / .03);
  --e-raised: 0 2px 4px rgb(16 24 40 / .04), 0 12px 28px rgb(16 24 40 / .08);
  --e-float: 0 24px 56px rgb(16 24 40 / .18);
  /* Movimento */
  --m-fast: 120ms; --m-base: 200ms; --m-slow: 320ms; --m-ease: cubic-bezier(.2, .7, .2, 1);
  /* Casca */
  --rail: 72px; --rail-open: 244px; --content-max: 1360px;
}

body.ds { font-size: var(--fs-body); background: var(--bg); }
body.ds h1 { font-size: var(--fs-title); font-weight: var(--fw-semibold); letter-spacing: -.015em; margin: 0; }
body.ds h2 { font-size: var(--fs-section); font-weight: var(--fw-semibold); letter-spacing: -.005em; }
body.ds h3 { font-size: var(--fs-body); font-weight: var(--fw-semibold); }
body.ds .page-description { font-size: var(--fs-body); color: var(--muted); margin: 2px 0 0; }
body.ds strong { font-weight: var(--fw-semibold); }

/* ---------- Casca: sidebar estreita (V29) ---------- */
body.ds .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--rail); padding: var(--s-4) var(--s-3); display: flex; flex-direction: column; gap: var(--s-3);
  background: var(--surface); border-right: 1px solid var(--line); box-shadow: none; backdrop-filter: none; overflow: visible; transition: width var(--m-base) var(--m-ease); }
body.ds .sidebar > .brand { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; margin: 0 auto var(--s-2); border-radius: 14px; background: var(--accent-soft); }
body.ds .sidebar > .brand .brand-logo__symbol { height: 30px; }
body.ds .sidebar > .brand .brand-logo__text { display: none; }
body.ds .sidebar nav { display: flex; flex-direction: column; gap: var(--s-4); flex: 1; overflow-y: auto; overflow-x: visible; scrollbar-width: none; }
body.ds .nav-group { gap: var(--s-1); }
body.ds .nav-group-title { height: 1px; margin: 0 var(--s-2) var(--s-2); padding: 0; overflow: hidden; color: transparent; background: var(--line); }
body.ds .nav-group:first-child .nav-group-title { display: none; }
body.ds .sidebar nav a { position: relative; display: flex; align-items: center; gap: var(--s-3); height: 40px; padding: 0 12px; border-radius: var(--r-control); color: var(--muted); font-size: var(--fs-body); font-weight: var(--fw-medium); white-space: nowrap; overflow: hidden; transform: none !important; }
body.ds .sidebar nav a .app-icon { flex: 0 0 auto; width: 20px; height: 20px; color: currentColor; }
body.ds .sidebar nav a .nav-label { opacity: 0; transition: opacity var(--m-fast); }
body.ds .sidebar nav a:hover { background: var(--surface-muted); color: var(--text); }
body.ds .sidebar nav a[aria-current] { background: var(--accent-soft); color: var(--accent); box-shadow: none; font-weight: var(--fw-semibold); }
body.ds .sidebar nav a[aria-current]::before { content: ''; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); display: block; }
body.ds .sidebar nav a .approval-badge, body.ds .sidebar nav a .nav-badge { position: absolute; top: 6px; left: 28px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; font-size: 10px; line-height: 16px; }
/* Tooltip do modo compacto (elemento único posicionado pelo panel.js) */
.ds-tooltip { position: fixed; z-index: 80; padding: 6px 10px; border-radius: var(--r-field); background: var(--control); color: #fff; font-size: var(--fs-caption); font-weight: var(--fw-medium);
  white-space: nowrap; pointer-events: none; box-shadow: var(--e-raised); opacity: 0; transform: translate(-4px, -50%); transition: opacity var(--m-fast), transform var(--m-fast); }
.ds-tooltip.is-visible { opacity: 1; transform: translate(0, -50%); }
.ds-tooltip::before { content: ''; position: absolute; left: -4px; top: 50%; width: 8px; height: 8px; background: inherit; transform: translateY(-50%) rotate(45deg); border-radius: 2px; }
/* Rodapé da sidebar: expandir + perfil */
.rail-footer { display: grid; gap: var(--s-2); }
body.ds .rail-toggle, body.ds .rail-profile { display: flex; align-items: center; justify-content: flex-start; gap: var(--s-3); height: 44px; width: 100%; padding: 0 12px; border: 0; border-radius: var(--r-control); background: transparent; color: var(--muted); font: inherit; font-weight: var(--fw-medium); cursor: pointer; white-space: nowrap; overflow: hidden; box-shadow: none !important; }
body.ds .rail-toggle:hover:not(:disabled), body.ds .rail-profile:hover:not(:disabled), body.ds .rail-profile[aria-expanded="true"] { background: var(--surface-muted); color: var(--text); box-shadow: none; }
.rail-toggle svg { flex: 0 0 auto; width: 20px; height: 20px; transition: transform var(--m-base) var(--m-ease); }
body.ds.rail-open .rail-toggle svg { transform: rotate(180deg); }
.rail-avatar { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; margin-left: -6px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: var(--fw-semibold); }
.rail-profile span:last-child, .rail-toggle span { opacity: 0; transition: opacity var(--m-fast); }
body.ds .panel-account { display: none; }
/* Expandida */
body.ds.rail-open .sidebar { width: var(--rail-open); box-shadow: var(--e-raised); }
body.ds.rail-open .sidebar > .brand { width: auto; height: auto; padding: 8px 10px; margin: 0 0 var(--s-2); justify-content: start; display: flex; gap: 10px; background: transparent; }
body.ds.rail-open .sidebar > .brand .brand-logo__text { display: grid; }
body.ds.rail-open .nav-group-title { height: auto; color: var(--muted); background: none; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; margin: 0 12px var(--s-1); }
body.ds.rail-open .nav-group:first-child .nav-group-title { display: block; }
body.ds.rail-open .sidebar nav a .nav-label, body.ds.rail-open .rail-profile span:last-child, body.ds.rail-open .rail-toggle span { opacity: 1; }
/* Menu do perfil */
.profile-menu { position: fixed; left: calc(var(--rail) + 8px); bottom: 16px; z-index: 60; width: 260px; padding: var(--s-2); border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--e-float); animation: ds-pop var(--m-base) var(--m-ease); }
body.ds.rail-open .profile-menu { left: calc(var(--rail-open) + 8px); }
.profile-menu[hidden] { display: none; }
.profile-menu header { display: grid; padding: var(--s-2) var(--s-3) var(--s-3); border-bottom: 1px solid var(--line); margin-bottom: var(--s-2); }
.profile-menu header small { color: var(--muted); font-size: var(--fs-caption); }
.profile-menu .appearance { display: block; }
.profile-menu .appearance > button { display: none; }
.profile-menu .appearance-menu { position: static; display: grid !important; gap: 6px; padding: var(--s-1) var(--s-2) var(--s-2); border: 0; box-shadow: none; margin: 0; }
.profile-menu .appearance-menu legend { font-size: var(--fs-caption); color: var(--muted); font-weight: var(--fw-semibold); margin-bottom: 4px; }
.profile-menu .logout { width: 100%; justify-content: flex-start; }
@keyframes ds-pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Conteúdo e cabeçalho (V29) ---------- */
body.ds > main { margin-left: var(--rail); width: auto; max-width: none; padding: 0 clamp(16px, 2.4vw, 32px) var(--s-10); }
body.ds > main > * { max-width: var(--content-max); margin-left: auto; margin-right: auto; }
body.ds > main > .heading { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: var(--s-5) 0 var(--s-4); margin-bottom: var(--s-2);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px) saturate(1.3); border-bottom: 1px solid transparent; transition: border-color var(--m-base), padding var(--m-base); max-width: none; }
body.ds > main > .heading.is-stuck { border-bottom-color: var(--line); padding: var(--s-3) 0; }
body.ds > main > .heading > div:first-child { min-width: 0; }
body.ds .heading-context { display: block; margin-bottom: 2px; color: var(--muted); font-size: var(--fs-caption); font-weight: var(--fw-medium); }
body.ds h1 > .app-icon { display: none; }
body.ds .heading .actions, body.ds .heading .models-toolbar, body.ds .heading .panel-heading-actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

/* ---------- Componentes ---------- */
body.ds button, body.ds .button-link { min-height: 38px; padding: 0 var(--s-4); border-radius: var(--r-control); font-size: var(--fs-body); font-weight: var(--fw-semibold); transition: background var(--m-fast), border-color var(--m-fast), box-shadow var(--m-base), transform var(--m-fast); }
body.ds button.secondary { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
body.ds button.secondary:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-muted); }
body.ds button.brand, body.ds .btn-brand { background: var(--accent); border-color: var(--accent); color: #fff; }
body.ds button.brand:hover:not(:disabled) { background: var(--accent-strong); box-shadow: 0 8px 18px var(--accent-shadow-soft, rgb(0 0 0 / .1)); }
body.ds input:not([type=checkbox]):not([type=radio]), body.ds select, body.ds textarea { min-height: 38px; border-radius: var(--r-field); font-size: var(--fs-body); }
body.ds label { font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--muted); }
body.ds .panel { border-radius: var(--r-card); box-shadow: var(--e-rest); border: 1px solid var(--line); padding: var(--s-5); }
body.ds .source { font-size: 11px; font-weight: var(--fw-semibold); padding: 2px 8px; }
.badge-status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 11px; font-weight: var(--fw-semibold); background: #f2f4f7; color: #475467; white-space: nowrap; }
.badge-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-status.is-good { background: #ecfdf3; color: #067647; } .badge-status.is-warn { background: #fffaeb; color: #b54708; } .badge-status.is-bad { background: #fef3f2; color: #b42318; }
.ds-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-control); background: var(--surface-sunken, var(--surface-muted)); }
.ds-tabs button { min-height: 32px !important; padding: 0 12px !important; border: 0 !important; background: transparent !important; color: var(--muted) !important; font-size: var(--fs-caption) !important; box-shadow: none !important; }
.ds-tabs button[aria-pressed="true"] { background: var(--surface) !important; color: var(--text) !important; box-shadow: var(--e-rest) !important; }
.skeleton { position: relative; overflow: hidden; border-radius: var(--r-field); background: var(--surface-muted); color: transparent !important; }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgb(255 255 255 / .6), transparent); transform: translateX(-100%); animation: ds-shimmer 1.2s infinite; }
@keyframes ds-shimmer { to { transform: translateX(100%); } }
.ds-empty { display: grid; justify-items: center; gap: 6px; padding: var(--s-8) var(--s-4); text-align: center; color: var(--muted); }
.ds-empty strong { color: var(--text); font-size: var(--fs-body); }
.ds-empty .ds-empty-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.ds-empty svg { width: 22px; height: 22px; }

/* Entrada da página: cartões em sequência curta, só na primeira carga */
body.ds .ds-enter > * { animation: ds-rise var(--m-slow) var(--m-ease) both; }
body.ds .ds-enter > *:nth-child(2) { animation-delay: 40ms; } body.ds .ds-enter > *:nth-child(3) { animation-delay: 80ms; } body.ds .ds-enter > *:nth-child(n+4) { animation-delay: 120ms; }
@keyframes ds-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Responsivo da casca ---------- */
@media (max-width: 760px) {
  body.ds .sidebar { position: sticky; inset: auto; top: 0; width: auto !important; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  body.ds .sidebar > .brand { margin: 0 auto 0 0; width: 40px; height: 40px; }
  body.ds .rail-footer { display: none; }
  body.ds .sidebar nav { display: none; flex-basis: 100%; }
  body.ds .sidebar.is-open nav { display: flex; }
  body.ds .sidebar nav a .nav-label { opacity: 1; }
  body.ds .nav-group-title { display: none !important; }
  body.ds:not(.rail-open) .sidebar nav a::after { display: none; }
  body.ds > main { margin-left: 0; }
  body.ds > main > .heading { position: static; flex-wrap: wrap; align-items: stretch; }
  body.ds .sidebar .panel-account { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body.ds .ds-enter > *, .skeleton::after, .profile-menu { animation: none !important; }
  body.ds .sidebar, .rail-toggle svg { transition: none; }
}

/* ==========================================================================
   Visão geral (dashboard gerencial) — V24 com legibilidade
   ========================================================================== */
.overview-page .heading .actions { gap: var(--s-2); }
.ov-filter select { min-width: 170px; max-width: 230px; }
.ov-top { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: var(--s-4); margin-bottom: var(--s-4); }
.ov-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s-6); padding: var(--s-6) var(--s-8);
  border-radius: var(--r-hero); color: #fff; isolation: isolate; box-shadow: 0 18px 40px color-mix(in srgb, var(--accent) 28%, transparent);
  background: linear-gradient(110deg, var(--accent) 0%, var(--accent) 38%, color-mix(in srgb, var(--brand-light, #ff9d3f) 35%, var(--accent)) 100%); }
.ov-hero::before, .ov-hero::after { content: ''; position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; }
.ov-hero::before { width: 360px; height: 360px; right: -90px; top: -150px; background: radial-gradient(circle, rgb(255 255 255 / .16), transparent 65%); }
.ov-hero::after { width: 240px; height: 240px; left: 32%; bottom: -170px; background: radial-gradient(circle, rgb(255 255 255 / .14), transparent 70%); }
.ov-eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgb(255 255 255 / .18); border: 1px solid rgb(255 255 255 / .28); backdrop-filter: blur(8px); font-size: var(--fs-caption); font-weight: var(--fw-semibold); }
body.ds .ov-hero h2 { margin: var(--s-3) 0 var(--s-2); font-size: var(--fs-display); line-height: 1.15; letter-spacing: -.02em; color: #fff; max-width: 22ch; }
.ov-hero h2 .skeleton { display: inline-block; min-width: 260px; background: rgb(255 255 255 / .2); }
.ov-hero-text { margin: 0; color: rgb(255 255 255 / .88); font-size: var(--fs-body); max-width: 52ch; }
.ov-hero-stats { display: flex; gap: var(--s-2); margin: var(--s-5) 0 var(--s-4); flex-wrap: wrap; }
.ov-hero-stats > div { min-width: 118px; padding: 10px 14px; border-radius: var(--r-control); background: rgb(255 255 255 / .16); border: 1px solid rgb(255 255 255 / .24); backdrop-filter: blur(10px); }
.ov-hero-stats dt { font-size: 11px; color: rgb(255 255 255 / .82); font-weight: var(--fw-medium); }
.ov-hero-stats dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; color: #fff; }
.ov-hero-actions { display: flex; gap: var(--s-2); }
.ov-chip { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 999px; background: #fff; color: var(--accent-strong); font-size: var(--fs-caption); font-weight: var(--fw-semibold); text-decoration: none; transition: transform var(--m-fast), box-shadow var(--m-base); }
.ov-chip + .ov-chip { background: transparent; color: #fff; border: 1px solid rgb(255 255 255 / .55); }
.ov-chip:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgb(0 0 0 / .14); }
.ov-ring { position: relative; width: 168px; height: 168px; }
.ov-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ov-ring circle { fill: none; stroke-width: 10; }
.ov-ring-track { stroke: rgb(255 255 255 / .22); }
.ov-ring-fill.is-zero { stroke-opacity: 0; }
.ov-ring-fill { stroke: #fff; stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray 900ms var(--m-ease); }
.ov-ring > div { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ov-ring strong { font-size: 2rem; font-weight: var(--fw-semibold); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ov-ring span { font-size: var(--fs-caption); color: rgb(255 255 255 / .85); }
.ov-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.ov-card-head h2 { margin: 0; }
.ov-card-sub { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-caption); }
.ov-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); }
.ov-attention { display: flex; flex-direction: column; }
.ov-attention-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 10px 12px; border-radius: var(--r-control); color: var(--text); text-decoration: none; transition: background var(--m-fast); }
.ov-attention-row:hover { background: var(--surface-muted); }
.ov-attention-row div { display: grid; min-width: 0; }
.ov-attention-row strong, .ov-attention-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-attention-row small { color: var(--muted); font-size: var(--fs-caption); }
.ov-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-3); margin-bottom: var(--s-4); }
.ov-kpi { display: grid; gap: 2px; align-content: start; padding: var(--s-4) var(--s-5); border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--e-rest); transition: transform var(--m-base) var(--m-ease), box-shadow var(--m-base); }
.ov-kpi:hover { transform: translateY(-2px); box-shadow: var(--e-raised); }
.ov-kpi-icon { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: var(--s-2); border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.ov-kpi-icon .app-icon, .ov-kpi-icon svg { width: 18px; height: 18px; }
.ov-kpi strong { font-size: var(--fs-metric); font-weight: var(--fw-semibold); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.ov-kpi > span:not(.ov-kpi-icon) { font-size: var(--fs-body); font-weight: var(--fw-medium); color: var(--text); }
.ov-kpi small { color: var(--muted); font-size: var(--fs-caption); }
.ov-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: var(--s-4); }
.ov-legend { display: flex; gap: var(--s-3); font-size: var(--fs-caption); color: var(--muted); }
.ov-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ov-legend i { width: 10px; height: 10px; border-radius: 3px; }
.ov-legend .is-a, .ov-bar-a { background: var(--accent); fill: var(--accent); }
.ov-legend .is-b, .ov-bar-b { background: color-mix(in srgb, var(--accent) 30%, var(--surface)); fill: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.ov-chart svg { width: 100%; height: auto; display: block; }
.ov-grid-line { stroke: var(--line); stroke-dasharray: 3 4; }
.ov-axis { fill: var(--muted); font-size: 11px; }
.ov-bar-a, .ov-bar-b { transition: opacity var(--m-fast); }
.ov-chart rect:hover { opacity: .8; }
.ov-appr-bars { display: grid; gap: var(--s-4); }
.ov-appr-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ov-appr-head strong { font-variant-numeric: tabular-nums; }
.ov-track { height: 8px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.ov-track-fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 700ms var(--m-ease); }
.ov-track-fill.is-good { background: #12b76a; } .ov-track-fill.is-warn { background: #f79009; } .ov-track-fill.is-bad { background: #f04438; }
.ov-plan-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-3); align-items: center; padding: 8px 4px; }
.ov-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; font-weight: var(--fw-semibold); }
.ov-plan-top { display: flex; justify-content: space-between; gap: var(--s-2); margin-bottom: 6px; }
.ov-plan-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--fw-medium); }
.ov-plan-count { color: var(--muted); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ov-event { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; padding: 8px 4px; }
.ov-event-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--surface-muted); color: var(--muted); }
.ov-event-icon .app-icon { width: 16px; height: 16px; }
.ov-event-text { display: grid; min-width: 0; }
.ov-event-text strong { font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-event-text small { color: var(--muted); font-size: var(--fs-caption); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-event-time { color: var(--muted); font-size: var(--fs-caption); white-space: nowrap; }
@media (max-width: 1180px) { .ov-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) { .ov-top, .ov-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .ov-hero { grid-template-columns: 1fr; padding: var(--s-5); } .ov-ring { width: 128px; height: 128px; justify-self: start; }
  .ov-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ov-filter select { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .ov-ring-fill, .ov-track-fill { transition: none; } }

/* ---------- Listagem modelo: Unidades ---------- */
body.ds .unit-list { display: grid; gap: 6px; }
body.ds .unit-admin-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 150px 140px auto; align-items: center; gap: var(--s-4); padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); transition: border-color var(--m-fast), box-shadow var(--m-base); }
body.ds .unit-admin-row:hover { border-color: var(--line-strong); box-shadow: var(--e-rest); background: var(--surface); }
.unit-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.unit-mark .app-icon { width: 18px; height: 18px; }
body.ds .unit-admin-row .unit-description { display: grid; gap: 2px; min-width: 0; }
body.ds .unit-admin-row .unit-description strong { font-weight: var(--fw-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.ds .unit-admin-row .unit-description > small { color: var(--muted); font-size: var(--fs-caption); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.unit-tag { padding: 1px 8px; border-radius: 6px; background: var(--surface-muted); border: 1px solid var(--line); font-size: 11px; font-weight: var(--fw-medium); color: var(--muted); }
.unit-tag.is-group { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); }
.unit-visits { display: grid; gap: 1px; }
.unit-visits strong { font-size: var(--fs-caption); font-weight: var(--fw-semibold); }
.unit-visits small { font-size: 11px; color: var(--muted); }
body.ds .unit-admin-row .question-actions { display: flex; gap: 6px; }
body.ds .unit-admin-row .question-actions button { min-height: 32px; padding: 0 12px; font-size: var(--fs-caption); }
body.ds .group-card { border-radius: var(--r-control); }
body.ds .device-filters { gap: var(--s-3); margin: var(--s-3) 0 var(--s-4); padding: var(--s-3); border-radius: var(--r-control); background: var(--surface-muted); }
@media (max-width: 980px) { body.ds .unit-admin-row { grid-template-columns: auto minmax(0, 1fr) auto; } body.ds .unit-admin-row .unit-visits { grid-column: 2; } body.ds .unit-admin-row .question-actions { grid-column: 2 / -1; } }

/* ==========================================================================
   Padrão aplicado às demais telas
   ========================================================================== */
body.ds .sidebar nav { min-height: 0; }
/* Indicadores (Checklists aplicados, Aprovações) no estilo dos cartões da Visão geral */
body.ds .metrics { gap: var(--s-3); margin-bottom: var(--s-4); }
body.ds .metrics > div { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: var(--s-3); align-items: center; padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--e-rest); }
body.ds .metrics > div > .metric-icon { grid-row: 1 / 3; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
body.ds .metrics > div > .metric-icon svg { width: 19px; height: 19px; }
body.ds .metrics span:not(.metric-icon) { font-size: var(--fs-caption); font-weight: var(--fw-medium); color: var(--muted); }
body.ds .metrics strong { font-size: var(--fs-metric); font-weight: var(--fw-semibold); line-height: 1.1; }
body.ds .metrics .is-highlighted { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 80%); }
/* Barras de filtro agrupadas */
body.ds .filter-bar { gap: var(--s-3); padding: var(--s-3); border-radius: var(--r-control); background: var(--surface-muted); border: 1px solid var(--line); }
body.ds .filter-bar label { gap: 4px; }
/* Gráfico de barras de Checklists aplicados */
body.ds .bar-track { width: min(100%, 28px); border-radius: 8px; background: var(--surface-muted); }
body.ds .bar-fill { border-radius: 8px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent)); transition: height 600ms var(--m-ease); }
/* Abas de visão (Checklists/Check-ins, Rotas) iguais às abas da Visão geral */
body.ds .view-tabs { padding: 3px; border-radius: var(--r-control); background: var(--surface-sunken, var(--surface-muted)); gap: 2px; }
body.ds .view-tabs [role=tab] { min-height: 32px; border-radius: 9px; font-size: var(--fs-caption); }
body.ds .view-tabs [role=tab][aria-selected="true"] { box-shadow: var(--e-rest); }
/* Tabelas e listas de registros */
body.ds .record-head, body.ds :is(.data-table, .device-table) th { font-size: 11px; font-weight: var(--fw-semibold); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
body.ds :is(.data-table, .device-table) { border-radius: var(--r-control); overflow: hidden; }
body.ds #records > details, body.ds #records > article { border-radius: var(--r-control); transition: background var(--m-fast); }
body.ds #records > details:hover { background: var(--surface-muted); }
/* Metas de check-in */
body.ds .target-group { border-radius: var(--r-card); box-shadow: var(--e-rest); }
body.ds .target-progress { height: 6px; border-radius: 999px; }
/* Usuários: avatar e linhas no padrão */
body.ds .user-row { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); margin-bottom: 6px; }
body.ds .user-row:hover { box-shadow: var(--e-rest); }
body.ds .user-avatar { border-radius: 50%; }
body.ds .user-row .actions button { min-height: 32px; padding: 0 12px; font-size: var(--fs-caption); }
/* Permissões: matriz mais legível */
body.ds .permission-matrix tr:hover td, body.ds table tr:hover td { background: var(--surface-muted); }
/* Diálogos e notificações */
body.ds dialog { border-radius: var(--r-hero); box-shadow: var(--e-float); padding: var(--s-6); }
body.ds dialog h2 { font-size: var(--fs-title); }
body.ds .notice, body.ds .sync-status { border-radius: var(--r-field); font-size: var(--fs-caption); }

/* ---------- Busca no menu + menu expandido empurra o conteúdo ---------- */
.rail-search { position: relative; display: flex; align-items: center; height: 40px; margin-bottom: var(--s-1); }
body.ds .rail-search-button { display: grid; place-items: center; width: 48px; height: 40px; min-height: 0; padding: 0; border: 0; border-radius: var(--r-control); background: transparent; color: var(--muted); box-shadow: none !important; }
body.ds .rail-search-button:hover:not(:disabled) { background: var(--surface-muted); color: var(--text); }
.rail-search-button .app-icon { width: 20px; height: 20px; }
body.ds .rail-search input { position: absolute; inset: 0; width: 100%; min-height: 40px; padding: 0 12px 0 40px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface-muted); font-size: var(--fs-body); opacity: 0; pointer-events: none; transition: opacity var(--m-fast); }
body.ds.rail-open .rail-search input { opacity: 1; pointer-events: auto; }
body.ds.rail-open .rail-search-button { position: relative; z-index: 1; width: 40px; pointer-events: none; }
.rail-search-empty { margin: var(--s-2) 12px; color: var(--muted); font-size: var(--fs-caption); }
body.ds .sidebar nav a.is-match { color: var(--text); }
body.ds .sidebar nav a[hidden], body.ds .nav-group[hidden] { display: none !important; }
/* Expandido: o conteúdo se desloca junto (sem sobrepor a tela) */
@media (min-width: 761px) {
  body.ds > main { transition: margin-left var(--m-base) var(--m-ease); }
  body.ds.rail-open > main { margin-left: var(--rail-open); }
  body.ds.rail-open .sidebar { box-shadow: none; }
}
@media (max-width: 760px) { body.ds .rail-search { display: none; } body.ds .sidebar.is-open .rail-search { display: flex; flex-basis: 100%; } body.ds .sidebar.is-open .rail-search input { opacity: 1; pointer-events: auto; } }
@media (prefers-reduced-motion: reduce) { body.ds > main { transition: none; } }
