/* Condo Portal · interface v1.4
   Palette: a trustworthy blue as the only accent colour (contrast 6.3:1 on white; 6.5:1 in dark mode),
   kept apart from the status colours (green done, orange to handle, red urgent) so it is never mistaken for an alert.
   Visual language inspired by the Apple platforms' interface guidelines:
   system typeface, large titles, grouped lists, translucent materials,
   a single accent colour and respect for accessibility preferences. */

:root {
  --bg: #f2f2f7;              /* grouped background */
  --surface: #ffffff;         /* grouped section */
  --surface-2: #f2f2f7;
  --surface-3: #e5e5ea;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.2);
  --fg: #000000;
  --fg-2: rgba(60, 60, 67, 0.62);
  --fg-3: rgba(60, 60, 67, 0.36);
  --sep: rgba(60, 60, 67, 0.18);
  --accent: #1a5fb4;
  --accent-hover: #154c91;
  --accent-soft: rgba(26, 95, 180, 0.1);
  --on-accent: #ffffff;
  --graphite: #334155;
  --green: #248a3d; --green-soft: rgba(52, 199, 89, 0.14);
  --orange: #b25000; --orange-soft: rgba(255, 149, 0, 0.16);
  --red: #d70015; --red-soft: rgba(255, 59, 48, 0.12);
  --blue: #0062cc;
  --bar: rgba(249, 249, 251, 0.78);
  --side: rgba(242, 242, 247, 0.86);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-pop: 0 10px 40px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  --r-s: 8px; --r: 12px; --r-l: 18px;
  --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --spring: cubic-bezier(0.34, 1.32, 0.64, 1);
  --side-w: 264px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --surface-3: #3a3a3c;
    --fill: rgba(118, 118, 128, 0.24); --fill-2: rgba(118, 118, 128, 0.32);
    --fg: #ffffff; --fg-2: rgba(235, 235, 245, 0.62); --fg-3: rgba(235, 235, 245, 0.32);
    --sep: rgba(84, 84, 88, 0.6);
    --accent: #5ea2ff; --accent-hover: #7db4ff; --accent-soft: rgba(94, 162, 255, 0.16); --on-accent: #04162e;
    --green: #30d158; --green-soft: rgba(48, 209, 88, 0.16);
    --orange: #ff9f0a; --orange-soft: rgba(255, 159, 10, 0.16);
    --red: #ff453a; --red-soft: rgba(255, 69, 58, 0.16);
    --blue: #409cff;
    --bar: rgba(22, 22, 24, 0.78); --side: rgba(28, 28, 30, 0.86);
    --shadow: none; --shadow-pop: 0 10px 40px rgba(0, 0, 0, 0.6);
  }
}
@media (prefers-contrast: more) {
  :root { --fg-2: rgba(60, 60, 67, 0.85); --sep: rgba(60, 60, 67, 0.4); --fill: rgba(118, 118, 128, 0.22); }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 1rem/1.47 var(--font); letter-spacing: -0.011em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-size: 2.125rem; line-height: 1.12; font-weight: 700; letter-spacing: -0.026em; }
h2 { font-size: 1.25rem; line-height: 1.25; font-weight: 600; letter-spacing: -0.02em; }
h3 { font-size: 0.8125rem; font-weight: 400; text-transform: uppercase; letter-spacing: 0.01em; color: var(--fg-2); margin-top: 6px; }
p { margin: 0; }
code, .secret, kbd { font-family: var(--mono); font-size: 0.9em; }
small, .hint { color: var(--fg-2); font-size: 0.875rem; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 10px 14px; border-radius: var(--r-s); z-index: 100; box-shadow: var(--shadow-pop); }
.skip:focus { left: 16px; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

/* ---------- Layout ---------- */
body.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
  display: flex; flex-direction: column; gap: 10px; padding: 18px 12px 12px;
  background: var(--side); border-right: 0.5px solid var(--sep);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.side-brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 8px; color: var(--fg); text-decoration: none !important; }
