/* Layout: barra lateral marinho fixa + área de trabalho clara com cartões; tabelas densas com chips de situação. */
:root {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --line: #e2e7ef;
  --line-strong: #cfd7e3;
  --text: #121b2d;
  --muted: #5d6a80;
  --faint: #8a95a8;
  --primary: #1d57d0;
  --primary-hover: #1749b3;
  --primary-ink: #ffffff;
  --primary-soft: #e9effc;
  --focus: rgba(29, 87, 208, .35);

  --side: #0e1c38;
  --side-2: #172a50;
  --side-line: rgba(255,255,255,.08);
  --side-text: #c5d0e4;
  --side-muted: #8796b3;

  --crit: #cf3434; --crit-soft: #fdeaea; --crit-ink: #a42424;
  --warn: #c27100; --warn-soft: #fff2db; --warn-ink: #8f5300;
  --ok: #1b8549;   --ok-soft: #e2f4e9;   --ok-ink: #146a39;
  --calm: #2c62c4; --calm-soft: #e8effc; --calm-ink: #1f4c9e;
  --rev: #a1328f;  --rev-soft: #f8e7f5;  --rev-ink: #7e2370;
  --gray-soft: #edf0f4; --gray-ink: #5d6a80;

  --shadow: 0 1px 2px rgba(18,27,45,.05), 0 6px 18px rgba(18,27,45,.05);
  --shadow-lg: 0 18px 50px rgba(10,20,40,.22);
  --radius: 10px;
  --radius-sm: 7px;

  --font: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1424; --surface: #141d31; --surface-2: #18233a; --line: #243150; --line-strong: #31406a;
    --text: #e7ecf5; --muted: #9eabc4; --faint: #7381a0;
    --primary: #4f86f0; --primary-hover: #6797f4; --primary-ink: #ffffff; --primary-soft: #1b2b4f; --focus: rgba(79,134,240,.45);
    --side: #0a1222; --side-2: #15223f; --side-line: rgba(255,255,255,.07); --side-text: #c5d0e4; --side-muted: #7f8eac;
    --crit: #f06464; --crit-soft: #3a1a20; --crit-ink: #ff9a9a;
    --warn: #e9a03b; --warn-soft: #3a2a12; --warn-ink: #f6c27a;
    --ok: #41b875;   --ok-soft: #13301f;   --ok-ink: #86dca9;
    --calm: #6b9bf2; --calm-soft: #1a2a4c; --calm-ink: #a9c4fa;
    --rev: #d769c5;  --rev-soft: #351a33;  --rev-ink: #f0a6e4;
    --gray-soft: #1f2a42; --gray-ink: #a3afc6;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.2);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1424; --surface: #141d31; --surface-2: #18233a; --line: #243150; --line-strong: #31406a;
  --text: #e7ecf5; --muted: #9eabc4; --faint: #7381a0;
  --primary: #4f86f0; --primary-hover: #6797f4; --primary-ink: #ffffff; --primary-soft: #1b2b4f; --focus: rgba(79,134,240,.45);
  --side: #0a1222; --side-2: #15223f; --side-line: rgba(255,255,255,.07); --side-text: #c5d0e4; --side-muted: #7f8eac;
  --crit: #f06464; --crit-soft: #3a1a20; --crit-ink: #ff9a9a;
  --warn: #e9a03b; --warn-soft: #3a2a12; --warn-ink: #f6c27a;
  --ok: #41b875;   --ok-soft: #13301f;   --ok-ink: #86dca9;
  --calm: #6b9bf2; --calm-soft: #1a2a4c; --calm-ink: #a9c4fa;
  --rev: #d769c5;  --rev-soft: #351a33;  --rev-ink: #f0a6e4;
  --gray-soft: #1f2a42; --gray-ink: #a3afc6;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.2);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }

/* ---------- Login ---------- */
/* Cores do selo do escritório: marinho e areia */
:root { --marca: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='74 76 166 158'%3E%3Cpath d='M 85.9 227.7 L 81 224.9 L 153 96.7 L 208.5 190.8 L 117.6 190.8 L 117.6 185.1 L 198.5 185.1 L 153.1 108.1 Z M 85.9 227.7 M 233.8 212 L 100.8 212 L 151.5 121.9 L 156.4 124.7 L 110.6 206.3 L 223.9 206.3 L 152.4 85.2 L 157.3 82.3 Z M 233.8 212'/%3E%3C/svg%3E"); --pa-navy: #0F2B50; --pa-navy-2: #0A1F3C; --pa-sand: #CFB896; --pa-sand-2: #E6D9C3; --pa-paper: #FBFAF8; }
.auth {
  min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.auth-brand {
  background: radial-gradient(120% 90% at 18% 22%, #143562 0%, var(--pa-navy) 46%, var(--pa-navy-2) 100%);
  color: var(--pa-sand-2); display: flex; flex-direction: column; justify-content: center; gap: 40px;
  padding: 56px clamp(32px, 6vw, 88px); position: relative; overflow: hidden; isolation: isolate;
}
/* o triângulo do selo, ampliado e quase invisível, atravessando o painel */
.auth-brand::before {
  content: ""; position: absolute; z-index: -1; right: -18%; bottom: -26%; width: 78%; aspect-ratio: 166 / 158;
  background: var(--pa-sand); opacity: .045;
  -webkit-mask: var(--marca) center / contain no-repeat; mask: var(--marca) center / contain no-repeat;
}
.auth-selo { width: clamp(150px, 17vw, 220px); height: auto; color: var(--pa-sand); flex: none; }
.auth-titulo h1 {
  font-family: "Zilla Slab", Georgia, serif; font-weight: 500; color: #fff;
  font-size: clamp(34px, 3.6vw, 50px); line-height: 1.04; letter-spacing: -.005em; margin: 0;
}
.auth-titulo p {
  color: var(--pa-sand-2); opacity: .86; max-width: 36ch; margin: 18px 0 0; font-size: 15.5px; line-height: 1.6;
  padding-top: 18px; border-top: 1px solid rgba(207,184,150,.32);
}
.auth-rodape { color: var(--pa-sand); opacity: .62; font-size: 12.5px; position: absolute; left: clamp(32px, 6vw, 88px); bottom: 28px; }
.auth-form {
  display: grid; place-items: center; background: var(--pa-paper);
  padding-block: 40px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.auth-form form, .auth-form > div { width: min(380px, 100%); display: grid; gap: 16px; }
.auth-form h2 { font-family: "Zilla Slab", Georgia, serif; font-weight: 500; font-size: 30px; letter-spacing: 0; color: var(--pa-navy); }
.auth-form .btn.primary { background: var(--pa-navy); border-color: var(--pa-navy); color: #fff; height: 44px; }
.auth-form .btn.primary:hover { background: #163a69; border-color: #163a69; }
.auth-form .link-btn { color: var(--pa-navy); }
.auth-form .input:focus { border-color: var(--pa-navy); box-shadow: 0 0 0 3px rgba(15,43,80,.18); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-form { background: var(--bg); }
  :root:not([data-theme="light"]) .auth-form h2 { color: var(--pa-sand-2); }
  :root:not([data-theme="light"]) .auth-form .btn.primary { background: var(--pa-sand); border-color: var(--pa-sand); color: var(--pa-navy-2); }
  :root:not([data-theme="light"]) .auth-form .link-btn { color: var(--pa-sand); }
}
:root[data-theme="dark"] .auth-form { background: var(--bg); }
:root[data-theme="dark"] .auth-form h2 { color: var(--pa-sand-2); }
:root[data-theme="dark"] .auth-form .btn.primary { background: var(--pa-sand); border-color: var(--pa-sand); color: var(--pa-navy-2); }
:root[data-theme="dark"] .auth-form .link-btn { color: var(--pa-sand); }

/* Campo de senha com botão de mostrar */
.pw { position: relative; display: block; }
.pw .input { width: 100%; padding-right: 44px; }
.pw-ver {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 36px; height: 34px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer;
}
.pw-ver:hover { color: var(--text); background: var(--surface-2); }
.pw-ver:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Marca na barra lateral */
.marca { width: 36px; height: 36px; border-radius: 9px; background: var(--pa-navy); border: 1px solid rgba(207,184,150,.35); display: grid; place-items: center; color: var(--pa-sand); flex: none; }
.marca svg { width: 22px; height: 22px; }
.demo-box { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; background: var(--surface); }
.demo-box .btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; background: linear-gradient(to right, var(--side) 248px, transparent 248px); }
.compact .tbl th, .compact .tbl td { padding-left: 9px; padding-right: 9px; }
.side {
  background: var(--side); color: var(--side-text); position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; padding: 18px 12px; padding-left: max(12px, env(safe-area-inset-left, 0px));
  z-index: 30;
}
.side .logo { display: flex; align-items: center; gap: 11px; padding: 6px 10px 20px; color: #fff; }
.side .logo b { display: block; font-size: 15px; line-height: 1.2; }
.side .logo small { display: block; color: var(--side-muted); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; }
.side nav { display: grid; gap: 2px; }
.side .grp { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--side-muted); padding: 16px 12px 6px; }
.side a.nav {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; text-decoration: none;
  color: var(--side-text); font-weight: 500; position: relative;
}
.side a.nav:hover { background: var(--side-2); color: #fff; }
.side a.nav.on { background: var(--primary); color: #fff; }
.side a.nav .count {
  margin-left: auto; background: var(--crit); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px;
  padding: 1px 7px; font-variant-numeric: tabular-nums;
}
.side .foot { margin-top: auto; border-top: 1px solid var(--side-line); padding: 14px 10px 4px; display: grid; gap: 10px; }
.side .me { display: flex; align-items: center; gap: 10px; }
.side .me b { color: #fff; font-size: 13px; display: block; line-height: 1.2; }
.side .me small { color: var(--side-muted); font-size: 12px; }
.side .sair { background: none; border: 1px solid var(--side-line); color: var(--side-text); border-radius: 8px; padding: 7px 10px; cursor: pointer; display: flex; align-items: center; gap: 8px; justify-content: center; }
.side .sair:hover { background: var(--side-2); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; height: 62px;
  padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 40; background: var(--surface); }
.top .menu { display: none; }
.search { flex: 1; max-width: 520px; position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { width: 100%; height: 38px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 0 12px 0 38px; }
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); background: var(--surface); }
.top .hoje { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.top .hoje b { color: var(--text); font-weight: 600; }
.demo-flag { background: var(--warn-soft); color: var(--warn-ink); border-radius: 99px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; white-space: nowrap; letter-spacing: .02em; }

.page {
  padding-block: 26px 48px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
  display: grid; gap: 20px; align-content: start; max-width: 1480px; width: 100%;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; letter-spacing: -.015em; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; }
.card-h h2 { font-size: 15px; font-weight: 700; }
.card-h .link { font-size: 13px; font-weight: 600; text-decoration: none; background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0; }
.card-b { padding: 0 18px 18px; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; text-align: left;
  cursor: pointer; transition: border-color .15s, transform .15s;
}
.kpi:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.kpi .ic { grid-row: span 2; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; }
.kpi .v { font-size: 26px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi.crit .ic { background: var(--crit-soft); color: var(--crit); } .kpi.crit .v { color: var(--crit); }
.kpi.warn .ic { background: var(--warn-soft); color: var(--warn); } .kpi.warn .v { color: var(--warn); }
.kpi.rev .ic { background: var(--rev-soft); color: var(--rev); } .kpi.rev .v { color: var(--rev); }
.kpi.ok .ic { background: var(--ok-soft); color: var(--ok); } .kpi.ok .v { color: var(--ok); }
.kpi.calm .ic { background: var(--calm-soft); color: var(--calm); } .kpi.calm .v { color: var(--calm); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; min-width: 0; }

/* ---------- Tabelas ---------- */
.tbl-wrap { overflow-x: auto; position: relative; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .03em; text-transform: uppercase;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
.tbl th.sort { cursor: pointer; user-select: none; }
.tbl th.sort:hover { color: var(--text); }
.tbl th .arr { opacity: .5; margin-left: 3px; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl td.cli { font-weight: 600; white-space: nowrap; }
.tbl td.wrap { min-width: 180px; max-width: 280px; }
.tbl td.nowrap, .tbl th.nowrap { white-space: nowrap; }
.tbl tr.row-crit td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
.tbl tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.tbl tr.row-done td { color: var(--muted); }
.tbl .obs { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card > .tbl-wrap .tbl th:first-child, .card > .tbl-wrap .tbl td:first-child { padding-left: 18px; }
.card > .tbl-wrap .tbl th:last-child, .card > .tbl-wrap .tbl td:last-child { padding-right: 18px; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); display: grid; gap: 6px; justify-items: center; }
.empty b { color: var(--text); font-size: 14px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 3px 10px 3px 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.35;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip.nodot::before { display: none; }
.chip.nodot { padding-left: 10px; }
.chip.crit { background: var(--crit-soft); color: var(--crit-ink); }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.ok   { background: var(--ok-soft); color: var(--ok-ink); }
.chip.calm { background: var(--calm-soft); color: var(--calm-ink); }
.chip.rev  { background: var(--rev-soft); color: var(--rev-ink); }
.chip.gray { background: var(--gray-soft); color: var(--gray-ink); }
.date-crit { color: var(--crit-ink); font-weight: 700; }
.date-warn { color: var(--warn-ink); font-weight: 700; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none;
  background: var(--primary); color: #fff; letter-spacing: .02em;
}
.who { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.who .avatar { width: 24px; height: 24px; font-size: 10px; }

/* ---------- Botões e formulários ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.icon-btn.go { color: var(--ok); } .icon-btn.go:hover { background: var(--ok-soft); color: var(--ok-ink); }
.icon-btn.rv { color: var(--rev); } .icon-btn.rv:hover { background: var(--rev-soft); color: var(--rev-ink); }
.icon-btn.del:hover { background: var(--crit-soft); color: var(--crit-ink); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }

.field { display: grid; gap: 6px; min-width: 0; }
.field label, .lbl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field label .req { color: var(--crit); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); padding: 0 11px;
}
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.input.mono { font-family: var(--mono); font-size: 13px; }
.hint { font-size: 12px; color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span3 { grid-column: 1 / -1; }
.err { background: var(--crit-soft); color: var(--crit-ink); border-radius: 8px; padding: 10px 12px; font-size: 13px; font-weight: 500; }

.filters { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px 18px; align-items: end; }
.filters .more { grid-column: 1 / -1; display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.filters .more .field { width: 160px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 18px; border-bottom: 1px solid var(--line); }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 10px 9px; font-weight: 600; color: var(--muted); cursor: pointer;
  display: inline-flex; gap: 7px; align-items: center;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.tab .n { background: var(--gray-soft); color: var(--gray-ink); border-radius: 99px; font-size: 11.5px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.tab.on .n { background: var(--primary-soft); color: var(--primary); }
.tbl-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; flex-wrap: wrap; }

.switch { position: relative; width: 40px; height: 22px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; }

/* ---------- Carga por pessoa ---------- */
.load { display: grid; gap: 11px; }
.load .r { display: grid; grid-template-columns: 112px minmax(0, 1fr) 30px; gap: 10px; align-items: center; font-size: 13px; }
.load .r .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.load .bar { height: 10px; border-radius: 99px; background: var(--surface-2); display: flex; overflow: hidden; border: 1px solid var(--line); }
.load .bar i { display: block; height: 100%; }
.load .bar i.c { background: var(--crit); } .load .bar i.w { background: var(--warn); } .load .bar i.n { background: var(--calm); opacity: .7; }
.load .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(8,15,30,.5); z-index: 60; display: grid; place-items: center; animation: fade .15s ease;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(760px, 100%); max-height: 100%;
  display: flex; flex-direction: column; animation: rise .18s ease; border: 1px solid var(--line);
}
.modal.narrow { width: min(460px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 6px; }
.modal-h h2 { font-size: 18px; }
.modal-h p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-b { padding: 14px 22px; overflow-y: auto; display: grid; gap: 14px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.toasts { position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 80; }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 9px; box-shadow: var(--shadow-lg); font-weight: 500; font-size: 13.5px; max-width: 360px; animation: rise .2s ease; }
.toast.bad { background: var(--crit); color: #fff; }

.perm-tbl td:not(:first-child), .perm-tbl th:not(:first-child) { text-align: center; width: 120px; }
.perm-tbl td b { display: block; font-weight: 600; }
.perm-tbl td small { color: var(--muted); font-size: 12px; }
.lock { color: var(--faint); font-size: 12px; display: inline-flex; gap: 5px; align-items: center; }

.note { display: flex; gap: 10px; align-items: flex-start; background: var(--calm-soft); color: var(--calm-ink); padding: 12px 14px; border-radius: 9px; font-size: 13px; }

.loading { min-height: 100%; display: grid; place-items: center; color: var(--muted); }

/* ---------- Responsivo ---------- */
@media (max-width: 1250px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters .f-busca { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lg); padding-top: max(18px, env(safe-area-inset-top, 0px)); }
  .shell.open .side { transform: none; }
  .shell.open::after { content: ""; position: fixed; inset: 0; background: rgba(8,15,30,.45); z-index: 25; }
  .top .menu { display: inline-grid; }
  .top .hoje { display: none; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { padding: 36px 24px 32px; gap: 22px; align-items: flex-start; }
  .auth-selo { width: 112px; }
  .auth-titulo h1 { font-size: 30px; }
  .auth-titulo p { font-size: 14.5px; margin-top: 12px; padding-top: 12px; }
  .auth-rodape { display: none; }
  .auth-brand::before { width: 70%; right: -22%; bottom: -30%; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi:last-child { grid-column: 1 / -1; }
  .filters { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span2 { grid-column: auto; }
  .page-head h1 { font-size: 21px; }
  .top { gap: 10px; }
  .load .r { grid-template-columns: 90px minmax(0, 1fr) 26px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Andamento editável na tabela ---------- */
.st-sel {
  appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; font: inherit; font-size: 12px; font-weight: 600;
  padding: 4px 26px 4px 10px; cursor: pointer; line-height: 1.35; max-width: 150px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) 52%, calc(100% - 9px) 52%; background-size: 4px 4px; background-repeat: no-repeat;
}
.st-sel:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.st-sel.calm { background-color: var(--calm-soft); color: var(--calm-ink); }
.st-sel.warn { background-color: var(--warn-soft); color: var(--warn-ink); }
.st-sel.rev  { background-color: var(--rev-soft); color: var(--rev-ink); }
.st-sel.crit { background-color: var(--crit-soft); color: var(--crit-ink); }
.st-sel.ok   { background-color: var(--ok-soft); color: var(--ok-ink); }
.st-sel.gray { background-color: var(--gray-soft); color: var(--gray-ink); }
.st-sel option { background: var(--surface); color: var(--text); }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.side a.nav .count.warn { background: var(--warn); }

/* ---------- Drive ---------- */
.drv-conta { display: grid; gap: 12px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 18px 12px; font-size: 13px; }
.crumb { background: none; border: 0; padding: 2px 4px; border-radius: 5px; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; }
.crumb:hover { background: var(--primary-soft); }
.drv-item { display: inline-flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; font: inherit; color: var(--text); text-align: left; }
button.drv-item { cursor: pointer; font-weight: 600; }
button.drv-item:hover span { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.ficon { display: inline-grid; place-items: center; width: 22px; height: 18px; border-radius: 4px; background: var(--c); color: #fff; font-size: 8.5px; font-weight: 700; letter-spacing: .02em; flex: none; }

/* ---------- E-mail ---------- */
.mail { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); min-height: 560px; overflow: hidden; }
.mail-lista { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.mail-lista .search { max-width: none; flex: none; }
#mail-itens { overflow-y: auto; max-height: 640px; }
.mail-item { display: grid; gap: 2px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 11px 14px; cursor: pointer; font: inherit; color: var(--text); border-left: 3px solid transparent; }
.mail-item:hover { background: var(--surface-2); }
.mail-item.on { background: var(--primary-soft); border-left-color: var(--primary); }
.mail-item .l1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mail-item .de { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item .dt { font-size: 12px; color: var(--faint); white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; font-variant-numeric: tabular-nums; }
.mail-item .as { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item .rs { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item.nao-lido .de, .mail-item.nao-lido .as { font-weight: 700; }
.mail-leitura { min-width: 0; display: flex; flex-direction: column; }
.mail-cab { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.mail-cab h2 { font-size: 18px; }
.mail-voltar { display: none; justify-self: start; }
.mail-anexos { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.mail-corpo { flex: 1; width: 100%; min-height: 420px; border: 0; background: #fff; }
.mail-texto { margin: 0; padding: 18px 20px; white-space: pre-wrap; word-wrap: break-word; font: 14px/1.6 var(--font); color: var(--text); }
@media (max-width: 900px) {
  .mail { grid-template-columns: minmax(0, 1fr); }
  .mail-lista { border-right: 0; }
  .mail-leitura { display: none; }
  .mail-leitura.aberta { display: flex; position: fixed; inset: 0; z-index: 50; background: var(--surface); overflow-y: auto; padding-top: env(safe-area-inset-top, 0px); }
  .mail-voltar { display: inline-flex; }
}

.mail-filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 12px 4px; }
.mail-filtros .input { margin-top: 4px; min-width: 0; }
.mail-marc-on { display: flex; align-items: center; gap: 8px; margin: 8px 12px 0; padding: 8px 10px; border-radius: 8px; background: var(--primary-soft); font-size: 13px; }
.mail-marc-on span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.mail-tag { font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line, transparent); }

.who.plan { color: var(--muted); font-style: italic; }
.who.plan .avatar { background: transparent !important; color: var(--muted); border: 1px dashed var(--line-strong); }
.chip.plan { font-style: italic; border-style: dashed; }
