/*
 * Quest Records & Reporting — design system.
 * Plain CSS served by Propshaft; every file in this directory is linked.
 */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --brand-900: #0f2f57;
  --brand-800: #163f72;
  --brand-700: #1d4e89;
  --brand-600: #2563a8;
  --brand-100: #e3edf9;
  --brand-50:  #f2f7fd;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-sunken: #eef2f6;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --focus: #2563eb;

  --success-bg: #e8f7ef; --success-fg: #116a3d; --success-bd: #b7e4cb;
  --info-bg: #e8f1fd;    --info-fg: #1d4e89;    --info-bd: #bfd5f5;
  --warning-bg: #fff6e0; --warning-fg: #8a5300; --warning-bd: #f6d58e;
  --danger-bg: #fdecec;  --danger-fg: #a12121;  --danger-bd: #f3bcbc;
  --neutral-bg: #eef2f6; --neutral-fg: #475569; --neutral-bd: #d8dee8;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
  --shadow: 0 1px 3px rgb(15 23 42 / 0.08), 0 4px 12px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 10px 30px rgb(15 23 42 / 0.12);
  --sidebar-w: 256px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #111a2b;
    --surface-2: #142036;
    --surface-sunken: #0e1726;
    --border: #22314a;
    --border-strong: #2f4363;
    --text: #e6edf7;
    --text-2: #a9b6c9;
    --text-3: #8392a8;
    --brand-100: #1b3358;
    --brand-50: #13243f;
    --success-bg: #0f2a1d; --success-fg: #7dd6a5; --success-bd: #1d4d34;
    --info-bg: #10233f;    --info-fg: #93bdf5;    --info-bd: #21426f;
    --warning-bg: #2c2210; --warning-fg: #f2c46b; --warning-bd: #574215;
    --danger-bg: #2d1416;  --danger-fg: #f39b9b;  --danger-bd: #5a2427;
    --neutral-bg: #1a2638; --neutral-fg: #a9b6c9; --neutral-bd: #2a3a52;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { a { color: #7fb0f0; } }
