@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 300 400;
  font-display: swap;
  src: url("fonts/jost-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Jost";
  font-style: normal;
  font-weight: 300 400;
  font-display: swap;
  src: url("fonts/jost-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font: "Jost", system-ui, sans-serif;
  --sidebar: 15%;
  --sidebar-collapsed: 56px;
  --sections: 20%;
  --content: 65%;
  --header: 60px;
  --radius: 8px;
  --surface-1: #f3f3f1;
  --surface-2: #f8f8f6;
  --surface-3: #fdfdfc;
  --surface-4: #ffffff;
  --text: #161615;
  --text-2: #6d6c68;
  --text-3: #8c8b86;
  --line: rgba(22, 22, 21, .07);
  --highlight: rgba(22, 22, 21, .05);
  --control: rgba(22, 22, 21, .14);
  --accent: #161615;
  --ok: #2f7d4f;
  --warning: #8f5e0b;
  --danger: #b3443b;
  --shadow: 0 12px 32px rgba(0, 0, 0, .14);
  color-scheme: light;
  accent-color: var(--text);
}

:root[data-theme="dark"] {
  --surface-1: #0e0e0e;
  --surface-2: #141414;
  --surface-3: #1a1a19;
  --surface-4: #222221;
  --text: #ececea;
  --text-2: #9e9d98;
  --text-3: #7a7974;
  --line: rgba(255, 255, 255, .09);
  --highlight: rgba(255, 255, 255, .06);
  --control: rgba(255, 255, 255, .18);
  --accent: #ececea;
  --ok: #5cbd82;
  --warning: #d9a441;
  --danger: #e2756d;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--surface-3);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { margin: 0; font: inherit; color: inherit; }
button { padding: 0; border: 0; background: none; cursor: pointer; }
a { color: inherit; }
:where(a, button, input, select, textarea):focus-visible { outline: 1px solid var(--text); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar) var(--sections) var(--content);
  height: 100%;
  transition: grid-template-columns .2s;
}
.app.collapsed { grid-template-columns: var(--sidebar-collapsed) var(--sections) minmax(0, 1fr); }

.sidebar, .sections, .content { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sidebar { background: var(--surface-1); border-right: 1px solid var(--line); }
.sections { background: var(--surface-2); border-right: 1px solid var(--line); }
.content { background: var(--surface-3); }

.sidebar-header, .sections-header, .content-header {
  flex: none;
  height: var(--header);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 24px;
}
.content-header { padding-left: 32px; }
.sidebar-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.sections-title { flex: 1; font-size: 15px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-title { flex: 1; font-size: 22px; font-weight: 300; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-list { flex: 1; overflow-y: auto; padding: 4px 12px; }
.sections-list { flex: 1; overflow-y: auto; padding: 4px 12px; }
.content-body { flex: 1; min-width: 0; overflow-y: auto; padding: 4px 32px 40px; container-type: inline-size; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--text); background: var(--highlight); }
.nav-item span { overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer, .sheet-footer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 16px 14px;
}
.sidebar-footer .select-wrap, .sheet-footer .select-wrap { flex: 1; }
.footer-actions { flex: none; display: flex; align-items: center; gap: 4px; }

.icon { flex: none; display: block; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--surface-3);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.button:hover { background: color-mix(in oklab, var(--accent) 82%, var(--surface-3)); }
.button:active { transform: scale(.98); }
.button:disabled { opacity: .35; cursor: default; transform: none; }
[data-busy] { opacity: .6; }
.button.secondary { background: none; border-color: var(--control); color: var(--text); }
.button.secondary:hover { border-color: var(--text); background: none; }
.button.ghost { background: none; padding: 0 12px; color: var(--text-2); }
.button.ghost:hover { background: var(--highlight); color: var(--text); }
.button.danger { background: none; padding: 0 12px; color: var(--danger); }
.button.danger:hover { background: color-mix(in oklab, var(--danger) 10%, transparent); }

.icon-button {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--text-2);
}
.icon-button:hover { background: var(--highlight); color: var(--text); }
.icon-button.danger { color: var(--danger); }
.icon-button.danger:hover { background: color-mix(in oklab, var(--danger) 10%, transparent); color: var(--danger); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--text-2); }
.input-wrap { position: relative; display: flex; }
.field input, .field select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--control);
  border-radius: var(--radius);
  background: none;
  color: var(--text);
}
.field input::placeholder { color: var(--text-3); }
.field input:focus-visible, .field select:focus-visible { outline: none; border-color: var(--text); }
.field select { appearance: none; padding-right: 34px; cursor: pointer; }
.field .input-wrap > .icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.field small { display: none; font-size: 13px; color: var(--danger); }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.row[hidden], .group[hidden] { display: none; }
.option .badge { margin-left: auto; }
.form-grid > .wide, .form-grid > .group-title { grid-column: 1 / -1; }
.field.invalid small { display: block; }
.field.wide { grid-column: 1 / -1; }