.side-brand img { border-radius: 9px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.side-brand span { display: flex; flex-direction: column; min-width: 0; }
.side-brand strong { font-size: 0.9375rem; font-weight: 600; line-height: 1.2; }
.side-brand small { font-size: 0.75rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-search { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: 10px; background: var(--fill); color: var(--fg-2); font: inherit; font-size: 0.9375rem; cursor: pointer; text-align: left; }
.side-search .ic { width: 17px; height: 17px; }
.side-search span { flex: 1; }
.kbd-hint { font-size: 0.75rem; color: var(--fg-3); }
.side-nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.side-group { font-size: 0.75rem; font-weight: 600; color: var(--fg-2); padding: 14px 10px 4px; }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-s); color: var(--fg); font-size: 0.9375rem; text-decoration: none; transition: background 0.15s var(--ease); }
.side-nav a .ic { color: var(--accent); width: 20px; height: 20px; }
.side-nav a span:not(.badge) { flex: 1; }
.side-nav a:hover { background: var(--fill); }
.side-nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); font-weight: 500; }
.side-nav a[aria-current="page"] .ic { color: var(--on-accent); }
.side-nav a[aria-current="page"] .badge { background: rgba(255, 255, 255, 0.25); color: var(--on-accent); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--fill-2); color: var(--fg-2); font: 600 0.75rem/20px var(--rounded); text-align: center; font-variant-numeric: tabular-nums; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 6px 4px; border-top: 0.5px solid var(--sep); }
.side-user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.side-user-text strong { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { font-size: 0.75rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; background: linear-gradient(180deg, #a3a3ad, #7e7e88); color: #fff; font: 600 0.8125rem/1 var(--rounded); letter-spacing: 0.02em; text-decoration: none !important; cursor: pointer; list-style: none; }
.avatar::-webkit-details-marker { display: none; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--accent); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--fill); }

.shell { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.navbar {
  position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; gap: 12px;
  padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid transparent; transition: border-color 0.2s var(--ease);
}
.navbar.scrolled { border-bottom-color: var(--sep); }
.nav-app { display: none; }
.nav-app img { border-radius: 7px; display: block; }
.nav-title { flex: 1; text-align: center; font-weight: 600; font-size: 1.0625rem; opacity: 0; transform: translateY(4px); transition: opacity 0.2s var(--ease), transform 0.2s var(--ease); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navbar.scrolled .nav-title { opacity: 1; transform: none; }
.nav-actions { display: flex; align-items: center; gap: 6px; }
.nav-actions [data-palette] { display: none; }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); width: 260px; padding: 6px; z-index: 40;
  background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  border-radius: var(--r); box-shadow: var(--shadow-pop); border: 0.5px solid var(--sep);
  transform-origin: top right; animation: pop 0.22s var(--spring);
}
.menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 0.5px solid var(--sep); margin-bottom: 4px; }
.menu-head small { overflow: hidden; text-overflow: ellipsis; }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-s); background: none; color: var(--fg); font: inherit; font-size: 0.9375rem; cursor: pointer; text-decoration: none; text-align: left; }
.menu-pop .ic { width: 19px; height: 19px; color: var(--fg-2); }
.menu-pop a:hover, .menu-pop button:hover { background: var(--fill); }
.menu-pop .danger, .menu-pop .danger .ic { color: var(--red); }

main#main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 8px max(28px, env(safe-area-inset-right)) 48px max(28px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 20px; flex: 1; outline: none; }
.foot { max-width: 1120px; width: 100%; margin: 0 auto; padding: 18px 28px 36px; color: var(--fg-2); font-size: 0.8125rem; }
.foot p { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }
.foot-nav { display: none; }
.tabbar { display: none; }