img { max-width: 100%; }
address { font-style: normal; }
code, .mono { font-family: var(--font-mono); font-size: 0.9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.2em; }
.muted { color: var(--text-3); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pre-line { white-space: pre-line; }

/* ---------- Layout helpers ---------- */
.stack > * + * { margin-top: var(--gap, 1rem); }
.stack-sm { --gap: 0.5rem; }
.stack-lg { --gap: 1.5rem; }
.cluster { display: flex; flex-wrap: wrap; gap: var(--gap, 0.5rem); align-items: center; }
.cluster--end { justify-content: flex-end; }
.cluster--between { justify-content: space-between; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
}

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--brand-900);
  color: #dbe6f5;
  padding: 1.1rem 0.85rem;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 0.6rem; padding: 0.25rem 0.5rem 1.25rem; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand__mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #3b82f6, #1d4e89); color: #fff; font-weight: 800; font-size: 0.95rem;
}
.brand__name { font-weight: 700; line-height: 1.1; font-size: 0.98rem; }
.brand__sub { display: block; font-weight: 500; font-size: 0.72rem; color: #9fb4d4; letter-spacing: 0.02em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__section { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: #8ea6c9; padding: 1rem 0.6rem 0.35rem; }
.nav__item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem 0.6rem; border-radius: 8px;
  color: #dbe6f5; text-decoration: none; font-size: 0.92rem; font-weight: 500;
}
.nav__item:hover { background: rgb(255 255 255 / 0.07); text-decoration: none; color: #fff; }
.nav__item.is-active { background: rgb(255 255 255 / 0.13); color: #fff; }
.nav__item .icon { color: #9fb4d4; }
.nav__item.is-active .icon { color: #fff; }
.nav__label { flex: 1; }
.nav__count { background: #3b82f6; color: #fff; font-size: 0.72rem; font-weight: 700; border-radius: 999px; padding: 0 0.45rem; line-height: 1.35rem; min-width: 1.35rem; text-align: center; }
.sidebar__footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgb(255 255 255 / 0.1); }
.user-chip { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem; color: #fff; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; background: #2b5c9a; color: #fff; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
.user-chip__name { font-weight: 600; font-size: 0.9rem; line-height: 1.2; }
.user-chip__role { font-size: 0.75rem; color: #9fb4d4; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem 2rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar__search { flex: 1; max-width: 520px; position: relative; }
.topbar__search .icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.topbar__search input { padding-left: 2.3rem; background: var(--surface-2); }
.menu-toggle { display: none; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.75rem 2rem 4rem; }

.working-as {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.3rem 0.4rem 0.3rem 0.75rem; border-radius: 999px;
  background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--text-2); font-size: 0.85rem;
}
.working-as strong { color: var(--text); }

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); z-index: 50; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgb(15 23 42 / 0.45); z-index: 40; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0.6rem 1rem; }
  .content { padding: 1.25rem 1rem 3rem; }
}

/* ---------- Page header ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header__eyebrow { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 0.35rem; display: flex; gap: 0.5rem; align-items: center; }
.page-header__title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.page-header__subtitle { color: var(--text-2); margin-top: 0.35rem; max-width: 70ch; }
.back-link { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.85rem; color: var(--text-3); margin-bottom: 0.5rem; }
.back-link:hover { color: var(--text); text-decoration: none; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 1rem; }
.card__header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.card__header h2, .card__header h3 { display: flex; align-items: center; gap: 0.5rem; }
.card__subtitle { color: var(--text-3); font-size: 0.85rem; margin-top: 0.15rem; }
.card__body { padding: 1.25rem; }
.card__body--flush { padding: 0; }
.card__footer { padding: 0.85rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card--highlight { border-color: var(--brand-100); box-shadow: 0 0 0 3px var(--brand-50); }
.card--muted { background: var(--surface-2); }
.section-title { font-size: 0.78rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin: 0 0 0.6rem; }

/* ---------- Stats ---------- */
.stat { display: block; padding: 1rem 1.15rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--brand-100); box-shadow: var(--shadow); }
.stat__label { font-size: 0.82rem; color: var(--text-3); font-weight: 500; display: flex; gap: 0.4rem; align-items: center; }
.stat__value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 0.15rem; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 38px; padding: 0.45rem 0.95rem;
  font: inherit; font-size: 0.9rem; font-weight: 600; line-height: 1.2;
  color: var(--btn-fg); background: var(--btn-bg); border: 1px solid var(--btn-bd); border-radius: 8px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn--primary { --btn-bg: var(--brand-700); --btn-fg: #fff; --btn-bd: var(--brand-700); }
.btn--primary:hover { background: var(--brand-800); }
.btn--success { --btn-bg: #15803d; --btn-fg: #fff; --btn-bd: #15803d; }
.btn--success:hover { background: #126c34; }
.btn--danger { --btn-bg: var(--surface); --btn-fg: var(--danger-fg); --btn-bd: var(--danger-bd); }
.btn--danger:hover { background: var(--danger-bg); }
.btn--ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); }
.btn--ghost:hover { background: var(--surface-sunken); color: var(--text); }
.btn--sm { min-height: 30px; padding: 0.25rem 0.65rem; font-size: 0.82rem; border-radius: 7px; }
.btn--icon { padding: 0.4rem; min-width: 34px; }
.btn--block { width: 100%; }
.button_to { display: inline; }
form.button_to { display: inline-flex; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 650; line-height: 1.4rem; border: 1px solid; white-space: nowrap; }
.badge--neutral { background: var(--neutral-bg); color: var(--neutral-fg); border-color: var(--neutral-bd); }
.badge--info    { background: var(--info-bg);    color: var(--info-fg);    border-color: var(--info-bd); }
.badge--success { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
.badge--warning { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }
.badge--danger  { background: var(--danger-bg);  color: var(--danger-fg);  border-color: var(--danger-bd); }

/* ---------- Alerts / flash ---------- */
.alert { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.85rem 1rem; border-radius: var(--radius); border: 1px solid; margin-bottom: 1rem; }
.alert > .icon { margin-top: 0.15rem; }
.alert__body { flex: 1; }
.alert__title { font-weight: 650; margin-bottom: 0.15rem; }
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }
.alert--info    { background: var(--info-bg);    color: var(--info-fg);    border-color: var(--info-bd); }
.alert--success { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
.alert--warning { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }
.alert--danger  { background: var(--danger-bg);  color: var(--danger-fg);  border-color: var(--danger-bd); }
.alert .btn { flex-shrink: 0; }
.flash-stack { margin-bottom: 1rem; }
.flash-stack .alert { box-shadow: var(--shadow-sm); }
.flash__close { background: none; border: 0; color: inherit; cursor: pointer; opacity: 0.65; padding: 0.1rem; }
.flash__close:hover { opacity: 1; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; scrollbar-width: none; }
.tabs__item { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.7rem 0.9rem; color: var(--text-2); font-weight: 600; font-size: 0.9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs__item:hover { color: var(--text); text-decoration: none; }
.tabs__item.is-active { color: var(--brand-700); border-bottom-color: var(--brand-700); }
@media (prefers-color-scheme: dark) { .tabs__item.is-active { color: #93bdf5; border-bottom-color: #93bdf5; } }
.tabs__count { font-size: 0.72rem; background: var(--surface-sunken); color: var(--text-2); border-radius: 999px; padding: 0 0.45rem; }

/* ---------- Split (list + detail) ---------- */
.split { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.split__aside { position: sticky; top: 76px; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } .split__aside { position: static; } }
.picker { display: flex; flex-direction: column; gap: 2px; padding: 0.4rem; }
.picker__item { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.65rem; border-radius: 8px; color: var(--text); font-weight: 500; font-size: 0.92rem; }
.picker__item:hover { background: var(--surface-sunken); text-decoration: none; }
.picker__item.is-active { background: var(--brand-50); color: var(--brand-700); box-shadow: inset 3px 0 0 var(--brand-700); }
@media (prefers-color-scheme: dark) { .picker__item.is-active { color: #cfe0f8; } }
.picker__item .icon { color: var(--text-3); }
.picker__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker__meta { font-size: 0.75rem; color: var(--text-3); }

/* ---------- Description lists ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem 1.5rem; margin: 0; }
.facts--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts dt { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin-bottom: 0.2rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .facts--2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: left; font-size: 0.75rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); background: var(--surface-2); padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.table--compact td { padding: 0.5rem 1rem; }
.row-title { font-weight: 600; color: var(--text); }
.row-sub { font-size: 0.82rem; color: var(--text-3); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list__item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border); }
.list__item:last-child { border-bottom: 0; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: 600; overflow-wrap: anywhere; }
.list__meta { font-size: 0.82rem; color: var(--text-3); }
.file-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.75rem; border-radius: 8px; }
.file-row:hover { background: var(--surface-2); }
.file-row .icon { color: var(--brand-600); }
.file-row__name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; margin: 0; padding: 0; }
.tag { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.55rem; border-radius: 6px; background: var(--surface-sunken); color: var(--text-2); font-size: 0.82rem; }

/* ---------- Case list ---------- */
.case { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem 1.25rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.case:last-child { border-bottom: 0; }
.case__title { font-weight: 650; font-size: 1.02rem; color: var(--text); overflow-wrap: anywhere; }
.case__meta { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; color: var(--text-3); font-size: 0.85rem; margin-top: 0.25rem; }
.case__meta span { display: inline-flex; align-items: center; gap: 0.3rem; }
.case__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; align-items: flex-start; }
@media (max-width: 720px) { .case { grid-template-columns: minmax(0, 1fr); } .case__actions { justify-content: flex-start; } }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 2.5rem 1.5rem; color: var(--text-2); }
.empty__icon { width: 2.4rem; height: 2.4rem; color: var(--text-3); margin-bottom: 0.6rem; }
.empty__title { font-size: 1.02rem; color: var(--text); margin-bottom: 0.3rem; }
.empty__body { max-width: 46ch; margin: 0 auto 1rem; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 1.1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .form-grid, .form-grid--3 { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field label, .label { font-size: 0.85rem; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 0.8rem; color: var(--text-3); }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=search],
.field input[type=tel], .field input[type=url], .field input[type=number], .field input[type=date], .field input[type=time],
.field input[type=datetime-local], .field input[type=file], .field select, .field textarea, .topbar__search input {
  width: 100%; min-height: 40px; padding: 0.5rem 0.75rem;
  font: inherit; font-size: 0.95rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input[type=file] { padding: 0.4rem; background: var(--surface-2); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, .topbar__search input:focus {
  outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 3px rgb(37 99 235 / 0.18);
}
.field_with_errors { display: contents; }
.field_with_errors input, .field_with_errors select, .field_with_errors textarea { border-color: var(--danger-fg); }
.choice { display: inline-flex; align-items: flex-start; gap: 0.5rem; font-size: 0.92rem; color: var(--text); cursor: pointer; }
.choice input { width: 1.05rem; height: 1.05rem; margin: 0.15rem 0 0; accent-color: var(--brand-700); flex-shrink: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.45rem 1rem; padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); max-height: 280px; overflow-y: auto; }
.choice-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.inline-fields { display: flex; gap: 0.5rem; align-items: flex-end; }
.inline-fields .field { flex: 1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; padding-top: 0.25rem; }
.form-actions--split { justify-content: space-between; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem 1.1rem; margin: 0; min-width: 0; }
legend { font-weight: 650; font-size: 0.9rem; padding: 0 0.4rem; color: var(--text); }
.fieldset-grid { display: grid; gap: 1rem; }
.form-section + .form-section { border-top: 1px solid var(--border); padding-top: 1.25rem; }
.form-section__title { font-size: 0.95rem; margin-bottom: 0.75rem; }
.kind-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 860px) { .kind-picker { grid-template-columns: minmax(0, 1fr); } }
.kind-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.kind-card:hover { text-decoration: none; border-color: var(--brand-600); box-shadow: var(--shadow); }
.kind-card.is-active { border-color: var(--brand-700); box-shadow: 0 0 0 3px var(--brand-100); }
.kind-card__icon { width: 2.2rem; height: 2.2rem; padding: 0.45rem; border-radius: 9px; background: var(--brand-50); color: var(--brand-700); }
.kind-card__title { font-weight: 650; }
.kind-card__body { color: var(--text-2); font-size: 0.88rem; }

/* ---------- Pagination (pagy) ---------- */
.pagy { display: flex; flex-wrap: wrap; gap: 0.25rem; justify-content: center; padding: 1rem 0 0; font-size: 0.88rem; }
.pagy a { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 0.6rem; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); }
.pagy a:hover { text-decoration: none; background: var(--surface-2); }
.pagy a.current { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.pagy a.gap, .pagy a:not([href]) { opacity: 0.55; }

/* ---------- Letter index ---------- */
.letters { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.letters a { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; color: var(--text-2); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; }
.letters a:hover { background: var(--surface-sunken); text-decoration: none; }
.letters a.is-active { background: var(--brand-700); color: #fff; }

/* ---------- Calendar ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.calendar__dow { padding: 0.5rem; font-size: 0.75rem; font-weight: 650; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.calendar__day { min-height: 112px; padding: 0.4rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.25rem; }
.calendar__day.is-outside { background: var(--surface-2); color: var(--text-3); }
.calendar__day.is-today .calendar__date { background: var(--brand-700); color: #fff; }
.calendar__date { align-self: flex-start; font-size: 0.8rem; font-weight: 650; padding: 0 0.4rem; border-radius: 999px; line-height: 1.5rem; }
.calendar__event { display: block; font-size: 0.75rem; line-height: 1.3; padding: 0.25rem 0.4rem; border-radius: 6px; background: var(--info-bg); color: var(--info-fg); border-left: 3px solid var(--brand-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar__event:hover { text-decoration: none; filter: brightness(0.97); }
@media (max-width: 760px) { .calendar__day { min-height: 70px; } .calendar__event { white-space: normal; } }

/* ---------- Steps / timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 0.9rem 1.3rem; font-size: 0.88rem; }
.timeline li::before { content: ""; position: absolute; left: 0.25rem; top: 0.45rem; width: 7px; height: 7px; border-radius: 999px; background: var(--brand-600); }
.timeline li::after { content: ""; position: absolute; left: 0.45rem; top: 1rem; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }

.workflow-links { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; }

.note { padding: 0.75rem 0.9rem; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.note + .note { margin-top: 0.5rem; }
.note__meta { font-size: 0.78rem; color: var(--text-3); margin-bottom: 0.2rem; display: flex; justify-content: space-between; gap: 0.5rem; }

details.disclosure > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; color: var(--brand-600); }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure[open] > summary .icon { transform: rotate(180deg); }
details.disclosure > .disclosure__body { margin-top: 0.85rem; }

/* ---------- Public site ---------- */
.public { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.public-header { background: var(--brand-900); color: #fff; }
.public-header__inner { max-width: 1180px; margin: 0 auto; padding: 0.85rem 1.5rem; display: flex; align-items: center; gap: 1.5rem; }
.public-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; flex: 1; justify-content: flex-end; align-items: center; }
.public-nav a { color: #d7e3f4; font-size: 0.92rem; font-weight: 500; }
.public-nav a:hover { color: #fff; text-decoration: none; }
.public-nav .btn { color: var(--brand-900); }
.hero { background: radial-gradient(1200px 400px at 80% -10%, #2c6cc0 0%, transparent 60%), linear-gradient(160deg, var(--brand-900), #1a4478); color: #fff; }
.hero__inner { max-width: 1180px; margin: 0 auto; padding: 4rem 1.5rem 4.5rem; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr); gap: 3rem; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4vw, 2.9rem); letter-spacing: -0.025em; margin-bottom: 1rem; }
.hero p { color: #cfdcf0; font-size: 1.08rem; max-width: 52ch; }
.hero .card { color: var(--text); }
@media (max-width: 900px) { .hero__inner { grid-template-columns: minmax(0, 1fr); padding: 2.5rem 1.25rem; } }
.public-main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
.prose { max-width: 78ch; }
.prose h1 { margin-bottom: 1rem; }
.prose h2 { margin: 2rem 0 0.6rem; }
.prose h3 { margin: 1.4rem 0 0.4rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1rem; }
.prose li { margin-bottom: 0.3rem; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: minmax(0, 1fr); } }
.feature .icon { width: 2rem; height: 2rem; padding: 0.4rem; border-radius: 9px; background: var(--brand-50); color: var(--brand-700); margin-bottom: 0.6rem; }
.public-footer { background: var(--surface); border-top: 1px solid var(--border); }
.public-footer__inner { max-width: 1180px; margin: 0 auto; padding: 2rem 1.5rem; display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; justify-content: space-between; color: var(--text-2); font-size: 0.88rem; }
.public-footer a { color: var(--text-2); }
.auth-card { max-width: 440px; margin: 2rem auto; }

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .tabs, .flash-stack, .no-print, .btn { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

.with-aside { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .with-aside { grid-template-columns: minmax(0, 1fr); } }
.hero .card p { color: var(--text-3); font-size: 0.9rem; }
.grid > .card + .card, .feature-grid > .card + .card, .with-aside > .card + .card, .split > .card + .card { margin-top: 0; }
.topbar__search input[type=search] { padding-left: 2.3rem; }
.btn.menu-toggle { display: none; }
@media (max-width: 960px) { .btn.menu-toggle { display: inline-flex; } }
