:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
  --ink: #172238;
  --page: #f6f8fc;
  --surface: #fff;
  --subtle: #eef2f8;
  --hover: #f2f5fc;
  --selected: #eaf0ff;
  --selected-line: #bacbff;
  --auth-glow: #e7eeff;
  --muted: #536178;
  --quiet: #46556c;
  --line: #e1e7f0;
  --soft-line: #eef1f6;
  --control-line: #ced8ec;
  --blue: #244cc9;
  --blue-hover: #1939a5;
  --accent: #1939a5;
  --eyebrow: #365597;
  --focus: #5679ed;
  --backdrop: #16264265;
  --blue-surface: #eaf2fe;
  --blue-ink: #235488;
  --purple-surface: #f3edfd;
  --purple-ink: #6638a0;
  --green-surface: #eaf5ee;
  --green-ink: #286044;
  --amber-surface: #fff4df;
  --amber-ink: #77521a;
  --red-surface: #fceef0;
  --red-ink: #a12e43;
  --rail: 228px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9eef7;
  --page: #10151f;
  --surface: #181f2c;
  --subtle: #252e3e;
  --hover: #212b3b;
  --selected: #243657;
  --selected-line: #48669b;
  --auth-glow: #202d48;
  --muted: #aab7cc;
  --quiet: #bdc9dc;
  --line: #303b4e;
  --soft-line: #2a3446;
  --control-line: #54627a;
  --blue: #365cd5;
  --blue-hover: #3153c2;
  --accent: #adc4ff;
  --eyebrow: #9eb7f6;
  --focus: #92b5ff;
  --backdrop: #050910b8;
  --blue-surface: #223650;
  --blue-ink: #b2d4ff;
  --purple-surface: #36294d;
  --purple-ink: #dfc6ff;
  --green-surface: #203a33;
  --green-ink: #a3e2c1;
  --amber-surface: #403420;
  --amber-ink: #f5d291;
  --red-surface: #482b38;
  --red-ink: #ffb8c7;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; }