.select-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.select-wrap select {
  appearance: none;
  width: 100%;
  padding: 6px 26px 6px 10px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}
.select-wrap select:hover { background: var(--highlight); color: var(--text); }
.select-wrap .icon { position: absolute; right: 8px; pointer-events: none; color: var(--text-3); }

.toggle {
  flex: none;
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background: var(--control);
}
.toggle i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-3);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  transition: transform .2s;
}
.toggle[aria-checked="true"] { background: var(--accent); }
.toggle[aria-checked="true"] i { transform: translateX(14px); }
.toggle:disabled { opacity: .35; cursor: default; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--highlight);
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}
.badge[data-status="paid"], .badge[data-status="active"] { color: var(--ok); background: color-mix(in oklab, var(--ok) 12%, transparent); }
.badge[data-status="pending"], .badge[data-status="paused"] { color: var(--warning); background: color-mix(in oklab, var(--warning) 14%, transparent); }
.badge[data-status="failed"], .badge[data-status="canceled"] { color: var(--danger); background: color-mix(in oklab, var(--danger) 12%, transparent); }
.badge[data-status="ok"] { color: var(--ok); background: color-mix(in oklab, var(--ok) 12%, transparent); }
.badge[data-status="error"], .badge[data-status="irreversible"] { color: var(--danger); background: color-mix(in oklab, var(--danger) 12%, transparent); }
.badge[data-status="write"], .badge[data-status="pay"] { color: var(--warning); background: color-mix(in oklab, var(--warning) 14%, transparent); }

.list { display: grid; }
.row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  grid-template-areas: "mark title extra status actions";
  align-items: center;
  gap: 4px 16px;
  min-height: 56px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row > .icon, .row > .brand-mark { grid-area: mark; }
.row-title { grid-area: title; min-width: 0; }
.row-title small { display: block; font-size: 13px; color: var(--text-2); }
.row-extra { grid-area: extra; color: var(--text-2); white-space: nowrap; }
.row-extra small { font-size: 13px; }
.row-status { grid-area: status; justify-self: end; display: flex; align-items: center; gap: 8px; }
.row-actions { grid-area: actions; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; justify-content: flex-end; justify-self: end; }
a.row { color: inherit; text-decoration: none; }
a.row .arrow { grid-area: status; color: var(--text-3); }
a.row:hover .arrow { color: var(--text); }
.brand-mark {
  flex: none;
  display: block;
  width: auto;
  color: var(--text-2);
}

@container (max-width: 560px) {
  .row { gap: 2px 12px; }
  .row:has(.row-actions) {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "mark title status" "mark actions actions";
  }
  .row:has(.row-actions) > .icon, .row:has(.row-actions) > .brand-mark { align-self: start; margin-top: 2px; }
  .row:has(.row-actions) .row-actions { margin-top: 4px; }
  .row:has(.row-extra) {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "mark title status" "mark extra extra" "mark actions actions";
  }
}

.options { display: grid; gap: 4px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--control);
  border-radius: var(--radius);
  cursor: pointer;
}
.option:has(input:checked) { border-color: var(--text); }