/* ---------- Sections ---------- */
.card { background: var(--surface); border-radius: var(--r); padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; box-shadow: var(--shadow); }
/* A section that opens with the page title acts as a header: large title over the background */
.card:has(> h1), .card:has(> .head > h1), .card:has(> .crumb) { background: transparent; box-shadow: none; padding: 0; }
.card:has(> h1) > .list, .card:has(> .head > h1) > .list, .card:has(> h1) > .tbl, .card:has(> .head > h1) > .tbl,
.card:has(> h1) > ul.alerts, .card:has(> .head > h1) > ul.alerts, .card:has(> .head > h1) > ul.doclist, .card:has(> h1) > ul.doclist { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 4px 16px; }
.card:has(> h1) > .empty, .card:has(> .head > h1) > .empty { background: var(--surface); border-radius: var(--r); padding: 28px 20px; text-align: center; box-shadow: var(--shadow); }
form.card:has(> h1), form.card:has(> .head > h1) { gap: 18px; }
.card.inner { background: var(--surface-2); box-shadow: none; }
.card.next { box-shadow: var(--shadow), inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent); }
.warnbox { box-shadow: var(--shadow), inset 4px 0 0 var(--red); }
.card.danger, details.danger { box-shadow: var(--shadow), inset 0 0 0 1px var(--red-soft); }
.card > h2:first-child, .card > .head:first-child h2 { margin-bottom: -2px; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.hero { gap: 10px; padding-top: 10px !important; }
.hero h1 { font-size: 2.125rem; }
.hero p { color: var(--fg-2); font-size: 1.0625rem; }
.actions, .row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.cols.wide-left { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.law { font-size: 0.875rem; color: var(--fg-2); padding: 10px 12px; background: var(--fill); border-radius: var(--r-s); }
.empty { color: var(--fg-2); padding: 8px 0; }
.prose { max-width: 72ch; gap: 12px; font-size: 1.0625rem; line-height: 1.55; }
.prose h2 { margin-top: 18px; font-size: 1.375rem; }
.prose h3 { margin-top: 12px; }
.prose ul, .prose ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.prose table { margin: 6px 0; font-size: 0.9375rem; }
.doc table { display: block; overflow-x: auto; }
article.card.prose { padding: 28px 32px; }

/* Back link (navigation bar style) */
.crumb { font-size: 0; line-height: 0; margin-bottom: 2px; }
.crumb a { display: inline-flex; align-items: center; gap: 2px; font-size: 1.0625rem; line-height: 1.4; margin-left: -6px; padding: 4px 6px; border-radius: var(--r-s); }
.crumb a::before { content: ""; width: 12px; height: 20px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'%3E%3Cpath d='M10 2 2 10l8 8' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'%3E%3Cpath d='M10 2 2 10l8 8' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.crumb a:hover { text-decoration: none; background: var(--fill); }

/* ---------- Forms ---------- */
form { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 16px; }
.grid .wide, .grid label.f.wide, .grid label.chk.wide { grid-column: 1 / -1; }
.grid.checks { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 16px; }
fieldset { border: 0; border-radius: var(--r); padding: 16px 18px 18px; margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; background: var(--surface); box-shadow: var(--shadow); }
.card fieldset { background: transparent; box-shadow: none; padding: 0; }
.card fieldset + fieldset { border-top: 0.5px solid var(--sep); border-radius: 0; padding-top: 16px; }
fieldset.inner { background: var(--surface-2); box-shadow: none; padding: 14px 16px; }
legend { float: left; width: 100%; font-size: 0.8125rem; text-transform: uppercase; color: var(--fg-2); padding: 0; margin-bottom: 4px; letter-spacing: 0.01em; }
legend + * { clear: both; }
label.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label.f > span { font-size: 0.8125rem; font-weight: 500; color: var(--fg-2); }
input, select, textarea {
  font: inherit; font-size: 1rem; color: var(--fg); width: 100%; min-width: 0; min-height: 44px;
  background: var(--fill); border: 0; border-radius: 10px; padding: 10px 12px;
  transition: box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--fg-3); }
input[readonly] { color: var(--fg-2); background: transparent; box-shadow: inset 0 0 0 1px var(--sep); }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Cpath d='m3 6 3-3 3 3M3 10l3 3 3-3' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 10px 14px; }
textarea { resize: vertical; min-height: 96px; }
input[type="file"] { padding: 9px 10px; font-size: 0.9375rem; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 500; border: 0; border-radius: 8px; background: var(--accent-soft); color: var(--accent); padding: 6px 12px; margin-right: 10px; cursor: pointer; }
input[type="date"], input[type="datetime-local"], input[type="time"] { font-variant-numeric: tabular-nums; }
input[type="radio"] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--accent); }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--accent); }
/* Switches (for labelled checkboxes) */
label.chk { display: flex; gap: 12px; align-items: center; justify-content: space-between; font-size: 1rem; min-height: 44px; padding: 4px 0; cursor: pointer; }
label.chk span { order: -1; flex: 1; }
label.chk input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: none; width: 51px; height: 31px; border-radius: 16px; margin: 0;
  background: var(--fill-2); position: relative; cursor: pointer; transition: background 0.25s var(--ease); box-shadow: none;
}
label.chk input[type="checkbox"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.28s var(--spring); }
label.chk input[type="checkbox"]:checked { background: var(--green); }
label.chk input[type="checkbox"]:checked::after { transform: translateX(20px); }
label.chk input[type="checkbox"]:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.grid.checks label.chk { border-bottom: 0.5px solid var(--sep); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.filters label.f { flex: 1 1 170px; }
.filters label.f:has(input[type="search"]) { flex: 2 1 260px; }
input[type="search"] { padding-left: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='6.2' fill='none' stroke='%238e8e93' stroke-width='2'/%3E%3Cpath d='m15.2 15.2 5.3 5.3' stroke='%238e8e93' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 11px center; background-size: 17px; }
.js .filters.auto button[type="submit"] { display: none; }
details > summary { cursor: pointer; font-weight: 500; color: var(--accent); padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 6px; }
details > summary::-webkit-details-marker { display: none; }
details:not(.menu) > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.2s var(--ease); margin: 0 4px 0 2px; }
details[open]:not(.menu) > summary::before { transform: rotate(45deg); }
details[open]:not(.menu) > summary { margin-bottom: 10px; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  border: 0; border-radius: 12px; background: var(--fill); color: var(--accent); font: 600 0.9375rem/1.2 var(--font); letter-spacing: -0.01em;
  padding: 11px 18px; cursor: pointer; text-decoration: none !important; transition: transform 0.12s var(--ease), background 0.15s var(--ease), opacity 0.15s;
  -webkit-user-select: none; user-select: none;
}
.btn:hover { background: var(--fill-2); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: none; padding-inline: 10px; }
.btn.ghost:hover { background: var(--fill); }
.btn.small { min-height: 32px; padding: 6px 12px; font-size: 0.8125rem; border-radius: 9px; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }
.btn.destructive, form[data-confirm] .btn.ghost { color: var(--red); }

