/* ==========================================================================
   SAICA — sistema de design. Sem estilos inline (CSP): tudo aqui.
   Paleta derivada do logotipo do Samaritano (verde + marrom).
   ========================================================================== */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --g50: #f1f8ee; --g100: #dff0d8; --g200: #bfe0b1; --g500: #4a9a35; --g600: #3d8a2e; --g700: #2f6f24; --g800: #245a1c;
  --brown: #5a2e27; --brown-d: #3f1f1a;
  --bg: #f4f6f3; --surface: #ffffff; --surface-2: #f8faf7; --text: #1b2820; --text-2: #55655b; --text-3: #7d8c82;
  --line: #e0e7dd; --line-2: #cbd6c7;
  --info: #2563a8; --info-bg: #e8f0fa;
  --warn: #a96510; --warn-bg: #fff3dd;
  --bad: #c0392b; --bad-bg: #fdebe8;
  --ok: #2f7d2a; --ok-bg: #e5f4df;
  --primary: var(--g600); --primary-d: var(--g700); --primary-bg: var(--g50);
  --radius: 12px; --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(20, 40, 25, .06);
  --shadow-md: 0 4px 16px rgba(20, 40, 25, .08);
  --sidebar-w: 264px;
  /* nomes antigos, mantidos por compatibilidade com telas existentes */
  --blue: var(--primary); --blue-d: var(--primary-d); --blue-l: var(--primary-bg);
  --card: var(--surface); --muted: var(--text-2);
  --red: var(--bad); --red-l: var(--bad-bg); --green: var(--ok); --green-l: var(--ok-bg);
  --orange: var(--warn); --orange-l: var(--warn-bg);
}
/* Tema claro fixo (sem modo escuro), padrao de sistemas corporativos. */
:root { color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 15.5px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--primary-d); text-underline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: .98rem; font-weight: 650; }
p { margin: 0 0 .7rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.1rem 0; }
.muted { color: var(--text-2); } .small { font-size: .85rem; } .right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; } .hidden { display: none !important; } .strong { font-weight: 650; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.i.lg { width: 1.5em; height: 1.5em; } .i.xl { width: 2.2em; height: 2.2em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- estrutura do aplicativo ---------- */
.app { min-height: 100dvh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 50; transform: translateX(-100%); transition: transform .22s ease; }
.sidebar.open { transform: none; box-shadow: var(--shadow-md); }
.scrim { position: fixed; inset: 0; background: rgba(15, 25, 18, .45); z-index: 45; }
.sb-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem 1rem .8rem; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line); }
.sb-brand img { height: 42px; width: auto; max-width: 170px; object-fit: contain; }
.sb-brand small { display: block; font-size: .72rem; color: var(--text-2); line-height: 1.2; }
.sb-nav { flex: 1; overflow-y: auto; padding: .6rem .6rem 1rem; }
.sb-title { margin: 1rem .55rem .3rem; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.sb-nav a, .sb-nav summary { display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; margin: 1px 0; border-radius: 9px; color: var(--text-2); text-decoration: none; font-weight: 500; font-size: .93rem; cursor: pointer; list-style: none; }
.sb-nav summary::-webkit-details-marker { display: none; }
.sb-nav a:hover, .sb-nav summary:hover { background: var(--surface-2); color: var(--text); }
.sb-nav a.active { background: var(--primary-bg); color: var(--primary-d); font-weight: 650; }
.sb-nav details > summary .chev { margin-left: auto; transition: transform .15s; }
.sb-nav details[open] > summary .chev { transform: rotate(90deg); }
.sb-nav details > div { margin-left: 1.05rem; padding-left: .55rem; border-left: 1px solid var(--line); }
.sb-nav .count { margin-left: auto; background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 99px; padding: .05rem .45rem; min-width: 1.35rem; text-align: center; }
.sb-foot { border-top: 1px solid var(--line); padding: .7rem; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .6rem; height: 58px; padding: 0 .9rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .ttl { font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .dot-count { position: absolute; top: 3px; right: 2px; background: var(--bad); color: #fff; font-size: .66rem; font-weight: 700; border-radius: 99px; min-width: 1.15rem; padding: 0 .3rem; line-height: 1.15rem; text-align: center; }
.userchip { display: flex; align-items: center; gap: .55rem; padding: .25rem .5rem .25rem .25rem; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text); font-size: .85rem; }
.userchip small { color: var(--text-2); display: block; font-size: .7rem; line-height: 1; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--g100); color: var(--g800); font-weight: 700; font-size: .8rem; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: .68rem; } .avatar.lg { width: 44px; height: 44px; font-size: 1rem; }
.avatar.b { background: #efe0dc; color: var(--brown); }
.page { max-width: 1180px; margin: 0 auto; padding: 1.2rem 16px 6rem; }
.page.narrow { max-width: 720px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .8rem 1rem; margin-bottom: 1.1rem; }
.page-head .lead { color: var(--text-2); margin: .3rem 0 0; max-width: 62ch; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.crumbs { font-size: .8rem; color: var(--text-3); margin-bottom: .35rem; display: flex; gap: .35rem; flex-wrap: wrap; }
.crumbs a { color: var(--text-2); text-decoration: none; } .crumbs a:hover { text-decoration: underline; }
@media (min-width: 1024px) {
  .sidebar { transform: none; }
  .main { margin-left: var(--sidebar-w); }
  .topbar .menu-btn, .scrim { display: none !important; }
  .page { padding: 1.6rem 28px 4rem; }
}

/* ---------- cartoes, grades ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.05rem 1.15rem; margin-bottom: 1rem; box-shadow: var(--shadow-sm); }
.card > h2:first-child, .card > h3:first-child { margin-bottom: .6rem; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .7rem; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: .5rem; }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.card:hover { border-color: var(--g500); box-shadow: var(--shadow-md); }
.grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .grid.c2 { grid-template-columns: repeat(2, 1fr); } .grid.c3 { grid-template-columns: repeat(3, 1fr); } .grid.c4 { grid-template-columns: repeat(4, 1fr); } .grid.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; } .row.between { justify-content: space-between; } .row.end { justify-content: flex-end; }
.stack > * + * { margin-top: .65rem; }

/* ---------- botoes ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px; padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .93rem; text-decoration: none; cursor: pointer; touch-action: manipulation; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: var(--surface-2); border-color: var(--text-3); } .btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; } .btn-danger:hover { filter: brightness(.92); background: var(--bad); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; } .btn-ok:hover { filter: brightness(.92); background: var(--ok); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); } .btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-sm { min-height: 34px; padding: .25rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn-lg { min-height: 54px; font-size: 1.05rem; border-radius: 12px; }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 50%, transparent); outline-offset: 2px; }

/* ---------- formularios ---------- */
.field { margin-bottom: 1rem; } .field.compact { margin-bottom: .5rem; }
.field > label, .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.req { color: var(--bad); font-weight: 700; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=month], input[type=search], input[type=file], input[type=tel], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .8rem; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; transition: border-color .12s, box-shadow .12s; }
input:hover, select:hover, textarea:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
input[type=file] { padding: .4rem; background: var(--surface-2); }
textarea { min-height: 96px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d8c82' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2.2rem; }
.check { display: flex; align-items: center; gap: .6rem; min-height: 42px; cursor: pointer; }
.check input { width: 20px; height: 20px; flex: none; accent-color: var(--primary); }
.help { font-size: .82rem; color: var(--text-2); margin-top: .3rem; } .err { color: var(--bad); font-size: .85rem; margin-top: .3rem; font-weight: 500; }
.form-grid { display: grid; gap: 0 1.2rem; } @media (min-width: 760px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span2 { grid-column: 1 / -1; } }
.form-section { margin: 1.3rem 0 .7rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.form-section:first-child { margin-top: 0; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .9rem; align-items: center; }
.filters > * { flex: 1 1 160px; min-width: 0; } .filters .btn { flex: 0 0 auto; } .filters .grow { flex: 3 1 240px; }
.searchbox { position: relative; } .searchbox .i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--text-3); } .searchbox input { padding-left: 2.4rem; }
.pin-input { text-align: center; letter-spacing: .5em; font-size: 1.7rem; font-variant-numeric: tabular-nums; }

/* ---------- avisos, selos ---------- */
.alert { display: flex; gap: .7rem; padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); background: var(--info-bg); color: var(--text); }
.alert > .i { margin-top: .15rem; color: var(--info); } .alert.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); } .alert.ok > .i { color: var(--ok); }
.alert.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 40%, transparent); } .alert.warn > .i { color: var(--warn); }
.alert.bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 40%, transparent); } .alert.bad > .i { color: var(--bad); }
.alert ul { margin: .25rem 0 0 1.1rem; padding: 0; } .alert .body { flex: 1; min-width: 0; }
.help-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .15rem .9rem; margin-bottom: 1rem; }
.help-box summary { cursor: pointer; padding: .6rem 0; font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .5rem; color: var(--text-2); list-style: none; }
.help-box summary::-webkit-details-marker { display: none; }
.help-box[open] summary { color: var(--text); } .help-box .body { padding: 0 0 .8rem; font-size: .9rem; color: var(--text-2); } .help-box ol, .help-box ul { margin: .3rem 0 0 1.2rem; padding: 0; } .help-box li { margin: .2rem 0; }
.secret { font: 700 1.5rem/1.2 ui-monospace, Consolas, monospace; letter-spacing: .08em; padding: .7rem; margin: .5rem 0; background: var(--surface); border: 2px dashed var(--primary); border-radius: 10px; text-align: center; user-select: all; word-break: break-all; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .6rem; border-radius: 99px; font-size: .76rem; font-weight: 650; background: var(--primary-bg); color: var(--primary-d); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); } .badge.gray { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .4rem; background: var(--text-3); } .dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.toasts { position: fixed; top: 66px; right: 14px; z-index: 90; display: grid; gap: .5rem; width: min(380px, calc(100vw - 28px)); }
.toast { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem .9rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ok); box-shadow: var(--shadow-md); animation: slidein .25s ease; }
.toast.info { border-left-color: var(--info); } .toast.bad { border-left-color: var(--bad); } .toast .x { margin-left: auto; background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0 .2rem; }
@keyframes slidein { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--text-2); } .empty .i { color: var(--text-3); margin-bottom: .5rem; } .empty h3 { color: var(--text); margin-bottom: .3rem; } .empty .btn { margin-top: .6rem; }

