/* ==========================================================================
   Depot-Dashboard — Stylesheet
   Palette und Typografie vollständig aus BAUPLAN.md Abschnitt 4.
   Mobile first, eine Spalte, Inhaltsbreite max. 820 px.
   ========================================================================== */

/* ------------------------------------------------------------------ Palette */
:root {
  --ground:#E8EBF0; --surface:#FFFFFF; --surface-2:#F1F3F7;
  --line:#CBD2DC;   --line-strong:#8B95A4;
  --ink:#080B10;    --ink-2:#414B5A;    --ink-3:#68727F;
  --brass:#8A4B00;  --brass-bg:#FBEBD8;
  --pos:#005F42;    --pos-bg:#D6EEE4;
  --neg:#9E1006;    --neg-bg:#FADFDB;
  --warn:#7A4800;   --warn-bg:#FBEBCF;

  --serif:"Instrument Serif", Georgia, "Times New Roman", serif;
  --sans:"Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:"IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius:10px;
  --gap:1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground:#07090D; --surface:#141A23; --surface-2:#1B222C;
    --line:#333D4B;   --line-strong:#5C6879;
    --ink:#F2F5F9;    --ink-2:#BAC4D0;    --ink-3:#8E99A6;
    --brass:#E8AC63;  --brass-bg:#3A2A14;
    --pos:#4CD3A0;    --pos-bg:#11332A;
    --neg:#FF9384;    --neg-bg:#3B1C18;
    --warn:#F0B95E;   --warn-bg:#38290F;
  }
}

/* -------------------------------------------------------------- Grundlagen */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  /* Nie horizontales Scrollen der Seite — breite Inhalte scrollen selbst. */
  overflow-x: hidden;
}

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; margin: 0 0 .15rem; }
@media (min-width: 480px) { h1 { font-size: 1.9rem; } }
h2 { font-size: 1.35rem; margin: 2.25rem 0 .85rem; }
h3 { font-size: 1.15rem; margin: 0; }

a { color: inherit; }

.mono { font-family: var(--mono); font-size: .78em; letter-spacing: .01em; }

/* Feldbeschriftungen: 11,5 px versal */
.label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
  color: var(--ink-3);
}

.pos  { color: var(--pos); }
.neg  { color: var(--neg); }
.warn { color: var(--warn); }
.zero { color: var(--ink-2); }
.muted { color: var(--ink-3); }

.card {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: var(--gap);
}

/* --------------------------------------------------------------- Kopfzeile */
/* Eine Zeile, auch auf dem Telefon: die Abmeldung darf nicht neben der
   Unterzeile landen. Deshalb kein Umbruch, Ausrichtung an der Oberkante. */
.topbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.brand { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.logo { display: block; flex: none; }
.topbar .who {
  font-size: .85rem;
  color: var(--ink-3);
  white-space: nowrap;
  padding-top: .4rem;
}
.topbar .who a { color: var(--ink-2); }

/* ----------------------------------------------------------------- Banner */
.banner {
  border: 2px solid var(--warn);
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  margin-bottom: var(--gap);
  font-weight: 600;
}
.banner.critical { border-color: var(--neg); background: var(--neg-bg); color: var(--neg); }
.banner .sub { display: block; font-weight: 400; margin-top: .2rem; color: inherit; opacity: .85; }

/* -------------------------------------------------------------- Übersicht */
.headline {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
  margin: .1rem 0 .35rem;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-top: 1rem;
}
.tile {
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: .6rem .7rem;
}
.tile .val { font-size: 1.3rem; font-weight: 600; margin-top: .15rem; }
@media (min-width: 560px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
}

/* --------------------------------------------------------------- Hinweise */
.hints { list-style: none; margin: 0; padding: 0; }
.hints li {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  padding: .55rem 0;
  border-top: 2px solid var(--line);
}
.hints li:first-child { border-top: 0; }
.badge {
  flex: none;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
  padding: .18rem .45rem;
  border-radius: 5px;
  margin-top: .1rem;
}
.badge.kritisch { background: var(--neg-bg); color: var(--neg); }
.badge.hinweis  { background: var(--surface-2); color: var(--ink-2); }

/* ------------------------------------------------------------- Positionen */
.pos-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .9rem;
}
.pos-head .sub { color: var(--ink-3); font-size: .85rem; margin-top: .15rem; }
.pos-head .pl { text-align: right; white-space: nowrap; }
.pos-head .pl .eur { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.pos-head .pl .pct { font-size: .9rem; font-weight: 600; }

/* Preisleiter -------------------------------------------------------------- */
.ladder { position: relative; margin: .35rem 0 .1rem; }

.ladder-track {
  position: relative;
  height: 30px;
  border: 2px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
}
.zone { position: absolute; top: 0; bottom: 0; }
.zone-red    { background: var(--neg-bg); }
.zone-yellow { background: var(--warn-bg); }
.zone-green  { background: var(--pos-bg); }

/* Marker liegen über dem Balken und dürfen an den Rändern überstehen. */
.ladder-marks { position: absolute; inset: 0; pointer-events: none; }
.mark {
  position: absolute;
  top: 50%;
  width: 13px; height: 13px;
  transform: translate(-50%, -50%);
}
/* Jeder Marker bekommt einen Ring in Flächenfarbe. Liegen Stop und Einstand
   dicht beieinander — der häufigste Fall, wenn ein Stop nachgezogen wurde —
   bleiben sie dadurch als zwei Formen unterscheidbar statt zu verschmelzen. */
.mark-stop  { background: var(--neg);   border-radius: 2px;
              box-shadow: 0 0 0 2px var(--surface); }                        /* Quadrat */
.mark-entry { background: var(--brass); border-radius: 2px;
              box-shadow: 0 0 0 2px var(--surface);
              transform: translate(-50%, -50%) rotate(45deg); }              /* Raute   */
.mark-price { background: var(--ink);   border-radius: 50%;
              width: 15px; height: 15px;
              box-shadow: 0 0 0 2.5px var(--surface); }                      /* Kreis   */

/* Die drei beschrifteten Felder unter dem Balken. Die Zahlen stehen bewusst
   HIER und nicht am Marker — am Balken kollidieren sie und zwingen zum
   Farbenraten (Bauplan 4.1). */
.legs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  margin-top: .7rem;
}
.leg {
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: .45rem .55rem;
}
.leg .label { display: flex; align-items: center; gap: .35rem; }
.leg .val { font-size: 1.05rem; font-weight: 600; margin-top: .15rem; }
/* „keine Order" ist keine Zahl — kleiner gesetzt, damit es in einer Zeile
   bleibt, und rot, weil es die wichtigste Warnung des Dashboards ist. */