/* ---------- States ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 500; padding: 3px 10px; border-radius: 99px; background: var(--fill); color: var(--fg-2); white-space: nowrap; vertical-align: middle; line-height: 1.35; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.chip.ok { background: var(--green-soft); color: var(--green); }
.chip.warn { background: var(--orange-soft); color: var(--orange); }
.chip.crit { background: var(--red-soft); color: var(--red); }
.chip.acc { background: var(--accent-soft); color: var(--accent); }

/* Floating toasts */
.toasts { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 0; right: 0; margin-inline: auto; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 16px; border-radius: 14px; font-size: 0.9375rem; font-weight: 500;
  background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-pop); border: 0.5px solid var(--sep); animation: drop 0.45s var(--spring); }
.toast::before { content: ""; width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='m6.5 11.3 3 3 6-6.4' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 22px no-repeat; }
.toast.warn::before { background: var(--orange) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M11 6v6.2' stroke='white' stroke-width='2.4' stroke-linecap='round'/%3E%3Ccircle cx='11' cy='15.6' r='1.4' fill='white'/%3E%3C/svg%3E") center / 22px no-repeat; }
.toast.err::before { background: var(--red) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='m7.5 7.5 7 7m0-7-7 7' stroke='white' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center / 22px no-repeat; }
.toast span { flex: 1; }
.toast-x { width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--fg-2); display: grid; place-items: center; cursor: pointer; }
.toast-x:hover { background: var(--fill); }
.toast-x .ic { width: 16px; height: 16px; }
.toast.out { animation: lift 0.3s var(--ease) forwards; }
.toast.inline { animation: none; box-shadow: none; background: var(--surface); }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border-radius: var(--r); padding: 16px 18px 14px; display: flex; flex-direction: column-reverse; gap: 2px; text-decoration: none !important; color: var(--fg); box-shadow: var(--shadow); transition: transform 0.2s var(--ease); position: relative; }
.tile span { color: var(--fg-2); font-size: 0.875rem; font-weight: 500; }
.tile b { font: 700 2rem/1.15 var(--rounded); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tile.crit b { color: var(--red); } .tile.warn b { color: var(--orange); }
.tile::after { content: ""; position: absolute; top: 18px; right: 16px; width: 8px; height: 8px; border-right: 2px solid var(--fg-3); border-top: 2px solid var(--fg-3); transform: rotate(45deg); }
.tile:hover { transform: translateY(-2px); }

/* Grouped lists */
ul.alerts, ul.plain, ul.files, ul.doclist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
ul.alerts li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 12px 0; border-top: 0.5px solid var(--sep); }
ul.alerts li:first-child, ul.doclist li:first-child, ul.files li:first-child, ul.plain li:first-child { border-top: 0; }
ul.alerts li a { font-weight: 500; color: var(--fg); flex: 1 1 260px; }
ul.alerts li .hint { flex-basis: 100%; padding-left: 0; }
ul.plain li, ul.files li { padding: 9px 0; border-top: 0.5px solid var(--sep); }
ul.doclist li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 11px 0; border-top: 0.5px solid var(--sep); }
ul.doclist span { color: var(--fg-2); font-size: 0.875rem; }