/* ---------- tabelas ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--surface-2); color: var(--text-2); font-size: .73rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; white-space: nowrap; }
tbody tr:hover td { background: color-mix(in srgb, var(--primary-bg) 55%, transparent); } tr:last-child td { border-bottom: 0; }
td.actions { white-space: nowrap; text-align: right; } td .sub { display: block; color: var(--text-2); font-size: .8rem; }
.pager { display: flex; gap: .4rem; justify-content: center; align-items: center; margin: 1.1rem 0; flex-wrap: wrap; }
.pager a, .pager span { padding: .4rem .85rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-size: .88rem; } .pager .current { background: var(--primary); color: #fff; border-color: var(--primary); }
@media (max-width: 719px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: .6rem .8rem; border-bottom: 1px solid var(--line); } table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: .22rem 0; display: flex; gap: .6rem; justify-content: space-between; text-align: right; }
  table.stack td::before { content: attr(data-label); color: var(--text-3); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; text-align: left; flex: none; padding-top: .15rem; }
  table.stack td.actions, table.stack td.first { justify-content: flex-start; text-align: left; } table.stack td.first::before, table.stack td.actions::before { display: none; }
  table.stack td.first { font-size: 1rem; }
}

/* ---------- indicadores ---------- */
.kpi { border-left: 5px solid var(--line-2); margin-bottom: 0; } .kpi.ok { border-left-color: var(--ok); } .kpi.warn { border-left-color: var(--warn); } .kpi.bad { border-left-color: var(--bad); }
.kpi .v { font-size: 1.75rem; font-weight: 750; line-height: 1.1; margin: .15rem 0; letter-spacing: -.02em; } .kpi .l { font-weight: 600; font-size: .9rem; color: var(--text-2); } .kpi a { color: inherit; text-decoration: none; display: block; }
.stat { display: flex; align-items: center; gap: .9rem; } .stat .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-bg); color: var(--primary-d); flex: none; }
.stat .ico.warn { background: var(--warn-bg); color: var(--warn); } .stat .ico.bad { background: var(--bad-bg); color: var(--bad); } .stat .ico.info { background: var(--info-bg); color: var(--info); }
.stat .n { font-size: 1.6rem; font-weight: 750; line-height: 1; } .stat .t { color: var(--text-2); font-size: .85rem; }
.sec-title { display: flex; align-items: center; gap: .6rem; margin: 1.6rem 0 .7rem; } .sec-title .goal { background: var(--primary); color: #fff; border-radius: 7px; padding: .12rem .6rem; font-size: .74rem; font-weight: 700; }
.list-links a { display: flex; align-items: center; gap: .7rem; padding: .65rem .2rem; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; } .list-links a:last-child { border-bottom: 0; } .list-links a:hover { color: var(--primary-d); }
.list-links .i.go { margin-left: auto; color: var(--text-3); }
.shortcut { display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; } .shortcut .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-bg); color: var(--primary-d); flex: none; } .shortcut strong { display: block; } .shortcut span.s { color: var(--text-2); font-size: .82rem; }

