/* HBR Consulting Corporate Design: Espresso, Terrakotta (sparsam), Sand, Papier, Grau-Braun */
@font-face { font-family: 'EB Garamond'; font-weight: 500; font-display: swap; src: url(/fonts/eb-garamond/eb-garamond-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-weight: 400; font-display: swap; src: url(/fonts/hanken-grotesk/hanken-grotesk-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-weight: 500; font-display: swap; src: url(/fonts/hanken-grotesk/hanken-grotesk-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-weight: 600; font-display: swap; src: url(/fonts/hanken-grotesk/hanken-grotesk-latin-600-normal.woff2) format('woff2'); }
:root {
  --akzent: #3B2A20;        /* Espresso */
  --akzent-hell: #F1E9DD;   /* Sand, aufgehellt (Hover/aktiv) */
  --terrakotta: #A4583A;
  --text: #3B2A20;
  --grau: #8A7B6D;          /* Grau-Braun */
  --linie: #E3D6C3;         /* Sand */
  --flaeche: #FBF8F3;       /* Papier */
  --weiss: #fff;
  --rot: #A4583A;
  --rot-hell: #F6E7E0;
  --gruen: #4E6B3A;
  --gruen-hell: #EEF1E6;
  --gelb: #8A6A2E;
  --gelb-hell: #F7EEDB;
  --radius: 4px;
  --serif: 'EB Garamond', Garamond, Georgia, serif;
  font-family: 'Hanken Grotesk', Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--flaeche); }
a { color: var(--akzent); }
h1 { font-family: var(--serif); font-size: 1.9rem; margin: 0 0 1rem; font-weight: 500; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .75rem; font-weight: 600; }
.versteckt { display: none !important; }

/* Kopfleiste */
header.leiste { background: var(--weiss); border-bottom: 1px solid var(--linie); position: sticky; top: 0; z-index: 10; }
.leiste-innen { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 1.5rem; padding: 0 16px; height: 56px; }
.marke { display: flex; align-items: center; gap: .6rem; color: var(--akzent); white-space: nowrap; text-decoration: none; }
.mono { width: 38px; height: 38px; border: 1.5px solid var(--terrakotta); display: inline-flex; align-items: center; justify-content: center;
        font-family: var(--serif); font-weight: 500; font-size: 14px; letter-spacing: .06em; padding-left: .06em; flex: none; }
.wortmarke { font-family: var(--serif); font-weight: 500; font-size: 1.25rem; }
nav.menue { display: flex; gap: .25rem; flex: 1; overflow-x: auto; }
nav.menue a { text-decoration: none; color: var(--grau); padding: .45rem .75rem; border-radius: var(--radius); white-space: nowrap; }
nav.menue a.aktiv, nav.menue a:hover { color: var(--akzent); background: var(--akzent-hell); }
.benutzer { color: var(--grau); font-size: .9rem; white-space: nowrap; display: flex; gap: .75rem; align-items: center; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }

/* Bausteine */
.karte { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.zeile { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.zeile.ende { justify-content: flex-end; }
.zeile.zwischen { justify-content: space-between; }
.zeile-fuell { flex: 1; min-width: 200px; }
.raster { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.raster .breit { grid-column: 1 / -1; }
.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1rem; }
.kpi { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.25rem; }
.kpi .wert { font-size: 1.5rem; font-weight: 600; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.kpi .label { color: var(--grau); font-size: .85rem; }
.kpi.warn .wert { color: var(--rot); }
.leise { color: var(--grau); font-size: .88rem; }

label { display: block; font-size: .82rem; color: var(--grau); margin-bottom: .25rem; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; padding: .5rem .6rem; border: 1px solid #D8C9B4; border-radius: var(--radius); background: var(--weiss);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent-hell); border-color: var(--terrakotta); }
input[readonly] { background: var(--flaeche); }
textarea { min-height: 70px; resize: vertical; }
.checkbox { display: flex; align-items: center; gap: .5rem; color: var(--text); font-size: .95rem; }
.checkbox input { width: auto; }
.pw-feld { position: relative; }
.pw-feld input { padding-right: 5.5rem; }
.pw-feld button { position: absolute; right: 4px; top: 4px; bottom: 4px; padding: 0 .6rem; font-size: .8rem; }

button, .knopf {
  font: inherit; cursor: pointer; border: 1px solid #D8C9B4; background: var(--weiss); color: var(--text);
  padding: .5rem .95rem; border-radius: var(--radius); text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
}
button:hover, .knopf:hover { border-color: var(--akzent); }
button.primaer { background: var(--akzent); color: #fff; border-color: var(--akzent); }
button.primaer:hover { background: #2a1d16; }
button.gefahr { color: var(--rot); border-color: #E2B9A8; }
button.gefahr:hover { background: var(--rot-hell); }
button.klein { padding: .25rem .55rem; font-size: .85rem; }
button.link { border: none; background: none; color: var(--akzent); padding: 0; }
button:disabled { opacity: .55; cursor: default; }

/* Tabellen */
.tabelle-wrap { overflow-x: auto; background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); }
table.liste { width: 100%; border-collapse: collapse; }
table.liste th { text-align: left; font-size: .8rem; color: var(--grau); font-weight: 600; padding: .65rem .75rem; border-bottom: 1px solid var(--linie); background: #FDFBF8; white-space: nowrap; }
table.liste td { padding: .6rem .75rem; border-bottom: 1px solid #F0E8DC; vertical-align: middle; }
table.liste tr:last-child td { border-bottom: none; }
table.liste tbody tr.klickbar { cursor: pointer; }
table.liste tbody tr.klickbar:hover { background: var(--flaeche); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.liste th.num, th.num { text-align: right; }
.leer { padding: 2rem; text-align: center; color: var(--grau); }

/* Positionen-Editor */
table.positionen { width: 100%; border-collapse: collapse; }
table.positionen th { font-size: .78rem; color: var(--grau); text-align: left; padding: .35rem .3rem; font-weight: 600; }
table.positionen td { padding: .3rem; vertical-align: top; }
table.positionen tr.pos-zeile td { border-top: 1px solid #F0E8DC; }
table.positionen .c-menge { width: 90px; }
table.positionen .c-einheit { width: 120px; }
table.positionen .c-preis { width: 120px; }
table.positionen .c-ust { width: 85px; }
table.positionen .c-summe { width: 120px; padding-top: .8rem; }
table.positionen .c-aktion { width: 40px; }
table.positionen textarea { min-height: 38px; margin-top: .3rem; font-size: .9rem; }
.summenblock { margin-left: auto; max-width: 360px; min-width: 260px; margin-top: 1rem; }
.summenblock div span:last-child { padding-left: 1rem; }
.summenblock div { display: flex; justify-content: space-between; padding: .25rem 0; font-variant-numeric: tabular-nums; }
.summenblock .gesamt { border-top: 2px solid var(--akzent); margin-top: .35rem; padding-top: .5rem; font-weight: 600; font-size: 1.1rem; }
.summenblock .gesamt span:last-child { color: var(--terrakotta); }

/* Status */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.badge.entwurf { background: #EFE9E1; color: #6B5A4C; }
.badge.offen { background: var(--gelb-hell); color: var(--gelb); }
.badge.ueberfaellig { background: var(--rot-hell); color: var(--rot); }
.badge.bezahlt { background: var(--gruen-hell); color: var(--gruen); }
.badge.storniert, .badge.storno { background: #E9E4EC; color: #5B4A66; }

/* Meldungen */
.meldung { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.meldung.fehler { background: var(--rot-hell); color: var(--rot); border: 1px solid #E8C4B5; }
.meldung.ok { background: var(--gruen-hell); color: var(--gruen); border: 1px solid #CBD6BC; }
.meldung.warn { background: var(--gelb-hell); color: var(--gelb); border: 1px solid #E9D6AE; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; max-width: calc(100% - 32px); }
#toast .meldung { box-shadow: 0 6px 24px rgba(59,42,32,.12); }

/* Dialog */
dialog { border: none; border-radius: 8px; padding: 0; width: min(640px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(59, 42, 32, .45); }
dialog .kopf { padding: 1rem 1.25rem; border-bottom: 1px solid var(--linie); font-weight: 600; }
dialog .inhalt { padding: 1.25rem; max-height: 70vh; overflow-y: auto; }
dialog .fuss { padding: .9rem 1.25rem; border-top: 1px solid var(--linie); display: flex; justify-content: flex-end; gap: .5rem; }

/* Login */
.login { max-width: 380px; margin: 12vh auto 0; }
.login .marke { justify-content: center; margin-bottom: 1.5rem; }
.login .mono { width: 44px; height: 44px; font-size: 16px; }
.login .wortmarke { font-size: 1.6rem; }
.login .feld { margin-bottom: .9rem; }

/* Diagramm */
.balken { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 160px; margin-top: .5rem; }
.balken .b { background: var(--akzent); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.balken .b:hover { background: var(--terrakotta); }
.balken-label { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; font-size: .75rem; color: var(--grau); text-align: center; margin-top: .3rem; }
.zwei-spalten { display: grid; gap: 1rem; grid-template-columns: 2fr 1fr; }
.logo-vorschau { max-height: 60px; max-width: 220px; display: block; margin: .5rem 0; border: 1px solid var(--linie); padding: 4px; background: #fff; }

@media (max-width: 760px) {
  .leiste-innen { gap: .75rem; }
  .benutzer .name, .leiste .wortmarke { display: none; }
  .zwei-spalten { grid-template-columns: 1fr; }
  table.positionen thead { display: none; }
  table.positionen tr.pos-zeile { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; padding: .5rem 0; }
  table.positionen tr.pos-zeile td { border: none; width: auto !important; }
  table.positionen td.c-bez { grid-column: 1 / -1; }
}