.list { display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto 14px; gap: 2px 14px; align-items: center; padding: 12px 0; border-top: 0.5px solid var(--sep); color: var(--fg); text-decoration: none !important; position: relative; }
.item:first-child { border-top: 0; }
.item::after { content: ""; grid-column: 4; grid-row: 1 / 3; width: 7px; height: 7px; border-right: 2px solid var(--fg-3); border-top: 2px solid var(--fg-3); transform: rotate(45deg); justify-self: center; }
.item:hover { background: linear-gradient(var(--fill), var(--fill)) padding-box; margin: 0 -16px; padding-inline: 16px; }
.item .num { font: 500 0.875rem var(--mono); color: var(--accent); grid-row: 1 / 3; }
.item .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .m { grid-column: 2; color: var(--fg-2); font-size: 0.875rem; }
.item .side { grid-column: 3; grid-row: 1 / 3; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.choice { text-decoration: none !important; color: var(--fg); gap: 6px; transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.choice:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.choice:active { transform: scale(0.98); }
.choice .code { align-self: flex-start; font: 600 0.75rem var(--rounded); color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 6px; }
.choice h2 { font-size: 1.125rem; }
.choice p { color: var(--fg-2); font-size: 0.9375rem; }

dl.meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0; margin: 0; background: var(--surface); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
dl.meta > div { padding: 12px 16px; box-shadow: inset -0.5px 0 0 var(--sep), inset 0 -0.5px 0 var(--sep); }
dl.meta dt { font-size: 0.8125rem; color: var(--fg-2); }
dl.meta dd { margin: 2px 0 0; font-weight: 500; font-variant-numeric: tabular-nums; }
dl.meta.big dd { font: 600 1.25rem var(--rounded); }
.card:not(:has(> h1)):not(:has(> .head > h1)) dl.meta { background: none; box-shadow: none; gap: 12px 18px; border-radius: 0; }
.card:not(:has(> h1)):not(:has(> .head > h1)) dl.meta > div { padding: 0; background: none; }
dl.kvlist { margin: 0; display: flex; flex-direction: column; }
dl.kvlist div { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 0.5px solid var(--sep); }
dl.kvlist div:first-child { border-top: 0; }
dl.kvlist dt { color: var(--fg-2); }
dl.kvlist dd { margin: 0; overflow-wrap: anywhere; }
.kv { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 0; border-top: 0.5px solid var(--sep); }
.kv:first-of-type { border-top: 0; }
.kv > span:first-child { flex: 1; }
.kv b { font: 600 1.0625rem var(--rounded); font-variant-numeric: tabular-nums; }

/* Procedure steps: progress bar */
ol.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 0; counter-reset: s; }
ol.steps li { counter-increment: s; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 0 4px 6px; font-size: 0.8125rem; color: var(--fg-2); line-height: 1.3; }
ol.steps li::before { content: counter(s); position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: inset 0 0 0 2px var(--surface-3); font: 600 0.8125rem var(--rounded); color: var(--fg-2); }
ol.steps li::after { content: ""; position: absolute; top: 13px; left: calc(-50% + 14px); right: calc(50% + 14px); height: 2px; background: var(--surface-3); border-radius: 2px; }
ol.steps li:first-child::after { display: none; }
ol.steps li.done { color: var(--fg); }
ol.steps li.done::before { content: ""; background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='m6.5 11.3 3 3 6-6.4' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 24px no-repeat; box-shadow: none; }
ol.steps li.done::after, ol.steps li.current::after { background: var(--green); }
ol.steps li.current { color: var(--fg); font-weight: 600; }
ol.steps li.current::before { background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.transition { display: flex; flex-direction: column; gap: 8px; padding: 12px 0 4px; border-top: 0.5px solid var(--sep); }
ul.missing { margin: 0; padding: 0; list-style: none; color: var(--fg-2); font-size: 0.875rem; display: flex; flex-direction: column; gap: 4px; }
ul.missing li { display: flex; gap: 8px; align-items: baseline; }
ul.missing li::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); transform: translateY(-1px); }

/* History */
ol.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
ol.timeline li { position: relative; padding: 0 0 16px 24px; }
ol.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--fg-3); box-shadow: 0 0 0 3px var(--surface); z-index: 1; }
ol.timeline li::after { content: ""; position: absolute; left: 9px; top: 12px; bottom: -4px; width: 1.5px; background: var(--sep); }
ol.timeline li:last-child::after { display: none; }
ol.timeline li.mensagem::before { background: var(--accent); }
ol.timeline li.estado::before { background: var(--green); }
ol.timeline li.nota::before { background: var(--orange); }
ol.timeline li.mensagem > :not(.tl-head) { background: var(--fill); border-radius: 4px 14px 14px 14px; padding: 8px 12px; margin-top: 4px; display: inline-block; max-width: 100%; }
ol.timeline li.nota > :not(.tl-head) { background: var(--orange-soft); border-radius: 10px; padding: 8px 12px; margin-top: 4px; }
.tl-head { font-size: 0.8125rem; color: var(--fg-2); }
.tl-head strong { color: var(--fg); font-weight: 600; }
.tl-head time { margin-left: 4px; }
.hist-item { border-top: 0.5px solid var(--sep); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }

/* Tables */
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 0.8125rem; font-weight: 500; color: var(--fg-2); padding: 10px 12px; border-bottom: 0.5px solid var(--sep); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 0.5px solid var(--sep); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--fill); }
tr.chosen td { background: var(--green-soft); }
td.neg { color: var(--red); font-weight: 600; }
td input[type="text"], td select { min-width: 120px; }
th:first-child, td:first-child { padding-left: 0; }
.card:has(> h1) > .tbl th:first-child, .card:has(> h1) > .tbl td:first-child, .card:has(> .head > h1) > .tbl th:first-child, .card:has(> .head > h1) > .tbl td:first-child { padding-left: 4px; }

/* Segmented control */
nav.subtabs { display: inline-flex; align-self: flex-start; gap: 2px; padding: 2px; border-radius: 9px; background: var(--fill); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
nav.subtabs a { padding: 6px 14px; border-radius: 7px; text-decoration: none; color: var(--fg); font-weight: 500; font-size: 0.875rem; white-space: nowrap; transition: background 0.2s var(--ease); }
nav.subtabs a:hover { background: var(--fill); }
nav.subtabs a[aria-current="page"] { background: var(--surface); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04); font-weight: 600; }
@media (prefers-color-scheme: dark) { nav.subtabs a[aria-current="page"] { background: #636366; } }
nav.pager { display: flex; gap: 6px; }
nav.pager a { min-width: 36px; padding: 6px 10px; border-radius: 8px; text-align: center; background: var(--fill); color: var(--fg); text-decoration: none; }
nav.pager a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }

.totp { display: flex; flex-direction: column; gap: 12px; }
canvas.qr { width: 200px; height: 200px; border-radius: var(--r); background: #fff; box-shadow: var(--shadow); }
.secret { background: var(--fill); padding: 4px 8px; border-radius: 6px; letter-spacing: 0.06em; }


/* ---------- Budget, actions, approvals and reports ---------- */
.icon-btn.compose { background: var(--accent); color: var(--on-accent); }
.icon-btn.compose:hover { background: var(--accent-hover); }
.icon-btn.compose .ic { stroke-width: 2.2; }
.side-user .icon-btn { color: var(--fg-2); }
.side-user .icon-btn.on, .side-user .icon-btn:hover { color: var(--accent); }
.settings-tabs { margin-bottom: -6px; }
.lead { font-size: 1.125rem; line-height: 1.45; }
.r { text-align: right; white-space: nowrap; }
th.r { text-align: right; }
.code { font: 600 0.8125rem var(--rounded); color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; margin-right: 4px; }
table.exec tr.grp td { background: var(--surface-2); font-weight: 600; font-size: 0.8125rem; color: var(--fg-2); padding-top: 8px; padding-bottom: 8px; }
table.exec tr.sum td { font-weight: 700; border-bottom: 1px solid var(--fg-3); }
table.exec tr.warnrow td { background: var(--orange-soft); }
.meter { display: inline-block; width: 90px; height: 8px; border-radius: 4px; background: var(--fill-2); overflow: hidden; vertical-align: middle; }
.meter > span { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--green); transition: width 0.6s var(--ease); }
.meter.warn > span { background: var(--orange); }
.meter.crit > span { background: var(--red); }
table.edit td { padding: 6px 6px; vertical-align: middle; }
table.edit input, table.edit select { min-height: 38px; padding: 7px 10px; font-size: 0.9375rem; }
table.edit .w-code { width: 70px; min-width: 70px; }
table.edit td:nth-child(2) input { min-width: 260px; }
table.exec td:first-child { min-width: 230px; }
table.edit .w-num { width: 120px; min-width: 110px; text-align: right; }
table.edit tr.new input { background: transparent; box-shadow: inset 0 0 0 1px var(--sep); }
label.mini { display: inline-flex; gap: 6px; align-items: center; font-size: 0.8125rem; color: var(--fg-2); white-space: nowrap; }
label.mini input { width: 18px; height: 18px; }
.feature { gap: 12px; }
.feature-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.feature-ic .ic { width: 24px; height: 24px; }
.tile.static::after { display: none; }
.tile.static:hover { transform: none; }
ol.decide { margin: 0; padding: 0; list-style: none; counter-reset: d; display: flex; flex-direction: column; }
ol.decide li { counter-increment: d; position: relative; padding: 12px 0 12px 40px; border-top: 0.5px solid var(--sep); display: flex; flex-direction: column; gap: 4px; }
ol.decide li:first-child { border-top: 0; }
ol.decide li::before { content: counter(d); position: absolute; left: 0; top: 12px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font: 600 0.875rem var(--rounded); }
ol.decide li > div { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
ol.decide p { color: var(--fg); }
ol.decide small { color: var(--fg-2); }
/* Segmented control for answers (radio) */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px; border-radius: 10px; background: var(--fill); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segmented span { display: block; text-align: center; padding: 10px 8px; border-radius: 8px; font-weight: 500; font-size: 0.9375rem; transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.segmented input:checked + span { background: var(--surface); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04); font-weight: 600; }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }
@media (prefers-color-scheme: dark) { .segmented input:checked + span { background: #636366; } }
form.answer + form.answer { border-top: 0.5px solid var(--sep); padding-top: 14px; }
form.answer h3 { margin: 0; text-transform: none; font-size: 1rem; color: var(--fg); font-weight: 600; }

/* ---------- Dialogs and sheets ---------- */
dialog { border: 0; padding: 0; color: var(--fg); background: transparent; max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(0, 0, 0, 0.3); }
dialog[open] { animation: pop 0.3s var(--spring); }
.alert-box { width: 300px; border-radius: 16px; overflow: hidden; text-align: center; background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); box-shadow: var(--shadow-pop); }
.alert-box p { padding: 20px 18px 18px; font-size: 0.9375rem; line-height: 1.4; }
.alert-box p strong { display: block; font-size: 1.0625rem; margin-bottom: 4px; }
.alert-btns { display: grid; grid-template-columns: 1fr 1fr; border-top: 0.5px solid var(--sep); }
.alert-btns button { min-height: 46px; border: 0; background: none; font: inherit; font-size: 1.0625rem; color: var(--accent); cursor: pointer; }
.alert-btns button + button { border-left: 0.5px solid var(--sep); font-weight: 600; }
.alert-btns button:hover { background: var(--fill); }
.alert-btns button.destructive { color: var(--red); }

.palette { width: 620px; margin-top: 12vh; border-radius: 16px; overflow: hidden; background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); box-shadow: var(--shadow-pop); border: 0.5px solid var(--sep); }
.palette-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 0.5px solid var(--sep); }
.palette-in .ic { color: var(--fg-2); }
.palette-in input { background: none; font-size: 1.25rem; min-height: 58px; padding: 0; box-shadow: none !important; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette li a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--fg); text-decoration: none; }
.palette li a .ic { color: var(--accent); width: 20px; height: 20px; }
.palette li a small { margin-left: auto; }
.palette li a[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
.palette li a[aria-selected="true"] .ic, .palette li a[aria-selected="true"] small { color: var(--on-accent); }
.palette .none { padding: 18px; color: var(--fg-2); text-align: center; }

.sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 14px 14px 0 0; padding: 8px 12px max(20px, env(safe-area-inset-bottom)); background: var(--bg); box-shadow: var(--shadow-pop); }
.sheet[open] { animation: rise 0.42s var(--spring); }
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 0 auto 10px; }
.sheet .sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 10px; }
.sheet .sheet-head h2 { font-size: 1.25rem; }
.sheet nav { background: var(--surface); border-radius: var(--r); padding: 0 14px; }
.sheet nav a { display: flex; align-items: center; gap: 14px; padding: 13px 0; color: var(--fg); text-decoration: none; border-top: 0.5px solid var(--sep); font-size: 1.0625rem; }
.sheet nav a:first-child { border-top: 0; }
.sheet nav a .ic { color: var(--accent); }
.sheet nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.sheet nav a::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--fg-3); border-top: 2px solid var(--fg-3); transform: rotate(45deg); }
.sheet .sheet-out { margin-top: 14px; }
.sheet .sheet-out .btn { width: 100%; background: var(--surface); color: var(--red); }