/* ---------- chips, segmentados, plantao ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; min-height: 46px; padding: .35rem .95rem; border-radius: 99px; border: 2px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation; transition: border-color .12s, background .12s; }
.chip:hover { border-color: var(--text-3); } .chip.on { background: var(--primary-bg); border-color: var(--primary); color: var(--primary-d); }
.child-chip { border-radius: 14px; justify-content: space-between; min-width: 47%; } @media (min-width: 560px) { .child-chip { min-width: 0; } }
.child-chip .st { font-size: .7rem; font-weight: 700; padding: .05rem .5rem; border-radius: 99px; background: var(--ok-bg); color: var(--ok); }
.child-chip.st-presente { border-color: color-mix(in srgb, var(--ok) 55%, var(--line-2)); } .child-chip.st-evadido { border-color: var(--bad); background: var(--bad-bg); } .child-chip.st-evadido .st { background: var(--bad); color: #fff; }
.child-chip.st-saida_autorizada { border-color: var(--warn); background: var(--warn-bg); } .child-chip.st-saida_autorizada .st { background: var(--warn); color: #fff; }
.child-chip.st-hospital, .child-chip.st-outro { border-color: var(--info); background: var(--info-bg); } .child-chip.st-hospital .st, .child-chip.st-outro .st { background: var(--info); color: #fff; }
.seg { display: flex; border: 2px solid var(--line-2); border-radius: 12px; overflow: hidden; } .seg button { flex: 1; min-height: 46px; border: 0; border-right: 1px solid var(--line); background: var(--surface); color: var(--text-2); font: inherit; font-weight: 600; cursor: pointer; } .seg button:last-child { border-right: 0; }
.seg button.on { background: var(--primary); color: #fff; } .seg button.on.parcial { background: var(--warn); } .seg button.on.nao { background: var(--bad); } .seg button.on.na { background: var(--text-3); }
.seg.med button.on.administrada { background: var(--ok); } .seg.med button.on.recusada { background: var(--warn); } .seg.med button.on.nao_administrada { background: var(--bad); }
.rt-row { display: grid; gap: .4rem; padding: .65rem 0; border-bottom: 1px solid var(--line); } .rt-row:last-child { border-bottom: 0; }
.cls { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; } .cls.two { grid-template-columns: repeat(2, 1fr); } .cls.two .chip { justify-content: center; min-height: 64px; font-size: 1.02rem; }
.cls button { min-height: 80px; border-radius: 14px; border: 3px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; } .cls button .e { display: block; font-size: 1.7rem; }
.cls button.on.tranquilo { border-color: var(--ok); background: var(--ok-bg); } .cls button.on.atencao { border-color: var(--warn); background: var(--warn-bg); } .cls button.on.critico { border-color: var(--bad); background: var(--bad-bg); }
.tl { list-style: none; margin: 0; padding: 0; } .tl li { display: flex; gap: .7rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); align-items: flex-start; } .tl .t { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 3.2rem; color: var(--primary-d); } .tl .x { margin-left: auto; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin: .5rem 0; } @media (min-width: 560px) { .quick { grid-template-columns: repeat(3, 1fr); } } .quick .btn { justify-content: flex-start; text-align: left; }
.sticky-submit { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--line); padding: .65rem 16px calc(.65rem + env(safe-area-inset-bottom)); display: flex; gap: .6rem; align-items: center; box-shadow: 0 -4px 14px rgba(0, 0, 0, .06); }
@media (min-width: 1024px) { .sticky-submit { left: var(--sidebar-w); } }
.sticky-submit .info { flex: 1; font-size: .85rem; color: var(--text-2); }
.savestate { font-size: .82rem; color: var(--text-2); margin-bottom: .6rem; } .savestate.err { color: var(--bad); font-weight: 700; }
.summary { display: flex; gap: .45rem; flex-wrap: wrap; } .summary .badge { font-size: .82rem; padding: .22rem .7rem; }
.sheet h2 { display: flex; align-items: center; gap: .55rem; margin-bottom: .3rem; } .sheet .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .8rem; font-weight: 700; flex: none; }
dialog { border: 0; border-radius: 16px; padding: 1.2rem; width: min(94vw, 460px); background: var(--surface); color: var(--text); box-shadow: 0 16px 48px rgba(0, 0, 0, .35); } dialog::backdrop { background: rgba(15, 25, 18, .55); }
dialog .opts { display: grid; gap: .5rem; margin: .9rem 0; } dialog h2 { margin-bottom: .4rem; }
.photo-prev { max-width: 100%; border-radius: 10px; } .med-row { padding: .75rem 0; border-bottom: 1px solid var(--line); } .med-row:last-child { border-bottom: 0; } .med-row .who { font-weight: 650; } .med-row .photo-state { font-size: .85rem; } .ok-text { color: var(--ok); font-weight: 700; }
.wrap-pre { white-space: pre-wrap; word-break: break-word; font: inherit; background: var(--surface-2); padding: .9rem; border-radius: 10px; border: 1px solid var(--line); }

/* ---------- demandas ---------- */
.thread { display: grid; gap: .9rem; } .msg { display: flex; gap: .7rem; } .msg .bubble { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: .7rem .9rem; }
.msg.mine .bubble { background: var(--primary-bg); border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); }
.msg .meta { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; font-size: .82rem; color: var(--text-2); margin-bottom: .25rem; } .msg .meta strong { color: var(--text); }
.msg .text { white-space: pre-wrap; word-break: break-word; }
.sys { display: flex; gap: .6rem; align-items: center; font-size: .84rem; color: var(--text-2); padding-left: .2rem; } .sys .i { color: var(--text-3); } .sys .when { margin-left: auto; font-size: .76rem; color: var(--text-3); white-space: nowrap; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: .55rem .8rem; font-size: .9rem; } .kv dt { color: var(--text-3); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; padding-top: .15rem; } .kv dd { margin: 0; min-width: 0; word-break: break-word; }
.prio-urgente { border-left-color: var(--bad) !important; } .prio-alta { border-left-color: var(--warn) !important; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; } .tabs a { padding: .6rem .95rem; text-decoration: none; color: var(--text-2); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; display: flex; gap: .45rem; align-items: center; } .tabs a.active { color: var(--primary-d); border-bottom-color: var(--primary); } .tabs .badge { font-size: .7rem; }