.checkout { display: grid; gap: 20px; }
.checkout .pay { width: 100%; }
.checkout .secure { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--text-2); font-size: 12px; }
.checkout .terms { color: var(--text-2); font-size: 12px; text-align: center; }
.checkout .terms a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.summary { display: grid; gap: 10px; }
.summary h3 { font-size: 12px; font-weight: 400; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); }
.summary ul { display: grid; gap: 8px; }
.summary li, .summary .line, .summary .total { display: flex; justify-content: space-between; gap: 12px; }
.summary li, .summary .line { color: var(--text-2); }
.summary .total { margin-top: 6px; font-size: 17px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 0 12px 10px 0; text-align: left; font-size: 12px; font-weight: 400; color: var(--text-2); }
.table td { padding: 12px 12px 12px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .number { text-align: right; font-variant-numeric: tabular-nums; }
@container (max-width: 640px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { margin-bottom: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; }
  .table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border: 0; }
  .table td::before { content: attr(data-label); font-size: 12px; color: var(--text-2); }
  .table td:last-child { justify-content: end; }
}

.card-grid { display: grid; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@container (min-width: 1100px) {
  .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container (max-width: 480px) {
  .card-grid .card { padding: 16px; }
  .card-grid .card .value { font-size: 24px; }
}
.card {
  display: grid;
  min-width: 0;
  gap: 6px;
  align-content: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-4);
  color: inherit;
  text-decoration: none;
}
.card h3 { font-size: 13px; font-weight: 400; color: var(--text-2); }
.card p { color: var(--text-2); }
.card .value { font-size: 32px; font-weight: 300; line-height: 1.1; color: var(--text); white-space: nowrap; }
.card .note { font-size: 13px; overflow-wrap: anywhere; }

.plan-grid { grid-template-columns: 1fr; }
@container (min-width: 640px) {
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.plan-card { perspective: 1400px; }
.plan-card-inner {
  display: grid;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.22, .61, .36, 1);
}
.plan-face {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.plan-front { transform: rotateY(0deg); }
.plan-back { transform: rotateY(180deg); }
.plan-card.flipped .plan-card-inner { transform: rotateY(180deg); }
.plan-front, .plan-back { display: flex; flex-direction: column; gap: 8px; text-align: left; font: inherit; color: inherit; }
.plan-back-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.plan-includes, .plan-explain { display: grid; gap: 8px; align-content: start; }
.plan-explain p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.plan-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-kicker { font-size: 11px; font-weight: 400; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); }
.plan-current {
  padding: 2px 6px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--ok) 12%, transparent);
  color: var(--ok);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.plan-name { font-size: 22px; font-weight: 300; line-height: 1.1; }