/* ---------- Public pages ---------- */
body.public { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: var(--bg); }
body.public main#main.auth { width: 100%; max-width: 440px; margin: 0 auto; padding: 48px max(20px, env(safe-area-inset-left)) 40px; display: flex; flex-direction: column; gap: 18px; }
body.public main#main.auth.wide-auth { max-width: 760px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; margin-bottom: 8px; }
.app-icon { border-radius: 19px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16), 0 1px 3px rgba(0, 0, 0, 0.1); margin-bottom: 10px; }
.auth-brand h1 { font-size: 1.75rem; }
.auth-brand p { color: var(--fg-2); }
.auth .card { padding: 22px; border-radius: var(--r-l); }
.auth .card h2 { font-size: 1.375rem; text-align: center; }
.auth .card > p { color: var(--fg-2); text-align: center; }
.auth .card .btn.primary { width: 100%; font-size: 1.0625rem; min-height: 50px; }
.auth .row-actions { justify-content: center; }
.auth-foot { text-align: center; font-size: 0.875rem; }
#f-codigo { font: 600 1.75rem/1 var(--rounded); letter-spacing: 0.35em; text-align: center; font-variant-numeric: tabular-nums; min-height: 60px; }

/* ---------- Motion ---------- */
@keyframes pop { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes lift { to { opacity: 0; transform: translateY(-12px) scale(0.96); } }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
main#main > * { animation: fadein 0.35s var(--ease) both; }
main#main > .toasts { animation: none; }
main#main > *:nth-child(2) { animation-delay: 0.03s; } main#main > *:nth-child(3) { animation-delay: 0.06s; } main#main > *:nth-child(n+4) { animation-delay: 0.09s; }
@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (prefers-reduced-transparency: reduce) {
  .sidebar, .navbar, .tabbar, .menu-pop, .toast, .alert-box, .palette { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
}

/* ---------- Sizes ---------- */
@media (max-width: 1100px) and (min-width: 821px) {
  :root { --side-w: 228px; }
  .cols.wide-left { grid-template-columns: 1fr; }
}
@media (min-width: 821px) {
  .navbar { justify-content: flex-end; }
  .navbar .nav-title { text-align: left; padding-left: 4px; }
}
@media (max-width: 820px) {
  body { font-size: 1.0625rem; }
  .sidebar { display: none; }
  .shell { margin-left: 0; }
  .navbar { height: calc(48px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .nav-app { display: block; }
  .nav-actions [data-palette] { display: inline-grid; }
  main#main { padding: 4px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); gap: 18px; }
  .foot { display: none; }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    padding: 6px max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 0.5px solid var(--sep);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 0; color: #8e8e93; font-size: 0.625rem; font-weight: 500; text-decoration: none; letter-spacing: 0.01em; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tab-ic { position: relative; display: grid; place-items: center; height: 30px; }
  .tab-ic .ic { width: 26px; height: 26px; }
  .tabbar a[aria-current="page"] .ic { stroke-width: 2.2; }
  .tab-ic .badge { position: absolute; top: -2px; left: 60%; min-width: 18px; height: 18px; line-height: 18px; font-size: 0.6875rem; background: var(--red); color: #fff; padding: 0 5px; }
  input, select, textarea { font-size: 1.0625rem; }
  h1, .hero h1 { font-size: 2.125rem; }
  .card { padding: 16px; }
  .cols, .cols.wide-left { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile b { font-size: 1.625rem; }
  .item { grid-template-columns: minmax(0, 1fr) auto 12px; }
  .item .num { grid-row: auto; grid-column: 1; }
  .item .t, .item .m { grid-column: 1; }
  .item .t { white-space: normal; }
  .item .side { grid-column: 1; grid-row: auto; flex-direction: row; flex-wrap: wrap; align-items: center; margin-top: 4px; }
  .item { grid-template-columns: minmax(0, 1fr) 12px; }
  .item::after { grid-column: 2; grid-row: 1 / 5; }
  .hero .actions .btn { flex: 1 1 100%; }
  dl.kvlist div { grid-template-columns: 1fr; gap: 2px; }
  ol.steps { grid-template-columns: 1fr; gap: 0; }
  ol.steps li { flex-direction: row; text-align: left; align-items: center; gap: 12px; padding: 0 0 14px; }
  ol.steps li::after { top: auto; bottom: calc(100% - 0px); left: 13px; right: auto; width: 2px; height: 14px; }
  ol.steps li { position: relative; }
  ol.steps li::after { top: -14px; bottom: auto; }
  .palette { margin-top: 8px; width: calc(100vw - 16px); }
  article.card.prose { padding: 20px 18px; }
  .js .filters.auto { display: grid; grid-template-columns: 1fr 1fr; }
  .js .filters.auto label.f:has(input[type="search"]) { grid-column: 1 / -1; }
  .js .filters.auto .btn.ghost { grid-column: 1 / -1; justify-self: start; }
  .auth .card { padding: 20px 18px; }
}
@media (max-width: 380px) { .tiles { grid-template-columns: 1fr; } }

/* ---------- Language switch ---------- */
.lang-switch { display: flex; gap: 14px; align-items: center; font-size: 0.875rem; color: var(--fg-2); margin-top: 6px; }
.lang-switch.center { justify-content: center; margin-top: 4px; }
.lang-switch a { color: var(--accent); text-decoration: none; }
.lang-switch a:hover { text-decoration: underline; }
.lang-switch [aria-current] { font-weight: 600; color: var(--fg); }
.doc-note { color: var(--fg-2); font-size: 0.875rem; border-left: 3px solid var(--accent); padding-left: 10px; }

/* ---------- Print ---------- */
@media print {
  .sidebar, .navbar, .tabbar, .foot, form, .actions, .toasts { display: none !important; }
  .shell { margin: 0; }
  body { background: #fff; color: #000; }
  .card, fieldset, dl.meta { box-shadow: none !important; padding: 0; }
  main#main > * { animation: none; }
}