/* ---------- barra inferior (educadores) ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; display: grid; justify-items: center; gap: .1rem; padding: .5rem .2rem; font-size: .72rem; color: var(--text-2); text-decoration: none; min-height: 58px; position: relative; } .tabbar a.active { color: var(--primary-d); font-weight: 700; } .tabbar .i { width: 1.45rem; height: 1.45rem; }
.tabbar .dot-count { position: absolute; top: 4px; left: calc(50% + 8px); background: var(--bad); color: #fff; font-size: .64rem; font-weight: 700; border-radius: 99px; padding: 0 .32rem; line-height: 1.05rem; }
body.has-tabbar .sticky-submit { bottom: calc(58px + env(safe-area-inset-bottom)); padding-bottom: .65rem; } body.has-tabbar .page { padding-bottom: 9.5rem; }
body.has-tabbar .main { margin-left: 0; } body.has-tabbar .sidebar { display: none; } body.has-tabbar .sticky-submit { left: 0; }

/* ---------- login ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(1200px 500px at 50% -10%, var(--g100), transparent), var(--bg); }
.auth .card { width: min(100%, 420px); padding: 1.6rem; box-shadow: var(--shadow-md); } .auth img.logo { display: block; max-width: 230px; max-height: 96px; margin: 0 auto 1.1rem; object-fit: contain; }
.auth h1 { text-align: center; font-size: 1.35rem; margin-bottom: .5rem; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; margin: 1rem 0; } .pinpad button { min-height: 62px; font-size: 1.45rem; font-weight: 650; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); cursor: pointer; } .pinpad button:active { background: var(--primary-bg); }
.pinpad button.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.dots { display: flex; gap: .75rem; justify-content: center; margin: .6rem 0; } .dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--primary); } .dots i.f { background: var(--primary); }
.qr svg { max-width: 220px; height: auto; background: #fff; padding: 6px; border-radius: 10px; }
.report-logo { height: 58px; width: auto; }

/* ---------- impressao ---------- */
@media print {
  .sidebar, .topbar, .tabbar, .no-print, .sticky-submit, .btn, .toasts, .scrim { display: none !important; }
  .main { margin-left: 0 !important; } body { background: #fff; color: #000; font-size: 12px; }
  .page, .container { padding: 0; max-width: none; } .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; } .kpi { break-inside: avoid; }
}

