/*
 * Theme "bauhoefe-st-anton": internal project area.
 * Loads after the platform theme.css: overrides its variables, then lays out the project pages.
 * House rules: surfaces instead of lines, no shadows or gradients, square corners (var(--radius)).
 * Accent is the orange of municipal service vehicles; it marks actions and the current state only.
 */

:root {
  --color-primary: #22333a;          /* slate: header, headings, buttons */
  --color-accent: #d9601a;           /* municipal orange: current page, focus, running pilots */
  --color-background: #f2f3f1;
  --color-surface: #ffffff;
  --color-text: #1b2226;
  --color-text-muted: #5a656b;
  --color-border: #dfe3e0;
  --color-on-primary: #eef2f0;
  --font-heading: "Inter", Arial, sans-serif;
  --font-body: "Inter", Arial, sans-serif;

  --bsa-sunk: #e7eae7;
  --bsa-accent-soft: #fbe7da;
  --bsa-ok: #2e7d4f;
  --bsa-ok-soft: #ddefe3;
  --bsa-wait: #5a656b;
  --bsa-width: 1180px;
}

body.bsa {
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.55;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.bsa h1, .bsa h2, .bsa h3 { font-family: var(--font-heading); font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; margin: 0; color: var(--color-primary); }
.bsa h1 { font-size: clamp(1.75rem, 3vw, 2.375rem); line-height: 1.15; }
.bsa h2 { font-size: 1.25rem; line-height: 1.25; }
.bsa h3 { font-size: 1.0625rem; }
.bsa :focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.bsa a { color: var(--color-primary); }

.bsa-wrap { max-width: var(--bsa-width); margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Header */
.bsa-top { background: var(--color-primary); color: var(--color-on-primary); }
.bsa-top__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding-block: 14px; }
.bsa-brand { display: grid; color: inherit; text-decoration: none; line-height: 1.2; }
.bsa-brand strong { font-size: 1.1875rem; font-weight: 600; }
.bsa-brand span { font-size: var(--text-small); opacity: 0.72; }
.bsa .bsa-brand { color: var(--color-on-primary); }
.bsa-user { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-small); }
.bsa-user form { margin: 0; }
.bsa-user__name { opacity: 0.72; }
.bsa .bsa-user__link { color: var(--color-on-primary); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Area navigation: a light band under the header, current page marked in orange */
.bsa-nav { background: var(--color-surface); }
.bsa-nav ul { display: flex; gap: var(--space-1); list-style: none; margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.bsa-nav li { flex: none; }
.bsa-nav a { display: block; padding: 14px 12px 11px; color: var(--color-text-muted); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent; }
.bsa-nav a:hover { color: var(--color-text); }
.bsa-nav a[aria-current="page"] { color: var(--color-text); border-bottom-color: var(--color-accent); }

.bsa-main { flex: 1; }
.bsa-page { padding-block: var(--space-4) var(--space-5); display: grid; gap: var(--space-3); }

.bsa-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--space-2); }
.bsa-head > div { display: grid; gap: var(--space-1); min-width: 0; }
.bsa-lead { color: var(--color-text-muted); max-width: 62ch; margin: 0; }
.bsa-head .bsa-pill { justify-self: start; }
.bsa-crumb { margin: 0; font-size: var(--text-small); color: var(--color-text-muted); }
.bsa .button { background: var(--color-accent); color: #fff; }
.bsa .button:hover { background: color-mix(in srgb, var(--color-accent) 85%, black); color: #fff; }

/* Surfaces */
.bsa-panel { background: var(--color-surface); border-radius: var(--radius); padding: var(--space-3); display: grid; gap: var(--space-2); align-content: start; min-width: 0; }
.bsa-panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.bsa-panel__head a { font-weight: 600; font-size: var(--text-small); }
.bsa-dash { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-3); align-items: start; }
.bsa-stack { display: grid; gap: var(--space-3); min-width: 0; }
.bsa-section { display: grid; gap: var(--space-2); margin-top: var(--space-2); }
.bsa-group { margin-top: var(--space-1) !important; color: var(--color-text-muted) !important; font-size: var(--text-small) !important; font-weight: 600; }
.bsa-empty { color: var(--color-text-muted); margin: 0; }
.bsa-meta { color: var(--color-text-muted); font-size: var(--text-small); }

/* Notes from the Projektbüro (block "Hinweis" of the platform) */
.bsa-notes { display: grid; gap: var(--space-1); }
.bsa .hinweis { background: var(--color-surface); border-left: 4px solid var(--color-primary); border-radius: 0 var(--radius) var(--radius) 0; padding: var(--space-2) var(--space-3); }
.bsa .hinweis--wichtig { border-left-color: var(--color-accent); background: var(--bsa-accent-soft); }

/* Rows: documents and dates; separated by spacing and a sunk hover surface, not by lines */
.bsa-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bsa-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-2); align-items: center; padding: 10px 12px; margin-inline: -12px; border-radius: var(--radius); text-decoration: none; color: inherit; }
a.bsa-row:hover { background: var(--bsa-sunk); }
a.bsa-row:hover strong { color: var(--color-accent); }
.bsa-row--static { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
.bsa-row__main { display: grid; gap: 2px; min-width: 0; }
.bsa-row__main strong { font-weight: 600; overflow-wrap: anywhere; }
.bsa-desc { font-size: var(--text-small); }
.bsa-fmt { background: var(--bsa-sunk); color: var(--color-text-muted); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; min-width: 48px; text-align: center; padding: 4px 6px; border-radius: var(--radius); }
.bsa-date { display: grid; justify-items: center; width: 52px; padding: 6px 0; background: var(--bsa-sunk); border-radius: var(--radius); line-height: 1; }
.bsa-date b { font-size: 1.375rem; color: var(--color-primary); }
.bsa-date span { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 4px; }

/* Sub-project tiles */
.bsa-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--space-2); }
.bsa-tile { display: grid; grid-template-rows: auto 1fr auto; gap: var(--space-1); align-content: start; height: 100%; padding: var(--space-2) var(--space-3) var(--space-3); background: var(--color-surface); border-radius: var(--radius); border-top: 4px solid var(--bsa-sunk); color: inherit; text-decoration: none; }
.bsa-tile:hover { border-top-color: var(--color-accent); }
.bsa-tile strong { font-size: 1.0625rem; font-weight: 600; color: var(--color-primary); }
.bsa-tile span { color: var(--color-text-muted); font-size: var(--text-small); }
.bsa-tile .bsa-pill { justify-self: start; align-self: end; margin-top: 4px; }

