/* Plisstek Aufmass - gemeinsames Stylesheet (seit Sitzung 2a, 23.09.2026).
   Ersetzt nach und nach die Inline-<style>-Bloecke der Seiten. Tokens stammen aus
   aufmass.html (Amber #f59e0b = Markenfarbe, Dunkel #111827). Kein Webfont, kein CDN.
   Bei jeder Aenderung ASSET_VERSION in app/main.py hochzaehlen (Browser-Cache). */

:root{
  --brand:#f59e0b;          /* Primaeraktion, aktiver Reiter, Fokusring */
  --brand-strong:#d97706;   /* Hover auf Amber */
  --brand-soft:#fef3c7;     /* Badge "Preis pruefen", Chip Entwurf */
  --brand-text:#92400e;
  --ink:#111827;            /* Ueberschriften, dunkle Knoepfe */
  --text:#0f172a;
  --muted:#64748b;
  --bg:#f6f7fb;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --border:#e5e7eb;
  --border-strong:#cbd5e1;
  --required-bg:#FFF2AA;    /* gelernter Pflichtfeld-Hintergrund, bleibt */
  --required-border:#e5c200;
  --success:#16a34a;  --success-soft:#dcfce7;  --success-text:#166534;
  --danger:#dc2626;   --danger-soft:#fee2e2;   --danger-text:#991b1b;
  --info:#1d4ed8;     --info-soft:#eff6ff;     --info-border:#bfdbfe;
  --own:#6d28d9;      --own-soft:#f5f3ff;      --own-border:#c4b5fd;  /* Eigenauftrag */
  --shadow:0 4px 14px rgba(2,6,23,.06);
  --radius:14px;
  --radius-sm:10px;
  --control-h:48px;
  --topbar-h:56px;
}

/* ---------- Grundgeruest ---------- */
*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0;
  font-family:ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size:16px;
  line-height:1.4;
  color:var(--text);
  background:var(--bg);
}
a{ color:inherit; text-decoration:none; }
h1,h2,h3{ margin:0 0 10px; line-height:1.2; letter-spacing:.2px; color:var(--ink); }
h2{ font-size:22px; }
h3{ font-size:16px; }
.container{ max-width:1500px; margin:0 auto; padding:0 12px; }
.page{ padding-top:14px; padding-bottom:32px; }
@media (min-width:900px){
  .container{ padding:0 20px; }
  .page{ padding-top:18px; }
}

/* ---------- Kopfzeile ---------- */
.topbar{
  position:sticky; top:0; z-index:30;
  background:var(--surface);
  border-bottom:1px solid var(--border);
}
.topbar-inner{
  min-height:var(--topbar-h);
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
}
.brand{ display:flex; align-items:center; gap:10px; min-width:0; }
.brand img{ height:36px; width:auto; display:block; }
.brand-title{ font-weight:800; font-size:17px; color:var(--ink); white-space:nowrap; }
.nav{ display:flex; align-items:center; gap:4px; margin-left:auto; }
.nav-link{
  display:inline-flex; align-items:center; min-height:40px; padding:0 12px;
  border-radius:var(--radius-sm); font-weight:600; color:var(--muted);
  border-bottom:2px solid transparent;
}
.nav-link:hover{ color:var(--ink); background:var(--surface-2); }
.nav-link.active{ color:var(--ink); border-bottom-color:var(--brand); border-radius:var(--radius-sm) var(--radius-sm) 0 0; }
.nav-user{ display:flex; align-items:center; gap:10px; margin-left:12px; padding-left:12px; border-left:1px solid var(--border); }
.nav-name{ color:var(--muted); font-size:14px; white-space:nowrap; max-width:180px; overflow:hidden; text-overflow:ellipsis; }
.menu-btn{ display:none; }
@media (max-width:899px){
  .topbar-inner{ flex-wrap:nowrap; }
  .menu-btn{
    display:inline-flex; align-items:center; gap:8px; margin-left:auto;
    min-height:44px; padding:0 12px; border:1px solid var(--border); border-radius:var(--radius-sm);
    background:var(--surface); color:var(--ink); font-weight:700; cursor:pointer;
  }
  .menu-bars{ width:18px; height:2px; background:currentColor; box-shadow:0 -6px 0 currentColor, 0 6px 0 currentColor; }
  .nav{
    display:none; flex-direction:column; align-items:stretch; gap:6px;
    flex-basis:100%; margin:0; padding:8px 0 12px; border-top:1px solid var(--border);
  }
  body.nav-open .topbar-inner{ flex-wrap:wrap; }
  body.nav-open .nav{ display:flex; }
  .nav-link{ min-height:46px; border-bottom:0; }
  .nav-link.active{ background:var(--brand-soft); color:var(--brand-text); border-radius:var(--radius-sm); }
  .nav-user{ margin:6px 0 0; padding:10px 0 0; border-left:0; border-top:1px solid var(--border); justify-content:space-between; }
}