/* ---------- menu do usuario, utilidades ---------- */
.usermenu { position: relative; } .usermenu summary { list-style: none; cursor: pointer; } .usermenu summary::-webkit-details-marker { display: none; }
.usermenu .panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-md); padding: .4rem; z-index: 60; }
.usermenu .panel .who { padding: .5rem .6rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; display: grid; }
.usermenu .panel a, .usermenu .panel button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .6rem; border: 0; background: none; border-radius: 8px; color: var(--text); font: inherit; text-decoration: none; cursor: pointer; text-align: left; }
.usermenu .panel a:hover, .usermenu .panel button:hover { background: var(--surface-2); }
@media (max-width: 560px) { .hide-sm { display: none; } }
.viewer img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto .8rem; border-radius: 10px; }
#viewer-dlg { width: min(96vw, 760px); }
.inline-form { display: inline; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; } .dl dt { color: var(--text-3); font-size: .8rem; } .dl dd { margin: 0; }
.text-bad { color: var(--bad); }
.supplier-box .row { gap: .5rem; flex-wrap: nowrap; } .supplier-box .row input { flex: 1; min-width: 0; }
.supplier-card { margin-top: .5rem; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.supplier-card.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.supplier-card.warn { background: var(--warn-bg); } .supplier-card.bad { background: var(--bad-bg); color: var(--bad); }
.supplier-card.hidden { display: none; }
.danger-zone { box-shadow: 0 0 0 2px var(--bad); }
.list-row { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.env-banner { position: sticky; top: 0; z-index: 60; background: #e8590c; color: #fff; text-align: center; font-weight: 700; font-size: .85rem; padding: .35rem .8rem; letter-spacing: .02em; }
.kpi-big { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin: .3rem 0; }
.demand-call { padding: 1.1rem 1.3rem; font-size: 1rem; }
.demand-call ul { list-style: none; margin: .5rem 0 0; padding: 0; } .demand-call li { padding: .2rem 0; }
.mt { margin-top: 1rem; } .mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }

/* ---------- complementos de telas ---------- */
.grow-input { flex: 1; min-width: 0; } .block { display: block; }
.flush-accent { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.list-links a.pad { padding: .85rem 1rem; }
.list-links-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; } .list-links-row:last-child { border-bottom: 0; } .list-links-row:hover strong { color: var(--primary-d); }
.alert-line { display: flex; align-items: flex-start; gap: .3rem; padding: .4rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; } .alert-line:last-child { border-bottom: 0; } .alert-line .dot { margin-top: .4rem; flex: none; }
details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; } details > summary::-webkit-details-marker { display: none; }
.card .shortcut, a.card.shortcut { margin-bottom: 0; }
a.card.stat { color: inherit; }
/* ---------- mostrar/ocultar senha ---------- */
.pw-wrap { position: relative; } .pw-wrap > input { padding-right: 3rem; }
.pw-toggle { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; }
.pw-toggle:hover { background: var(--surface-2); color: var(--text); } .pw-toggle[aria-pressed=true] { color: var(--primary-d); }
/* ==========================================================================
   Acabamento "painel profissional" (referencia enviada pelo cliente):
   cartoes grandes e arredondados sem borda, menu lateral branco com destaque
   no item ativo, indicadores com numero grande e icone colorido.
   ========================================================================== */
:root { --bg: #f3f5f8; --radius: 20px; --radius-sm: 12px; --shadow-sm: 0 1px 2px rgba(16, 32, 24, .04); --shadow-md: 0 8px 24px rgba(16, 32, 24, .08); }
.card { border: 0; padding: 1.3rem 1.4rem; box-shadow: 0 1px 2px rgba(16, 32, 24, .04), 0 0 0 1px color-mix(in srgb, var(--line) 55%, transparent); }
a.card:hover { box-shadow: var(--shadow-md); border: 0; }
.card-head h2 { font-size: 1.2rem; font-weight: 700; }
.topbar { background: transparent; backdrop-filter: none; border-bottom: 0; height: 64px; }
.sidebar { border-right: 0; box-shadow: 1px 0 0 var(--line); }
.sb-brand { justify-content: center; padding: 1.4rem 1rem 1.1rem; border-bottom: 0; }
.sb-brand img { height: 64px; max-width: 200px; }
.sb-nav { padding: .4rem 0 1rem; }
.sb-nav a, .sb-nav summary { margin: 2px 0; padding: .8rem 1.2rem; border-radius: 0; font-size: .95rem; gap: .85rem; position: relative; }
.sb-nav a.active { background: var(--primary-bg); color: var(--primary-d); }
.sb-nav a.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); border-radius: 0 4px 4px 0; }
.sb-title { margin: 1.2rem 1.2rem .3rem; }
.sb-nav details > div { margin-left: 2.2rem; padding-left: 0; border-left: 0; }
.sb-nav details > div a { padding: .55rem 1rem; font-size: .9rem; }
.sb-foot { border-top: 0; padding: 1rem 1.2rem; }
.page-head h1 { font-size: 1.7rem; letter-spacing: -.02em; }
.userchip { border: 0; background: transparent; padding: .2rem .2rem .2rem .2rem; }
.avatar { background: var(--primary-bg); color: var(--primary-d); }
.kpi-card { position: relative; padding: 1.3rem 1.4rem 1.1rem; margin-bottom: 0; }
.kpi-card .n { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.kpi-card .n small { font-size: 1rem; color: var(--text-3); font-weight: 600; }
.kpi-card .t { color: var(--text); font-weight: 500; margin-top: .2rem; }
.kpi-card .trend { margin-top: .8rem; font-size: .8rem; color: var(--text-2); display: flex; align-items: center; gap: .35rem; } .kpi-card .trend.up { color: var(--ok); } .kpi-card .trend.down { color: var(--bad); }
.kpi-card .ico { position: absolute; right: 1.1rem; top: 1.1rem; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: #fdeccd; color: #d98a14; }
.kpi-card .ico.green { background: #dcf3e1; color: #2a9248; } .kpi-card .ico.blue { background: #dcebfb; color: #2b73c9; } .kpi-card .ico.purple { background: #efe2fb; color: #8a3fd0; } .kpi-card .ico.red { background: #fde3df; color: #d4402f; }
a.kpi-card { color: inherit; text-decoration: none; }
.table-wrap { border: 0; border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16, 32, 24, .04), 0 0 0 1px color-mix(in srgb, var(--line) 55%, transparent); }
th { background: transparent; color: var(--text); text-transform: none; letter-spacing: 0; font-size: .82rem; font-weight: 700; border-bottom: 1px solid var(--line); padding: .9rem .9rem; }
td { padding: .85rem .9rem; border-bottom: 1px solid var(--line); } tbody tr:hover td { background: var(--surface-2); }
.donut-wrap { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; flex-wrap: wrap; }
.donut { width: 170px; height: 170px; flex: none; } .donut circle { fill: none; stroke-width: 26; } .donut .bg { stroke: var(--surface-2); }
.donut .s-ok { stroke: var(--ok); } .donut .s-warn { stroke: #f0972b; } .donut .s-bad { stroke: #e5474b; } .donut .s-info { stroke: var(--info); } .donut .s-gray { stroke: var(--text-3); }
.legend { display: grid; gap: .55rem; } .legend .li { display: flex; align-items: center; gap: .7rem; } .legend .bar { width: 6px; height: 24px; border-radius: 3px; background: var(--text-3); }
.legend .bar.ok { background: var(--ok); } .legend .bar.warn { background: #f0972b; } .legend .bar.bad { background: #e5474b; } .legend .bar.info { background: var(--info); }
.legend strong { font-size: 1.15rem; } .legend span.l { color: var(--text-2); font-size: .85rem; }
.mini-table { width: 100%; font-size: .9rem; } .mini-table th { font-size: .78rem; padding: .5rem .4rem; border-bottom: 1px solid var(--line); } .mini-table td { padding: .7rem .4rem; }
.mini-table .pend { color: #e08a12; } .mini-table .done { color: var(--ok); }
.foot { text-align: center; color: var(--text-3); font-size: .78rem; padding: 2rem 0 0; }
.topbar .report-logo { height: 40px; }
@media (max-width: 719px) { table.stack td.first { display: block; text-align: left; } table.stack td.first .sub { margin-top: .15rem; } }