/* Status: colour plus a dot, so it reads without colour too */
.bsa-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.bsa-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bsa .bsa-pill--laufend { background: var(--bsa-accent-soft); color: #a8470f; }
.bsa .bsa-pill--geplant { background: var(--bsa-sunk); color: var(--bsa-wait); }
.bsa .bsa-pill--abgeschlossen { background: var(--bsa-ok-soft); color: var(--bsa-ok); }

/* Key/value list (Steckbrief) */
.bsa-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-1) var(--space-3); margin: 0; }
.bsa-kv dt { color: var(--color-text-muted); }
.bsa-kv dd { margin: 0; }

/* Documents table */
.bsa-tools { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.bsa-search { flex: 1 1 240px; max-width: 360px; padding: 10px 12px; font: inherit; background: var(--color-surface); border: 0; border-radius: var(--radius); }
.bsa-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bsa-chips a { padding: 6px 12px; border-radius: 999px; background: var(--color-surface); color: var(--color-text); text-decoration: none; font-size: var(--text-small); font-weight: 600; }
.bsa-chips a:hover { background: var(--bsa-sunk); }
.bsa-chips a[aria-current="true"] { background: var(--color-primary); color: var(--color-on-primary); }
.bsa-table { overflow-x: auto; background: var(--color-surface); border-radius: var(--radius); }
.bsa-table table { width: 100%; min-width: 680px; border-collapse: collapse; }
.bsa-table th, .bsa-table td { text-align: left; padding: 12px 16px; vertical-align: top; }
.bsa-table th { background: var(--bsa-sunk); color: var(--color-text-muted); font-size: var(--text-small); font-weight: 600; }
.bsa-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--bsa-sunk) 45%, transparent); }
.bsa-table td a { font-weight: 600; }
.bsa-table td:nth-child(4), .bsa-table td:nth-child(5) { white-space: nowrap; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.bsa-table .bsa-empty { padding: var(--space-3); }

/* Dates page */
.bsa-past summary { cursor: pointer; font-weight: 600; color: var(--color-primary); }
.bsa-past[open] summary { margin-bottom: var(--space-2); }

/* Knowledge and FAQ (blocks of the platform) */
.bsa-body { gap: 12px; }
.bsa-body > * { margin: 0 !important; max-width: 70ch; }
.bsa-body > :not(.faq, .hinweis) { padding-block: 0 !important; }
.bsa-body > * + :is(h2, h3, .heading-block) { margin-top: var(--space-3) !important; }
.bsa .faq { background: var(--color-background); border: 0; border-radius: var(--radius); padding: 14px var(--space-2) !important; }

/* Login and account pages of the platform (core/login.html) */
.bsa .account { max-width: 420px; margin: var(--space-5) auto; background: var(--color-surface); padding: var(--space-4); border-radius: var(--radius); }
.bsa .account h1 { margin-bottom: var(--space-3); }
.bsa .form-field input { background: var(--color-background); border: 0; border-radius: var(--radius); }

/* Footer */
.bsa-foot { padding-block: var(--space-3); color: var(--color-text-muted); font-size: var(--text-small); }
.bsa-foot .bsa-wrap { display: grid; gap: 4px; }
.bsa-foot p { margin: 0; max-width: 80ch; }

@media (max-width: 860px) {
  .bsa-dash { grid-template-columns: minmax(0, 1fr); }
  .bsa-panel { padding: var(--space-2); }
  .bsa-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .bsa-kv dd + dt { margin-top: var(--space-1); }
}
/* Phones: each document is a small card, nothing is hidden by sideways scrolling */
@media (max-width: 640px) {
  .bsa-table table { min-width: 0; }
  .bsa-table thead { display: none; }
  .bsa-table tr[data-dok-zeile]:not([hidden]) { display: grid; gap: 4px; padding: 12px 16px; }
  .bsa-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bsa-sunk) 45%, transparent); }
  .bsa-table td, .bsa-table tbody tr:nth-child(even) td { display: block; padding: 0; background: none; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .bsa * { transition: none !important; }
}
