/* Gängeviertel Selfservice — design system (wave 0)
   Layered over app.css. Never edited app.css; every rule here overrides or
   extends it and says why in a comment.

   Identity: Gängeviertel red, black ink, warm paper. One accent, no violet,
   no gradient, no decorative shadow. One system: one type pairing, one
   radius family, one hairline, one focus ring, one ground logic. */

/* ------------------------------------------------------------------ */
/* 1. Typefaces                                                        */
/* ------------------------------------------------------------------ */

/* Nobile is the display face of das-gaengeviertel.info, so the portal reads
   as the same brand. The four woff2 files are the Google Fonts latin subset
   (German umlauts and ß included), vendored under static/fonts/ and served
   from our own origin: no font host is contacted at runtime. Nobile is
   licensed under the SIL Open Font License 1.1; the licence text ships beside
   the files in static/fonts/OFL.txt. */
@font-face {
  font-family: "Nobile";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/nobile-regular.woff2?v=19") 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: "Nobile";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/nobile-italic.woff2?v=19") 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: "Nobile";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/nobile-bold.woff2?v=19") 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: "Nobile";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/nobile-bold-italic.woff2?v=19") 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;
}

/* ------------------------------------------------------------------ */
/* 2. Tokens                                                           */
/* ------------------------------------------------------------------ */

:root {
  /* Type. Nobile carries every heading (the same display face as the main
     site); Arial and its metric-compatible kin carry body and UI text. Both
     stacks end in a generic family, so a missing local font still degrades
     to readable text without a remote request. */
  --font-sans: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --font-display: "Nobile", Arial, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Warm paper grounds */
  --bg: #f6f2ec;
  --bg-soft: #efe9e1;
  --surface: #fffcf6;
  --input-bg: #fffcf6;
  --text: #1d1711;
  --muted: #6d6155;
  --border: #e4dbcf;
  --border-strong: #c9bdb0;

  /* The one accent: Gängeviertel red */
  --accent: #c4000c;
  --accent-hover: #a0000a;
  --accent-soft: #f9e9e6;
  --accent-text: #8c0008;
  --on-accent: #ffffff;
  --link: #9d0009;
  --link-hover: #c4000c;

  --success-text: #14512f;
  --success-soft: #e9f4ed;
  --success-border: #bfdcc9;
  --warning-text: #6b4600;
  --warning-soft: #fdf4e1;
  --warning-border: #e8d3a2;
  --danger-text: #8f0007;
  --danger-soft: #fdeaea;
  --danger-border: #f0c4c4;

  --focus: #1d1711;             /* ring on a red surface (primary button) */
  --header-bg: var(--bg);       /* opaque header: no blur, no translucency */
  --row-hover: rgba(196, 0, 12, 0.04);
  --placeholder: #7c6e62;       /* ≥4.5:1 on the surface, still reads as hint */
  --shadow-menu: 0 12px 32px rgba(29, 23, 17, 0.16); /* floating layers only */

  /* One radius family */
  --radius: 6px;
  --radius-lg: 10px;
  --radius-pill: 999px;
  --container: 1040px;

  /* Spacing rhythm */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
}