button, select, summary { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
svg { width: 20px; height: 20px; display: block; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip { position: fixed; left: 1rem; top: -5rem; z-index: 4; padding: .7rem; background: var(--surface); }
.skip:focus { top: .75rem; }

.shell { min-height: 100dvh; }
.rail {
  width: var(--rail); background: var(--surface); border-right: 1px solid var(--line);
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column;
  padding: 26px 17px 21px; z-index: 1;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 1px 7px; text-decoration: none; }
.brand strong { display: block; font-size: 17px; letter-spacing: -.025em; line-height: 1.25; }
.brand small, .rail-bottom small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.rail-main { margin-top: 42px; }
.rail-label { margin: 0 0 12px 11px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.nav { display: grid; gap: 5px; }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 11px; color: var(--quiet); font-size: 14px; font-weight: 600; border-radius: 8px; text-decoration: none; }
.nav a:hover { background: var(--hover); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--selected); }
.rail-bottom { display: flex; align-items: flex-start; gap: 9px; margin-top: auto; border-top: 1px solid var(--line); padding: 17px 8px 1px; font-size: 13px; font-weight: 600; }
.local-dot { margin-top: 5px; width: 9px; height: 9px; background: #447765; border-radius: 50%; }
.account { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding: 10px 7px 0; border-top: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.account button { min-height: 38px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--accent); font-size: 13px; }
.account button:hover { background: var(--selected); }

.main { margin-left: var(--rail); padding: 38px clamp(22px, 4.2vw, 67px) 52px; max-width: 1510px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 28px; }
.header-actions { display: flex; flex: none; flex-wrap: wrap; gap: 8px; }
.eyebrow { color: var(--eyebrow); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; margin: 0 0 10px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(32px, 3.2vw, 47px); line-height: 1.03; letter-spacing: -.055em; }
.subtitle { margin-top: 10px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 15px; min-height: 44px; border: 1px solid transparent; border-radius: 8px; font-weight: 650; font-size: 14px; white-space: nowrap; }
.primary { background: var(--blue); color: white; box-shadow: 0 2px 4px #244cc927; }
.primary:hover:not(:disabled) { background: var(--blue-hover); }
.secondary { background: var(--surface); border-color: var(--control-line); color: var(--accent); }
.secondary:hover:not(:disabled) { background: var(--hover); }
.danger { background: #ad2c3e; color: white; }
.danger:hover { background: #8d2030; }

.area-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.area-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 41px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--quiet); font-size: 13px; font-weight: 650; }
.area-button svg { width: 16px; height: 16px; }
.area-button:hover { background: var(--hover); }
.area-button[aria-pressed="true"] { color: var(--accent); background: var(--selected); border-color: var(--selected-line); }
.area-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; }
.area-dot.b2med { background: #376cbd; }
.area-dot.lameiras { background: #8051be; }
.area-dot.pessoal { background: #31815f; }
.filter-bar { display: grid; grid-template-columns: minmax(165px, 1fr) minmax(130px, .32fr) minmax(130px, .32fr); gap: 10px; margin-bottom: 26px; }
.search { position: relative; min-width: 0; }
.search > span { position: absolute; top: 13px; left: 12px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 39px; }
.filter-select { position: relative; min-width: 0; }
.filter-select > span { position: absolute; left: 11px; top: 5px; color: var(--muted); font-size: 10px; font-weight: 650; pointer-events: none; }
.filter-select select { padding-top: 14px; }
input, select, textarea { display: block; width: 100%; min-width: 0; border: 1px solid var(--control-line); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 9px 10px; font-size: 15px; }
.filter-bar input, .filter-bar select { height: 45px; font-size: 13px; }
input::placeholder { color: var(--muted); }
textarea { resize: vertical; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 13px; }
.section-head h2 { font-size: 20px; letter-spacing: -.035em; }
.section-head p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.text-button { display: inline-flex; align-items: center; gap: 5px; min-height: 40px; color: var(--accent); font-size: 13px; font-weight: 650; white-space: nowrap; text-decoration: none; }
.text-button:hover { text-decoration: underline; }
.text-button svg { width: 16px; height: 16px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; align-items: start; }
.dashboard-grid > :last-child { grid-column: 1 / -1; }
.section-head + .daily-checks { margin-bottom: 13px; }
.recurring-tasks { margin-top: 13px; }
.recurring-tasks > summary { display: flex; align-items: center; gap: 10px; padding: 13px 15px; list-style: none; }
.recurring-tasks > summary::-webkit-details-marker { display: none; }
.recurring-tasks > summary strong { flex: 1; }
.recurring-tasks > summary svg { width: 16px; height: 16px; color: var(--muted); }
.recurring-tasks[open] > summary svg { transform: rotate(90deg); }
.routine-row { padding: 12px 15px; }
.check-entry { display: grid; gap: 10px; }
.missed-link { margin: 0 15px 6px; }
.missed-checks { border-top: 1px solid var(--line); }
.missed-checks > summary { padding: 13px 15px; color: var(--accent); font-size: 13px; font-weight: 650; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 1px 2px #17223807; }
.card-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 15px 15px 12px; }
.card-head h2, .list-head h2 { font-size: 16px; line-height: 1.25; letter-spacing: -.02em; }
.card-head p, .list-head p { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.card-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 9px; }
.card-icon.blue { background: var(--blue-surface); color: var(--blue-ink); }
.card-icon.red { background: var(--red-surface); color: var(--red-ink); }
.card-icon.purple { background: var(--purple-surface); color: var(--purple-ink); }
.card-icon.amber { background: var(--amber-surface); color: var(--amber-ink); }
.card-icon.teal { background: var(--green-surface); color: var(--green-ink); }
.count { display: inline-grid; place-items: center; min-width: 27px; padding: 0 7px; height: 26px; border-radius: 7px; background: var(--subtle); color: var(--quiet); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.empty-line { border-top: 1px solid var(--soft-line); margin: 0 15px; padding: 14px 0 16px; font-size: 13px; color: var(--muted); line-height: 1.4; }
.rows { padding: 0; margin: 0; list-style: none; }
.rows > li { border-top: 1px solid var(--soft-line); }
.rows > li:last-child { border-radius: 0 0 12px 12px; }
.demand-row { width: 100%; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 0; border-radius: inherit; padding: 12px 15px; background: transparent; text-align: left; color: inherit; }
.demand-row:hover, .demand-row:focus-visible { background: var(--hover); }
.demand-row:focus-visible { outline-offset: -3px; }
.row-info { display: grid; min-width: 0; gap: 4px; }
.row-info strong, .row-note { overflow-wrap: anywhere; }
.row-info strong { font-size: 14px; }
.row-note { color: var(--muted); font-size: 13px; }
.row-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.badge { display: inline-flex; align-items: center; gap: 5px; width: fit-content; border-radius: 5px; padding: 3px 6px; background: var(--subtle); color: var(--quiet); font-size: 11px; font-weight: 650; line-height: 1.25; }
.badge .area-dot { width: 6px; height: 6px; }
.badge.b2med, .state-active { background: var(--blue-surface); color: var(--blue-ink); }
.badge.lameiras { background: var(--purple-surface); color: var(--purple-ink); }
.badge.pessoal, .state-done, .check-healthy { background: var(--green-surface); color: var(--green-ink); }
.state-waiting, .priority-high, .check-stale { background: var(--amber-surface); color: var(--amber-ink); }
.priority-urgent, .check-failure { background: var(--red-surface); color: var(--red-ink); }
.row-right { display: flex; align-items: center; gap: 5px; color: var(--muted); flex: none; }
.row-right svg { width: 15px; height: 15px; }
.row-date { font-size: 12px; white-space: nowrap; }
.overdue { color: var(--red-ink); }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 15px; }
.operations { display: grid; gap: 13px; }
.check-row .evidence-link, .check-row .evidence-text { display: inline-flex; margin: 0 15px 12px; }
.connection-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 15px; font-size: 14px; }
.connection-row small { display: block; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.connection-row > .badge { flex-shrink: 0; }
.connection-card > p { padding: 14px 15px; }
.connection-card > button { margin: 0 15px 14px; }
.loading { color: var(--muted); }

dialog { width: min(610px, calc(100% - 24px)); max-height: min(840px, calc(100dvh - 30px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 70px #16264238; background: var(--surface); color: inherit; }
dialog::backdrop { background: var(--backdrop); }
dialog form { display: flex; flex-direction: column; max-height: calc(min(840px, 100dvh - 30px) - 2px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 22px; letter-spacing: -.025em; }
.dialog-head p { color: var(--muted); margin-top: 4px; font-size: 13px; overflow-wrap: anywhere; }
.icon-button { display: grid; place-items: center; min-width: 38px; min-height: 38px; border: 0; border-radius: 8px; background: var(--subtle); color: var(--quiet); }
.icon-button:hover { background: var(--selected); }
.dialog-body { overflow: auto; display: grid; gap: 12px; padding: 16px 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 650; }
.field input, .field select { min-height: 42px; }
.form-subsection { display: grid; gap: 10px; padding: 12px; background: var(--page); border: 1px solid var(--line); border-radius: 8px; }
.form-subsection h3 { font-size: 14px; }
.demand-fieldset { min-width: 0; margin: 0; }
.demand-fieldset:not(.form-subsection) { display: grid; gap: 10px; border: 0; padding: 0; }
.extra { border-top: 1px solid var(--line); padding-top: 10px; color: var(--quiet); font-size: 13px; }
.extra summary { min-height: 30px; font-weight: 650; }
.extra > :not(summary) { margin-top: 10px; }
.evidence-link { display: inline-flex; align-items: center; gap: 5px; width: fit-content; color: var(--accent); font-size: 13px; }
.evidence-link svg { width: 16px; height: 16px; }
.evidence-text { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline { padding-left: 18px; }
.timeline li + li { margin-top: 10px; }
.timeline-meta { margin-top: 2px; color: var(--muted); }
.timeline p { margin-top: 4px; overflow-wrap: anywhere; white-space: pre-wrap; }
.form-error { flex: none; background: var(--red-surface); color: var(--red-ink); padding: 8px 20px; font-size: 13px; }
.dialog-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-left: auto; }
.delete-button { min-height: 40px; padding: 0 3px; border: 0; background: transparent; color: var(--red-ink); font-size: 13px; font-weight: 650; }
.delete-button:hover { text-decoration: underline; }
.confirmation { width: min(420px, calc(100% - 24px)); }
.confirmation .dialog-footer { border-top: 0; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 2; border-radius: 8px; background: #1d3656; color: white; padding: 12px 15px; font-size: 14px; box-shadow: 0 4px 20px #17223828; }

.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px 14px; background: radial-gradient(ellipse at top, var(--auth-glow), var(--page) 67%); }
.auth-card { width: min(100%, 410px); padding: clamp(22px, 6vw, 32px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 12px 36px #22376514; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 25px; }
.auth-brand { display: flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 750; letter-spacing: .07em; }
.auth-theme { min-width: 44px; padding: 0; }
.auth-theme span { display: none; }
.auth-brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.auth-card h1 { font-size: clamp(28px, 8vw, 37px); }
.auth-card h1:focus { outline: none; }
.auth-card .subtitle { margin-bottom: 20px; }
.login-button { width: 100%; text-decoration: none; }
.review-banner { margin-bottom: 10px; padding: 8px 10px; border-radius: 7px; background: var(--blue-surface); color: var(--blue-ink); font-size: 12px; font-weight: 650; }
.invite-entry { margin-top: 14px; border-block: 1px solid var(--line); padding-block: 5px; }
.invite-entry summary { min-height: 40px; padding-block: 10px; color: var(--quiet); font-size: 14px; font-weight: 650; }
.invite-entry form { display: grid; gap: 9px; margin-bottom: 8px; }
.auth-note { margin-top: 16px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.access-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 13px; }
.access-card { display: grid; gap: 14px; padding: 16px; }
.access-card h2 { font-size: 17px; }
.access-card p, .invite-result small { color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 3px; }
.access-card form, .invite-result { display: grid; gap: 9px; }
.access-card form > button, .invite-result > button { justify-self: start; }
.access-card fieldset { min-width: 0; margin: 0; padding: 3px 9px 7px; border: 1px solid var(--line); border-radius: 8px; }
.access-card legend { color: var(--quiet); padding: 0 4px; font-size: 13px; font-weight: 650; }
.access-choice { display: flex; align-items: center; gap: 8px; min-height: 35px; font-size: 14px; cursor: pointer; }
.access-choice input { width: 16px; height: 16px; accent-color: var(--blue); }
.plan-choice { display: flex; align-items: center; gap: 9px; min-height: 40px; color: var(--quiet); font-size: 14px; font-weight: 650; cursor: pointer; }
.plan-choice input { width: 17px; height: 17px; accent-color: var(--blue); }
.invite-result { border-top: 1px solid var(--line); padding-top: 12px; }
.access-error { margin-bottom: 8px; padding: 8px 10px; border-radius: 6px; background: var(--red-surface); color: var(--red-ink) !important; font-size: 13px; }
.grant-list { margin: 0; padding: 0; list-style: none; }
.grant-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 59px; padding-block: 7px; border-top: 1px solid var(--line); }
.grant-list strong { font-size: 14px; margin-right: 7px; }
input:disabled, select:disabled, textarea:disabled { color: var(--muted); background: var(--subtle); }

@media (max-width: 900px) {
  :root { --rail: 178px; }
  .rail { padding-inline: 12px; }
  .main { padding-inline: 23px; }
}

@media (max-width: 680px) {
  .rail { width: auto; position: relative; inset: auto; padding: 14px 14px 8px; gap: 11px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  .brand img { width: 32px; height: 32px; }
  .brand small { margin-top: 0; }
  .rail-main { margin: 0; }
  .rail-label, .rail-bottom { display: none; }
  .nav { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; }
  .nav a { min-height: 44px; flex-direction: column; justify-content: center; gap: 3px; padding: 5px 0; font-size: 11px; }
  .nav svg { width: 17px; height: 17px; }
  .account { position: absolute; top: 10px; right: 12px; border: 0; margin: 0; padding: 0; }
  .main { margin: 0; padding: 20px 14px 36px; }
  .page-header { align-items: flex-start; flex-wrap: wrap; margin-bottom: 19px; gap: 10px; }
  .eyebrow { margin-bottom: 7px; }
  .subtitle { margin-top: 6px; font-size: 14px; }
  .header-actions { max-width: 100%; }
  .area-switch { gap: 5px; margin-bottom: 9px; }
  .area-button { min-height: 40px; gap: 5px; padding: 0 7px; font-size: 12px; }
  .filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 18px; }
  .search { grid-column: 1 / -1; }
  .filter-bar input, .filter-bar select, .field input, .field select, textarea { font-size: 16px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .access-grid { grid-template-columns: minmax(0, 1fr); }
  .card-head { padding: 11px 12px 9px; }
  .empty-line { margin-inline: 12px; padding-block: 10px 12px; }
  .list-head { flex-wrap: wrap; }
  .dialog-head, .dialog-body, .dialog-footer { padding-inline: 13px; }
  .dialog-footer .button { padding-inline: 9px; }
}