.plan-description { font-size: 13px; color: var(--text-2); }
.plan-price { font-size: 24px; font-weight: 300; line-height: 1.1; }
.plan-price small { font-size: 12px; color: var(--text-2); }
.plan-reveal {
  margin-top: auto;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.plan-reveal:hover { color: var(--text); }
.plan-features { display: grid; gap: 6px; margin: 0; padding: 0; font-size: 13px; color: var(--text-2); list-style: none; }
.plan-features li { display: flex; align-items: flex-start; gap: 8px; }
.plan-features li::before { content: ""; flex: none; width: 10px; height: 1px; margin-top: 9px; background: var(--text-3); }
.plan-actions { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.plan-actions .button { width: 100%; }
@media (max-width: 359px) {
  .plan-back-grid { grid-template-columns: 1fr; gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .plan-card-inner { transition: none; }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 41;
  margin: auto;
  width: min(480px, 100% - 32px);
  max-width: none;
  max-height: calc(100% - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-4);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: auto;
  overscroll-behavior: contain;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal-box { display: grid; gap: 16px; padding: 20px 24px 24px; container-type: inline-size; outline: none; }
.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -20px -24px 0;
  padding: 20px 24px 12px;
  background: var(--surface-4);
}
.modal-title { flex: 1; font-size: 20px; font-weight: 300; }
.modal-body p { color: var(--text-2); }
.modal-body .form-error { color: var(--danger); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
body.modal-open { overflow: hidden; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 30;
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-4);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 14px;
}
.toast.error { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 35%, var(--line)); }
.toast[hidden] { display: none; }

.empty { color: var(--text-2); font-weight: 300; }
.muted { color: var(--text-2); }

.profile { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.profile .page-actions { margin: 0; }
.avatar { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 50%; background: var(--highlight); font-size: 24px; font-weight: 300; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.photo-details { display: block; margin-top: 6px; font-size: 13px; color: var(--text-2); }

.form { display: grid; gap: 20px; }
.form-section { display: grid; gap: 10px; }
.form-section .group-title { margin: 0; }
.form > .button { justify-self: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; }
@container (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.page-actions { display: flex; gap: 8px; margin: 20px 0; }
.group { margin-top: 32px; }
.group-title { margin: 0 0 6px; font-size: 12px; font-weight: 400; letter-spacing: .14em; text-transform: uppercase; color: var(--text-2); }
.section-tabs { display: none; }
.group .list { border-top: 1px solid var(--line); }

.skeleton { display: grid; gap: 12px; }
.skeleton i { display: block; height: 14px; border-radius: 4px; background: var(--highlight); }
.skeleton i:nth-child(2) { width: 70%; }
.skeleton i:nth-child(3) { width: 45%; }

.fatal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--surface-3); }
.fatal-box { display: grid; gap: 16px; width: min(420px, 100%); justify-items: center; text-align: center; }
.fatal-title { font-size: 24px; font-weight: 300; }
.fatal-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.pill { display: none; }

.app.collapsed .sidebar .sidebar-header { justify-content: center; padding: 0; }
.app.collapsed .sidebar .sidebar-title, .app.collapsed .sidebar .nav-item span { display: none; }
.app.collapsed .sidebar .nav-list { padding: 4px 8px; }
.app.collapsed .sidebar .nav-item { justify-content: center; padding: 9px 0; }
.app.collapsed .sidebar .sidebar-footer { flex-direction: column; gap: 12px; padding: 12px 8px 16px; }
.app.collapsed .sidebar .sidebar-footer .select-wrap { display: none; }
.app.collapsed .sidebar .sidebar-footer .footer-actions { flex-direction: column; gap: 8px; }

@media (max-width: 767px) {
  :root {
    --pill: 60px;
    --margin: 16px;
    --end: calc(40px + var(--pill) + var(--margin) + env(safe-area-inset-bottom));
  }
  html, body { height: auto; min-height: 100dvh; }
  #app { height: auto; min-height: 100dvh; }
  body { overflow: auto; font-size: 14px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
  .app, .app.collapsed { display: block; height: auto; }
  .sidebar { display: none; }

  .sections { display: none; }
  .content { display: flex; background: var(--surface-3); border: 0; min-height: 100dvh; }
  .content-header {
    position: sticky;
    top: 0;
    z-index: 1;
    height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 16px 0;
    background: var(--surface-3);
  }
  .content-header.with-tabs { height: auto; flex-direction: column; align-items: stretch; padding-bottom: 0; }
  .content-header.with-tabs .page-title { flex: none; display: flex; align-items: center; justify-content: center; width: 100%; height: 56px; }
  .page-title { flex: 1; text-align: center; font-size: 20px; font-weight: 300; }
  .content-body { overflow: visible; padding: 4px 16px var(--end); }
  .section-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 2px;
    margin: 0;
    padding: 0 0 8px;
    border-bottom: 1px solid var(--line);
  }
  .section-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding: 0 4px;
    border-radius: 6px;
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.15;
    text-decoration: none;
    text-align: center;
    overflow: hidden;
    overflow-wrap: anywhere;
  }
  .section-tab.active { color: var(--text); background: var(--highlight); }

  input, select, textarea, .select-wrap select { font-size: 16px; }
  .page-actions { flex-direction: column; }
  .page-actions .button { width: 100%; }
  .page-actions .button.ghost { width: auto; align-self: center; }
  .form > .button { width: 100%; }
  .card-grid { gap: 12px; }
  .card { padding: 16px; }
  .card .value { font-size: 24px; }

  .pill {
    display: flex;
    flex-direction: column;
    gap: var(--margin);
    position: fixed;
    left: var(--margin);
    right: var(--margin);
    bottom: calc(var(--margin) + env(safe-area-inset-bottom));
    z-index: 2;
  }
  .pill-tabs {
    display: flex;
    height: var(--pill);
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in oklab, var(--surface-1) 88%, transparent);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
  }
  .pill-tabs .nav-item { flex: 1; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; padding: 0; border-radius: 999px; font-size: 12px; }
  .pill-tabs .nav-item.active { color: var(--text); background: var(--highlight); }
  .pill-tabs .nav-item:active { transform: scale(.94); }
  .pill-sheet {
    display: none;
    flex-direction: column;
    max-height: 60vh;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface-4);
  }
  body.menu-open .pill-sheet { display: flex; }
  body.menu-open { overflow: hidden; }
  body.menu-open::before { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 1; }
  .pill-sheet .nav-list { flex: 1; overflow-y: auto; padding: 4px 12px; }
  .pill-sheet .sidebar-header { height: auto; padding: 14px 12px 4px; }
  .pill-sheet .sheet-footer { padding: 12px; }

  .modal { width: 100%; max-width: none; max-height: 85%; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .modal-box { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .modal-header { margin: -20px -16px 0; padding: 20px 16px 10px; }
  .modal .form { gap: 14px; }
  .modal-actions { position: sticky; bottom: 0; z-index: 1; flex-direction: column-reverse; padding-top: 12px; background: var(--surface-4); }
  .modal-actions .button { width: 100%; }
  .toast { bottom: calc(var(--pill) + var(--margin) * 2 + env(safe-area-inset-bottom)); }
}

@media (min-width: 360px) and (max-width: 399px) {
  .section-tab { padding: 0 2px; font-size: 12px; }
}

@media (max-width: 359px) {
  .card-grid { grid-template-columns: 1fr; }
  .section-tab { padding: 0; font-size: 11px; }
}


@media (min-width: 768px) and (max-width: 1120px) {
  .app { grid-template-columns: minmax(168px, 15%) minmax(190px, 20%) minmax(0, 1fr); }
  .app.collapsed { grid-template-columns: var(--sidebar-collapsed) minmax(190px, 20%) minmax(0, 1fr); }
  .sidebar-header { padding-left: 16px; padding-right: 8px; }
  .sidebar-footer { padding-left: 8px; padding-right: 8px; flex-wrap: wrap; }
  .sidebar-footer .select-wrap { flex: 1 1 100%; }
  .sidebar-footer .footer-actions { margin-left: auto; }
  .nav-list, .sections-list { padding-left: 8px; padding-right: 8px; }
  .nav-item { gap: 8px; padding-left: 8px; padding-right: 8px; }
}

@media (pointer: coarse) {
  .nav-item { min-height: 44px; }
  .button { height: 44px; }
  .icon-button { width: 44px; height: 44px; }
  .select-wrap select { min-height: 44px; }
  .toggle::before { content: ""; position: absolute; inset: -12px -5px; }
}

.nav-item, .button, .icon-button, .option, .select-wrap select { transition: background .15s, color .15s, border-color .15s, transform .1s; }
.toggle, .toggle i { transition: background .2s, transform .2s; }
.content-body { animation: fade-in .18s ease-out; }
body.menu-open .pill-sheet { animation: slide-up .2s ease-out; }
dialog[open] { animation: fade-in .18s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes slide-up { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .button, .badge, .toggle, .field input, .field select { border: 1px solid ButtonText; }
}

.login-page {
  height: auto;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px;
  background: var(--surface-3);
}
.login-card {
  width: min(380px, 100%);
  display: grid;
  gap: 24px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-4);
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.login-brand img { width: 34px; height: 34px; border-radius: 8px; }
.login-intro { display: grid; gap: 6px; }
.login-title { font-size: 26px; font-weight: 300; }
.login-subtitle { color: var(--text-2); }
.login-form { display: grid; gap: 16px; }
.login-form [hidden] { display: none; }
.login-submit { width: 100%; }
.login-error { min-height: 20px; color: var(--danger); font-size: 13px; }
.login-switch {
  justify-self: center;
  min-height: 44px;
  padding: 10px 8px;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.login-switch:hover { color: var(--text); }
.login-footer { color: var(--text-2); font-size: 12px; text-align: center; }
@media (max-width: 480px) {
  .login-page { padding: 16px; }
  .login-card { padding: 24px 20px; border-radius: 14px; }
}