/* Dark: same system, warm near-black ground. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161210;
    --bg-soft: #201a17;
    --surface: #1c1714;
    --input-bg: #191411;
    --text: #f3eee7;
    --muted: #b6aa9e;
    --border: #382f2a;
    --border-strong: #5d524b;
    --accent: #e0261d;
    --accent-hover: #f23c33;
    --accent-soft: #3a1c19;
    --accent-text: #ffa39b;
    --on-accent: #ffffff;
    --link: #ff8f86;
    --link-hover: #ffb2ac;
    --success-text: #b7e8c8;
    --success-soft: #152a1e;
    --success-border: #2c5740;
    --warning-text: #f3d99f;
    --warning-soft: #2b2314;
    --warning-border: #55441f;
    --danger-text: #ffc3c3;
    --danger-soft: #341a1c;
    --danger-border: #5f2c30;
    --focus: #f3eee7;
    --header-bg: var(--bg);
    --row-hover: rgba(224, 38, 29, 0.06);
    --placeholder: #9a8d81;
    --shadow-menu: 0 14px 40px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161210;
  --bg-soft: #201a17;
  --surface: #1c1714;
  --input-bg: #191411;
  --text: #f3eee7;
  --muted: #b6aa9e;
  --border: #382f2a;
  --border-strong: #5d524b;
  --accent: #e0261d;
  --accent-hover: #f23c33;
  --accent-soft: #3a1c19;
  --accent-text: #ffa39b;
  --on-accent: #ffffff;
  --link: #ff8f86;
  --link-hover: #ffb2ac;
  --success-text: #b7e8c8;
  --success-soft: #152a1e;
  --success-border: #2c5740;
  --warning-text: #f3d99f;
  --warning-soft: #2b2314;
  --warning-border: #55441f;
  --danger-text: #ffc3c3;
  --danger-soft: #341a1c;
  --danger-border: #5f2c30;
  --focus: #f3eee7;
  --header-bg: var(--bg);
  --row-hover: rgba(224, 38, 29, 0.06);
  --placeholder: #9a8d81;
  --shadow-menu: 0 14px 40px rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------------------------ */
/* 3. Typography                                                       */
/* ------------------------------------------------------------------ */

body {
  /* One sans for everything readable; Nobile Bold carries headings. */
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
}

/* Headings: Nobile Bold, size + slightly tight tracking. Nobile has a larger
   x-height than the old serif, so the scale is a touch smaller and tracking is
   relaxed to keep the lines from crowding. */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}
h1 {
  font-size: clamp(1.65rem, 2vw + 0.6rem, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.12;
}
h2 { font-size: clamp(1.15rem, 1.1vw + 0.7rem, 1.35rem); letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: 0; line-height: 1.3; }
strong { font-weight: 700; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }

/* Small meta text stays 14px; nothing readable under 13px. */
.small { font-size: 0.875rem; }
.lede { font-size: 1rem; line-height: 1.6; color: var(--muted); }
.row-sub, .form-note, .row-note, .pagination-page, .meta-list > div,
.footer, .invite-url, .cell-sub, .notif-text, .group-desc, .app-desc {
  font-size: 0.875rem;
}

/* ------------------------------------------------------------------ */
/* 4. Focus ring + scroll clearance                                    */
/* ------------------------------------------------------------------ */

/* One 2px accent ring, never animated, never hidden under the header. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}
/* On a filled red control the red ring would vanish: use ink instead. */
.btn-primary:focus-visible,
.theme-option.is-active:focus-visible,
.lang-link.is-active:focus-visible,
.skip-link:focus-visible,
.avatar:focus-visible {
  outline-color: var(--focus);
}
/* Anchor / focused targets clear the sticky header. --header-offset is
   measured by app.js; the fallback covers no-JS. */
.page-main :is(section, h1, h2, h3, h4, [id], .row, .group-row) {
  scroll-margin-top: calc(var(--header-offset, 7rem) + 0.75rem);
}

/* ------------------------------------------------------------------ */
/* 5. The shell: header, nav, user menu, footer                        */
/* ------------------------------------------------------------------ */

.site-header {
  /* Opaque from the first paint, one hairline, same at every scroll depth:
     overrides the translucent blur in app.css. */
  background: var(--header-bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-bottom: 1px solid var(--border);
}

/* Wordmark: sentence case in Nobile Bold, larger and warmer. */
.brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.brand-sub {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
}

/* Nav: quiet underline-draw hover, a 2px red bar marks the current page. */
.nav-link { font-size: 0.9rem; font-weight: 500; }
.nav-link.is-active::after { height: 2px; background: var(--accent); }

/* Icon / user-menu buttons keep a 44px target. */
.bell-link { width: 2.75rem; height: 2.75rem; }
.user-menu > summary { min-height: 2.75rem; }
.user-menu-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-menu);
}
.menu-link { font-size: 0.9rem; font-weight: 500; }
.menu-label { font-size: 0.8125rem; font-weight: 500; }

/* Footer: quiet, hairline top, tabular meta. */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.875rem; }