/* ---------- Karten, Abschnitte ---------- */
.card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:14px; min-width:0; margin-bottom:14px;
}
@media (min-width:900px){ .card{ padding:18px; } }
.card h3{ margin-bottom:10px; }
.sub{ color:var(--muted); font-size:13px; margin:-6px 0 12px; line-height:1.5; }
.divider{ height:1px; background:var(--border); margin:12px 0; }
.hint{ font-size:12px; color:var(--muted); margin-top:6px; }
.grid{ display:grid; grid-template-columns:1fr; gap:14px; }
@media (min-width:900px){ .grid{ grid-template-columns:minmax(320px,400px) 1fr; gap:16px; align-items:start; } }
.row{ display:grid; grid-template-columns:1fr; gap:10px; }
@media (min-width:650px){
  .row-2{ grid-template-columns:1fr 1fr; }
  .row-3{ grid-template-columns:1fr 1fr 1fr; }
  .row-4{ grid-template-columns:1fr 1fr 1fr 1fr; }
}

/* ---------- Formulare ---------- */
label{ display:block; font-size:13px; color:var(--muted); margin-bottom:6px; }
input:not([type=checkbox]):not([type=radio]), select, textarea{
  width:100%; min-height:var(--control-h); padding:10px 12px;
  border:1px solid var(--border); border-radius:var(--radius-sm);
  background:var(--surface); color:var(--text); font:inherit; font-size:16px; outline:none;
}
textarea{ min-height:96px; resize:vertical; }
input:focus, select:focus, textarea:focus{
  border-color:var(--brand); box-shadow:0 0 0 4px rgba(245,158,11,.18);
}
input[type=checkbox], input[type=radio]{ width:20px; height:20px; margin:0; accent-color:var(--brand); }
.input-required{ background:var(--required-bg) !important; border-color:var(--required-border) !important; }
.field{ margin-bottom:12px; }
.field label{ font-size:12px; color:#546070; }
.mass-hint{ margin-top:2px; font-size:13px; color:#c10000; font-weight:700; display:none; }
.radio-group{ display:flex; gap:10px; flex-wrap:wrap; padding-top:6px; }
.radio-chip{
  display:flex; align-items:center; gap:8px; min-height:46px; padding:10px 12px;
  border:1px solid var(--border-strong); border-radius:var(--radius-sm); background:var(--surface);
  font-weight:700; color:var(--ink); cursor:pointer;
}
.radio-chip small{ color:var(--muted); font-weight:700; font-size:12px; }
@media (max-width:720px){ .radio-group{ display:grid; grid-template-columns:1fr; gap:8px; } }

/* ---------- Knoepfe ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:44px; padding:10px 14px; border-radius:var(--radius-sm);
  border:1px solid var(--border); background:var(--surface); color:var(--text);
  -webkit-text-fill-color:currentColor;
  font:inherit; font-size:15px; font-weight:600; line-height:1.2; cursor:pointer; white-space:nowrap;
  transition:background .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:hover{ background:var(--surface-2); border-color:var(--border-strong); }
.btn:active{ transform:translateY(1px); }
.btn:disabled{ opacity:.6; cursor:default; transform:none; }
.btn-primary{ background:var(--brand); border-color:var(--brand); color:var(--ink); font-weight:700; }
.btn-primary:hover{ background:var(--brand-strong); border-color:var(--brand-strong); }
.btn-dark{ background:var(--ink); border-color:var(--ink); color:#fff; }
.btn-dark:hover{ background:#0b0f1a; border-color:#0b0f1a; }
.btn-success, .btn-green{ background:var(--success); border-color:var(--success); color:#fff; }
.btn-success:hover, .btn-green:hover{ background:#15803d; border-color:#15803d; }
.btn-danger, .btn-red{ background:var(--surface); border-color:#fecaca; color:var(--danger); }
.btn-danger:hover, .btn-red:hover{ background:var(--danger-soft); border-color:var(--danger); }
.btn-ghost{ background:transparent; border-color:transparent; color:var(--muted); }
.btn-ghost:hover{ background:var(--surface-2); color:var(--ink); border-color:transparent; }
.btn-sm{ min-height:36px; padding:6px 10px; font-size:14px; }
.btn-block{ width:100%; }
.actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top:10px; }
.actions form{ margin:0; }
@media (max-width:720px){
  .actions{ display:grid; grid-template-columns:1fr; }
  .actions form, .actions a{ width:100%; }
  .actions .btn{ width:100%; min-height:46px; white-space:normal; }
}

/* ---------- Meldungen ---------- */
.flash{
  display:flex; align-items:flex-start; gap:10px;
  border-radius:12px; padding:10px 12px; margin:0 0 14px;
  border:1px solid var(--border); background:var(--surface); font-size:15px;
}
.flash > span{ flex:1 1 auto; }
.flash.success{ border-color:rgba(22,163,74,.3); background:rgba(22,163,74,.08); color:#14532d; }
.flash.error{ border-color:rgba(220,38,38,.3); background:rgba(220,38,38,.08); color:#7f1d1d; }
.flash-close{
  flex:0 0 auto; width:32px; height:32px; margin:-4px -4px -4px 0;
  border:0; background:transparent; color:inherit; font-size:22px; line-height:1; cursor:pointer; border-radius:8px;
}
.flash-close:hover{ background:rgba(0,0,0,.06); }
.error{ margin:0 0 16px; padding:12px 14px; border-radius:12px; background:rgba(220,38,38,.08); border:1px solid rgba(220,38,38,.2); color:var(--danger-text); font-size:14px; }

/* ---------- Chips, Status ---------- */
.chip, .status, .tag{
  display:inline-flex; align-items:center; gap:4px; padding:3px 9px; border-radius:999px;
  font-size:12px; font-weight:700; background:#f3f4f6; color:#374151; white-space:nowrap;
}
.tag{ font-weight:500; background:var(--surface); border:1px solid var(--border); color:#475569; }
.status.draft, .chip-draft{ background:var(--brand-soft); color:var(--brand-text); }
.status.confirmed, .chip-confirmed{ background:var(--success-soft); color:var(--success-text); }
.chip-production{ background:var(--info-soft); color:var(--info); border:1px solid var(--info-border); }
.chip-done{ background:#e5e7eb; color:#374151; }
.chip-own{ background:var(--own-soft); color:var(--own); border:1px solid var(--own-border); }
.chip-warn{ background:var(--brand-soft); color:var(--brand-text); border:1px solid var(--brand); }
.chip-danger{ background:var(--danger-soft); color:var(--danger-text); }
.count-pill{
  display:inline-flex; align-items:center; justify-content:center; padding:5px 9px; border-radius:999px;
  background:var(--info-soft); color:var(--info); border:1px solid var(--info-border); font-size:12px; font-weight:700; white-space:nowrap;
}
.preis-warn{
  display:inline-block; margin-left:6px; padding:2px 7px; border-radius:999px;
  background:var(--brand-soft); border:1px solid var(--brand); color:var(--brand-text);
  font-size:11px; font-weight:700; white-space:nowrap; cursor:help;
}
.preis-warn-zeile{
  margin-top:8px; padding:8px 10px; border-left:4px solid var(--brand); background:#fffbeb;
  color:var(--brand-text); font-size:13px; border-radius:0 8px 8px 0;
}
.mono{ font-variant-numeric:tabular-nums; font-family:ui-monospace, "Cascadia Mono", Consolas, monospace; }
.order-no{ font-weight:800; color:var(--ink); font-variant-numeric:tabular-nums; }

/* ---------- Tabellen ---------- */
.table-wrap{ overflow-x:auto; border:1px solid var(--border); border-radius:12px; background:var(--surface); min-width:0; }
table{ width:100%; border-collapse:collapse; background:var(--surface); }
th, td{ padding:10px; border-bottom:1px solid var(--border); text-align:left; font-size:14px; vertical-align:top; }
th{ position:sticky; top:0; background:var(--surface-2); z-index:1; color:var(--ink); font-size:13px; letter-spacing:.2px; }
tr:hover td{ background:#fafafa; }
td.num, th.num{ text-align:right; font-variant-numeric:tabular-nums; }

/* ---------- Summen ---------- */
.totals{ display:grid; grid-template-columns:1fr; gap:10px; margin-top:10px; }
@media (min-width:650px){ .totals{ grid-template-columns:1fr 1fr; } }
.total-box{
  border:1px solid var(--border); border-radius:12px; padding:10px 12px; background:var(--surface);
  display:flex; justify-content:space-between; gap:10px; color:var(--text); font-variant-numeric:tabular-nums;
}
.total-box span{ color:var(--muted); }
.total-box.internal{ background:var(--surface-2); }
.grand{ border:0; background:linear-gradient(180deg, rgba(245,158,11,.18), rgba(245,158,11,.06)); font-size:16px; font-weight:800; }
.masked-price{ letter-spacing:2px; user-select:none; }

/* ---------- Einklappbare Karten, feste Aktionsleiste (mobil) ---------- */
details.card > summary{
  list-style:none; cursor:pointer; display:flex; align-items:center; justify-content:space-between; gap:10px;
  min-height:40px; font-weight:800; color:var(--ink);
}
details.card > summary::-webkit-details-marker{ display:none; }
details.card > summary::after{ content:"\25BE"; color:var(--muted); font-size:14px; transition:transform .15s ease; }
details.card[open] > summary::after{ transform:rotate(180deg); }
details.card > summary .summary-sub{ font-weight:500; color:var(--muted); font-size:13px; }
.sticky-actions{
  position:sticky; bottom:0; z-index:20; margin:14px -12px 0; padding:10px 12px;
  background:var(--surface); border-top:1px solid var(--border); box-shadow:0 -6px 18px rgba(2,6,23,.06);
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
}
.sticky-actions .grand-inline{ font-weight:800; font-size:16px; margin-right:auto; font-variant-numeric:tabular-nums; }
@media (min-width:900px){ .sticky-actions{ position:static; margin:14px 0 0; padding:0; border:0; box-shadow:none; background:transparent; } }

/* ---------- Anmeldeseiten ---------- */
body.auth{ min-height:100vh; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:24px; }
body.auth .page{ padding:0; width:100%; max-width:520px; }
.auth-card{ background:var(--surface); border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow); padding:32px; }
.auth-card .brand{ margin-bottom:22px; }
.auth-card .brand img{ height:44px; }
.auth-card .brand-title{ font-size:26px; }
.auth-card h2{ font-size:26px; margin-bottom:6px; }
.auth-card .sub{ margin:0 0 22px; font-size:15px; }
.auth-card .field{ margin-bottom:16px; }
.auth-card label{ font-size:14px; }
.auth-card .btn{ min-height:52px; font-size:16px; }
.auth-footer{ margin-top:18px; text-align:center; font-size:15px; color:var(--muted); }
.auth-footer a{ color:var(--ink); font-weight:700; }
@media (max-width:720px){
  body.auth{ padding:16px; align-items:flex-start; }
  .auth-card{ padding:22px 18px; margin-top:12px; }
}

/* ---------- Fusszeile ---------- */
.site-footer{ max-width:1500px; margin:0 auto; padding:18px 12px 28px; display:flex; gap:10px; justify-content:center; align-items:center; font-size:13px; color:var(--muted); }
.site-footer a{ color:var(--muted); text-decoration:underline; min-height:44px; display:inline-flex; align-items:center; }
body.auth .site-footer{ padding-top:0; }
.legal{ max-width:720px; margin:0 auto; }
.legal h2{ margin-top:0; }
.legal p{ line-height:1.6; margin:0 0 12px; }
.legal .lbl{ color:var(--muted); font-size:13px; margin-bottom:2px; }

/* ---------- Druck ---------- */
@media print{
  .topbar, .menu-btn, .sticky-actions, .actions, .flash-close, .btn, .site-footer{ display:none !important; }
  body{ background:#fff; }
  .card{ box-shadow:none; border-color:#999; }
}