.leg.empty .val { color: var(--neg); font-size: .88rem; white-space: nowrap; }

/* Symbole in den Beschriftungen — dieselbe Form wie der Marker im Balken. */
.sym { display: inline-block; width: 9px; height: 9px; flex: none; }
.sym-stop  { background: var(--neg);   border-radius: 1px; }
.sym-entry { background: var(--brass); border-radius: 1px; transform: rotate(45deg); }
.sym-price { background: var(--ink);   border-radius: 50%; }

/* Kennzahlen unter der Leiter */
/* Auf dem Telefon eine Spalte: Beschriftung links, Zahl rechts, nie ein
   Umbruch mitten in der Beschriftung. Erst ab Tablet mehrspaltig. */
.facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: .35rem .9rem;
  margin-top: .9rem;
  padding-top: .8rem;
  border-top: 2px solid var(--line);
}
.fact { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.fact .label { white-space: nowrap; }
.fact .v { font-weight: 600; white-space: nowrap; }
@media (min-width: 460px) {
  .facts { grid-template-columns: repeat(2, 1fr); gap: .5rem .9rem; }
}
@media (min-width: 680px) {
  .facts { grid-template-columns: repeat(3, 1fr); }
}

.chip {
  display: inline-block;
  padding: .1rem .4rem;
  border-radius: 5px;
  font-weight: 700;
  font-size: .9rem;
}
.chip.pos  { background: var(--pos-bg);  color: var(--pos); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.neg  { background: var(--neg-bg);  color: var(--neg); }

/* Analystenbalken */
.consensus {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid var(--line);
  margin-top: .3rem;
}
.consensus span { display: block; height: 100%; }
.consensus .buy  { background: var(--pos); }
.consensus .hold { background: var(--line-strong); }
.consensus .sell { background: var(--neg); }

/* ---------------------------------------------------------------- Tabelle */
/* Breite Tabellen scrollen in ihrem eigenen Container, nie die Seite. */
.scroller { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .5rem .6rem; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 600; border-bottom: 2px solid var(--line);
}
tbody td { border-bottom: 2px solid var(--line); }
tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); }

/* --------------------------------------------------------------- Anmelden */
.login {
  max-width: 420px;
  margin: 14vh auto;
  text-align: center;
}
/* display:block macht das SVG unempfindlich gegen text-align — hier soll es
   aber der Zentrierung folgen. */
.login .logo { margin: 0 auto; }
.btn {
  display: inline-block;
  margin-top: 1.25rem;
  padding: .75rem 1.4rem;
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: 600 1rem var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink-2); }

/* ------------------------------------------------------------------ Fußnote */
footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 2px solid var(--line);
  font-size: .82rem;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .5rem;
}

@media print {
  body { background: #fff; }
  .topbar .who, footer a { display: none; }
  .card { break-inside: avoid; }
}