/* Skip link: the filled red action, appears above the logo on first Tab. */
.skip-link { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* ------------------------------------------------------------------ */
/* 6. Surfaces and radii                                               */
/* ------------------------------------------------------------------ */

/* One card recipe: flat surface on the ground, one hairline, one radius. */
.panel,
.auth-card,
.stat-card,
.app-card,
.decision,
.logout-choice,
.error-card,
.audit-filters,
.table-wrap,
.queue-card,
.disclosure-form,
.notice,
.flash {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.queue-card { border-color: var(--accent); background: var(--accent-soft); }
.flash, .notice { border-radius: var(--radius); }

/* ------------------------------------------------------------------ */
/* 7. Buttons                                                          */
/* ------------------------------------------------------------------ */

.btn {
  min-height: 2.75rem;               /* 44px target */
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius);
  font-size: 1rem;                   /* 16px label */
  font-weight: 600;
  line-height: 1.2;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
/* Compact buttons are actions, so they keep the 44px target. The only smaller
   controls are the quick-fill expiry presets below, which own their rule. */
.btn-sm { min-height: 2.75rem; padding: 0.4rem 0.85rem; font-size: 0.875rem; }
.btn-primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { border-color: var(--border-strong); background: var(--surface); color: var(--text); }
.btn-secondary:hover { background: var(--bg-soft); color: var(--text); }
.btn-ghost { color: var(--muted); }
.btn-danger { border-color: var(--danger-border); color: var(--danger-text); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; }

/* Text link: quiet, arrow moves on hover (see motion). */
.text-link { color: var(--link); font-weight: 600; }

/* Quick-fill expiry presets ("30 days", "90 days", "1 year") are controls,
   not body text: a quiet outline chip that sits below the input row and never
   competes with the one filled Approve button. */
.expiry-quick { gap: var(--s-2); }
.expiry-quick .btn {
  min-height: 2.75rem;
  padding: 0.35rem 0.9rem;
  border-color: var(--border-strong);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
}
.expiry-quick .btn:hover { border-color: var(--accent); background: var(--surface); color: var(--text); }

/* The expiry line under the fields states the outcome. Untouched it is the
   instruction for the missing choice, so it reads as a quiet notice; a chosen
   date is plain text, no expiry is muted meta. */
.expiry-summary { font-size: 0.875rem; font-weight: 500; }
.expiry-summary[data-expiry-state="until"] { color: var(--text); }
.expiry-summary[data-expiry-state="none"] { color: var(--muted); }
.expiry-summary[data-expiry-state="choose"] {
  padding: var(--s-1) var(--s-3);
  border-left: 2px solid var(--warning-border);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--warning-soft);
  color: var(--warning-text);
  font-weight: 400;
  line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/* 8. Inputs, selects, textareas                                       */
/* ------------------------------------------------------------------ */

.field > label { font-size: 0.8125rem; font-weight: 600; color: var(--text); }
.field input[type="text"], .field input[type="email"], .field input[type="search"],
.field input[type="number"], .field input[type="url"], .field input[type="password"],
.field input[type="date"], .field select, .field textarea, .search-field input,
.search-select {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
}
.field input:focus, .field select:focus, .field textarea:focus,
.search-field input:focus, .search-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder, .field textarea::placeholder,
.search-field input::placeholder { color: var(--placeholder); opacity: 1; }
.checkbox-field { font-size: 0.95rem; }
.checkbox-field input[type="checkbox"] { accent-color: var(--accent); }

/* ------------------------------------------------------------------ */
/* 9. Badges and chips                                                 */
/* ------------------------------------------------------------------ */

.badge {
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.8125rem;               /* 13px: raised from 11.5px in app.css */
  font-weight: 600;
  line-height: 1.5;
}
.badge-success, .badge-ok { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }
.badge-warning, .badge-pending { border-color: var(--warning-border); background: var(--warning-soft); color: var(--warning-text); }
.badge-danger, .badge-error { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }
.badge-admin { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.chip { border-radius: var(--radius-pill); background: var(--bg-soft); color: var(--muted); font-size: 0.8125rem; }

/* Eyebrow labels: sentence case, 13px, no tracked capitals. Overrides the
   uppercase/letter-spacing in app.css per the "no small caps" rule. */
.detail-block h3,
.access-heading,
.stat-label,
.app-category-label,
.group-cat,
.help-sidebar h2,
.data-table th {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.detail-block h3, .access-heading, .group-cat { font-size: 0.8125rem; }
.stat-label, .app-category-label, .help-sidebar h2 { font-size: 0.8125rem; }

/* ------------------------------------------------------------------ */
/* 10. Cards, rows and lists                                            */
/* ------------------------------------------------------------------ */

.row { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row-main strong { font-size: 1rem; font-weight: 600; }
.row-sub { font-size: 0.875rem; color: var(--muted); }

.group-row { padding: 1.15rem 0; border-bottom: 1px solid var(--border); }
.group-title h2 { font-size: 1.1rem; font-weight: 700; }
.group-desc { font-size: 0.9rem; }
.group-status { font-size: 0.875rem; }

.app-card, .app-mini { border-radius: var(--radius); transition: border-color 150ms ease, background-color 150ms ease; }
.app-name { font-size: 0.95rem; font-weight: 600; }

/* ------------------------------------------------------------------ */
/* 11. Tables                                                          */
/* ------------------------------------------------------------------ */

.table-wrap { border-radius: var(--radius-lg); }
.data-table th {
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.8125rem;               /* sentence case, see badges */
  font-weight: 600;
}
.data-table tbody tr:hover { background: var(--row-hover); }

/* ------------------------------------------------------------------ */
/* 12. Section heads, empty notes, flash, pagination                   */
/* ------------------------------------------------------------------ */

.section-head h2, .section-head h3 { font-weight: 700; }
/* One section-head recipe on every page: title left, one quiet action right,
   a 12px gap under it. */
.section-head {
  align-items: baseline;
  gap: var(--s-1) var(--s-4);
  margin-bottom: var(--s-3);
}
.page-head { padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.page-head h1 { margin: 0; }

.empty { border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); }
.empty h3 { font-weight: 700; }
.empty-note { color: var(--muted); font-size: 0.9rem; }

.flash { border-radius: var(--radius); font-size: 0.925rem; }
.flash-notice { border-color: var(--success-border); border-left-color: var(--success-text); background: var(--success-soft); color: var(--success-text); }
.flash-error { border-color: var(--danger-border); border-left-color: var(--danger-text); background: var(--danger-soft); color: var(--danger-text); }

.pagination-page { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ */
/* 13. Auth (login)                                                    */
/* ------------------------------------------------------------------ */

.auth-card h1 { font-weight: 700; }
.auth-card .lede { font-size: 1rem; }
.auth-card-mark { margin: 0 auto 1.1rem; }

/* ------------------------------------------------------------------ */
/* 14. Motion                                                          */
/* ------------------------------------------------------------------ */

@keyframes ds-rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  /* Quiet staggered load, the one page-load motion. */
  .page-main .stack > * { animation: ds-rise 0.24s ease-out both; }
  .page-main .stack > *:nth-child(2) { animation-delay: 0.03s; }
  .page-main .stack > *:nth-child(3) { animation-delay: 0.06s; }
  .page-main .stack > *:nth-child(4) { animation-delay: 0.09s; }
  .page-main .stack > *:nth-child(5) { animation-delay: 0.12s; }
  .page-main .stack > *:nth-child(6) { animation-delay: 0.15s; }
  /* Text-link arrows slide 3px; buttons do not transform. */
  .text-link svg { transition: transform 150ms ease; }
  .text-link:hover svg { transform: translateX(3px); }
  .btn svg { transition: transform 150ms ease; }
  .btn:hover svg { transform: translateX(1px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------ */
/* 15. Print                                                           */
/* ------------------------------------------------------------------ */

@media print {
  body { background: #ffffff; color: #000000; }
  .site-header, .site-footer, .skip-link, .page-actions, .btn, .flash-stack,
  .help-sidebar, .breadcrumb { display: none !important; }
  .panel, .decision, .table-wrap, .auth-card, .error-card { border-color: #cccccc; box-shadow: none; }
}
