@import url("shell.css");
/* stargate.css – das gemeinsame Design aller Apps auf stargate (Stil "C2 · Nacht, verspielt", 20.10.2026).
   Grundlage: taste-skill "true-black-flat" + app.css; dazu eine Prise der alten Startseite (Klappuhr, App-Kacheln, Papier).
   Regeln: Farbe nur auf Daten (Bernstein), keine Schatten auf ruhenden Flächen, eine Schrift (Inter), Zahlen tabellarisch.
   Schriften liegen in fonts/ und kommen vom eigenen Server (Regel 3: keine CDNs). */



/* ---------- shell: sidebar + canvas ---------- */

/* ---------- title block and filters ---------- */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.title-row h1 { font-size: var(--fs-title); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.title-row .sub { margin-top: 4px; color: var(--muted); }
.filters { display: flex; align-items: center; gap: 8px; margin-bottom: var(--gap); flex-wrap: wrap; }
.filters .spacer { flex: 1; }
.stamp { color: var(--faint); font-size: var(--fs-small); }

/* ---------- panels and grid ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--card-pad); min-width: 0; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel h2 { font-size: var(--fs-section); line-height: 1.3; font-weight: 600; }
.panel .meta { color: var(--faint); font-size: var(--fs-small); }
/* paired cards in one row: a card stretches to its neighbour only when it has content to fill. Otherwise it keeps
   its own height (add .top to the row), and only an action or a total may be pinned to a stretched card's bottom */
.grid.top { align-items: start; }

/* a chart's heading row: its title (and legend or period) with a fixed 8px to the svg */
.chart-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.chart-head h3 { font-size: var(--fs-body); line-height: 20px; font-weight: 500; }
.chart { position: relative; min-width: 0; }

/* a link at a card's foot or header ("Show all 7", "Sell-out history"): ink, a 12px chevron, an underline on hover,
   and no inline padding, so its text sits on the card's content edge */
.card-link { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: none; color: var(--text); font-weight: 500; cursor: pointer; text-underline-offset: 3px; }
.card-link::after { content: ""; width: 12px; height: 12px; flex: none; background: currentColor; -webkit-mask: var(--chevron) center / 12px no-repeat; mask: var(--chevron) center / 12px no-repeat; }
.card-link:hover { text-decoration: underline; }
:root { --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2.5 8 6l-3.5 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* list rows: a rule between rows and none above the first. A rule on a rounded box curls up at both ends, so a row
   that carries a rule has square corners */
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--rule); border-radius: 0; }

/* KPIs as one divided strip: a label above a number, no icons, no tiles */
.kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.kpi { padding: 16px var(--card-pad); }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { color: var(--muted); }
.kpi-value { margin-top: 6px; font-size: var(--fs-kpi); line-height: 1.15; font-weight: 500; letter-spacing: -0.01em; }
.kpi-value small { font-size: 0.55em; color: var(--muted); font-weight: 400; margin-left: 2px; }
.delta { margin-top: 4px; font-size: var(--fs-small); color: var(--muted); }
.delta .up { color: var(--positive); } .delta .down { color: var(--negative); }
/* KPIs as the chart's tabs: the selected one carries a 2px rule and an ink label; the others keep a grey label and
   their value in ink at a lighter weight (a grey value reads as disabled). When the tabs are the per-entity
   breakdown the brief asks for (takings by shop), add .entities: nothing changes but the rule */
.kpis[role="tablist"] .kpi { position: relative; cursor: pointer; }
.kpis[role="tablist"] .kpi[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }
.kpis[role="tablist"]:not(.entities) .kpi[aria-selected="true"] .kpi-label { color: var(--text); }
.kpis[role="tablist"]:not(.entities) .kpi[aria-selected="false"] .kpi-value { color: var(--text); font-weight: 400; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { height: 36px; padding: 0 12px; text-align: left; font-weight: 400; font-size: var(--fs-small); color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
/* cells share one baseline, so a figure never sits 2px below the name beside it; the row height comes from padding */
td { padding: calc((var(--row-height) - 20px) / 2) 12px; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
tbody tr:last-child td { border-bottom: 0; }
/* no hover that changes the fill; a row that drives a detail pane takes the nav pill's fill when selected */
tbody tr[aria-selected="true"] td { background: var(--active); }
th.n, td.n { text-align: right; }
td .sub { display: block; font-size: var(--fs-small); color: var(--muted); }
.truncate { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* status pill: a pale tint with dark ink of the same hue, one per row */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap; }
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-height); padding: 0 12px; border-radius: var(--radius-control); border: 1px solid var(--control); background: var(--surface); font-weight: 500; cursor: pointer; transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.field { display: grid; gap: 8px; }
.field label { font-weight: 500; }
.field .hint { color: var(--muted); font-size: var(--fs-small); }
.input, select.input { height: 38px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
.input::placeholder { color: var(--faint); }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: var(--gap); }
.tabs a { position: relative; padding: 10px 0; color: var(--muted); transition: color var(--t-hover) ease; }
.tabs a[aria-selected="true"] { color: var(--text); }
.tabs a[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }
/* as wide as its options; full width only on a narrow phone */
.segmented { display: inline-flex; width: max-content; max-width: 100%; padding: 2px; border-radius: 8px; background: var(--raised); }
.segmented button { height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.switch { appearance: none; width: 32px; height: 20px; border-radius: 999px; background: var(--control); position: relative; cursor: pointer; transition: background-color var(--t-ui) ease; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--t-ui) var(--ease-out); }
.switch:checked { background: var(--text); } .switch:checked::after { transform: translateX(12px); }

/* empty and loading states keep the frame; a loading value is a flat grey bar at its real size, with no shimmer */
.empty { display: grid; place-items: center; min-height: 96px; padding: 16px; border: 1px dashed var(--control); border-radius: 16px; color: var(--muted); text-align: center; }
.skeleton { background: var(--raised); border-radius: 4px; }

/* ---------- phone: the navigation folds away and the canvas takes the width ---------- */
@media (max-width: 860px) {
  .grid > * { grid-column: 1 / -1 !important; }
  .kpis { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .kpi:nth-child(2n) { border-left: 1px solid var(--border); }
  /* an odd count leaves no half-empty row: the last cell takes the full width */
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* KPI tabs in a 2-up grid: the selected cell takes a fill, never an underline floating mid-grid */
  .kpis[role="tablist"] .kpi[aria-selected="true"] { background: var(--active); }
  .kpis[role="tablist"] .kpi[aria-selected="true"]::after { content: none; }
  .title-row { flex-wrap: wrap; align-items: flex-start; }
}
@media (max-width: 480px) {
  .segmented { display: flex; width: 100%; }
  .segmented button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; } }

/* an empty message spans the block it stands in, never one squeezed column */
.rows .empty, .grid > .empty, li > .empty { grid-column: 1 / -1; width: 100%; }

.title-row h1 { font-weight: 600; }
.panel { border: 0; }
.btn.primary { padding: 0 16px; }
.grid + .grid, .grid + .kpis, .kpis + .grid { margin-top: var(--gap); }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s9 { grid-column: span 9; } .s12 { grid-column: 1 / -1; }
.kpis { border: 0; background: var(--surface); border-radius: var(--radius-card); }
.kpi + .kpi { border-left-color: var(--rule); }

/* Zeilen-Karten (eine Stufe heller als das Panel) */
.rowc { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 16px; background: var(--raised); border-radius: 14px; }
.rowc + .rowc { margin-top: 8px; }
.rowc .grow { flex: 1; min-width: 0; } .rowc .sub { color: var(--faint); font-size: var(--fs-small); }
.rowc .fig { text-align: right; }
.facts { display: flex; gap: 32px; flex-wrap: wrap; color: var(--muted); }
.facts b { display: block; color: var(--text); font-size: 18px; font-weight: 500; }

/* Klappuhr (aus der alten Startseite) */
.clock { display: flex; align-items: center; gap: 4px; }
.clock span { width: 44px; height: 60px; display: grid; place-items: center; background: #1d1b19; border-radius: 10px; font-size: 40px; font-weight: 600; letter-spacing: -0.02em; position: relative; overflow: hidden; }
.clock span::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--ground); }
.clock b { width: 10px; text-align: center; color: var(--accent); font-size: 32px; line-height: 1; }

/* Status-Pille */
.status { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; height: 32px; padding: 0 14px; background: var(--surface); border-radius: 999px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--positive); }
.status .dot.bad { background: var(--negative); }
.status .sep { width: 1px; height: 14px; background: var(--control); }
.status .hi { color: var(--accent); }

/* Papierstreifen (der Courier) */
.paper { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; height: 40px; padding: 0 18px; border-radius: 999px; background: var(--paper); color: var(--paper-ink); font-family: var(--serif); font-size: 18px; transition: transform var(--t-press) var(--ease-out); }
.paper:hover { transform: translateY(-2px) rotate(-0.6deg); }
.paper small { font-family: var(--font); font-size: 12px; color: var(--paper-mark); font-weight: 600; }

/* App-Kacheln mit eigenem Farbton (--h) */
.launch { display: flex; flex-wrap: wrap; gap: 10px; }
.launch a { flex: none; width: 76px; display: grid; justify-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.launch .ic { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; background: hsl(var(--h) 22% 13%); border: 1px solid hsl(var(--h) 22% 19%); color: hsl(var(--h) 65% 72%); transition: transform var(--t-press) var(--ease-out), border-color var(--t-hover); }
.launch .ic svg, .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.launch a:hover .ic { transform: translateY(-3px); border-color: hsl(var(--h) 40% 34%); }
.launch a:hover { color: var(--text); }

/* GTNH-Tier-Leiter */
.ladder { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 3px; margin: 6px 0; }
.ladder span { height: 26px; border-radius: 5px; background: var(--raised); }
.ladder span.done { background: #e6e6e6; } .ladder span.now { background: var(--accent); }
.ends { display: flex; justify-content: space-between; color: var(--faint); font-size: var(--fs-small); margin-bottom: 16px; }
.ends b { color: var(--accent); font-weight: 500; }

/* Stromfluss: Quelle -> Verbraucher, Linienstärke folgt der Leistung */
.flow { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(60px, 2fr) minmax(210px, 1fr); align-items: stretch; margin: 8px 0 18px; }
.flow > .node { align-self: center; }
.node { background: var(--raised); border-radius: 16px; padding: 14px 16px; }
.node .l { color: var(--muted); font-size: var(--fs-small); } .node .v { font-size: var(--fs-kpi); font-weight: 500; margin-top: 2px; }
.node .v small { font-size: 13px; color: var(--muted); margin-left: 3px; font-weight: 400; }
.node.off .v { color: var(--muted); }
.pipes { width: 100%; height: 100%; }
.split { display: grid; gap: 14px; }

/* Papiergrund (Toni, 20.10.): matt wie schwarzer Zeichenblock: nur feiner, gleichmäßiger Zahn (zwei Körnungen), im Browser erzeugt, keine Bilddatei.
   Nur der Grund hat Struktur; Karten bleiben glatt und liegen darauf wie Zettel. */

/* Reiter brechen auf schmalen Bildschirmen um statt über den Rand zu laufen */
.tabs { flex-wrap: wrap; column-gap: 24px; row-gap: 0; }

/* Eigenart je App: der Farbton --h (aus shell.js) wird zur Datenfarbe; Bernstein bleibt der Rückfall */
.body h1 { display: flex; align-items: center; gap: 12px; }

/* Knöpfe brechen nie um; wird es eng, rutscht der ganze Knopf in die nächste Zeile */
.btn { white-space: nowrap; flex: none; }

/* Schalter im dunklen Design: an = hell mit dunklem Knopf */
.switch:checked { background: #e6e6e6; } .switch:checked::after { background: var(--ground); }

/* Fortschritt mit beiden Enden beschriftet */
.bar { height: 8px; border-radius: 999px; background: var(--raised); overflow: hidden; margin: 8px 0 4px; }
.bar i { display: block; height: 100%; background: var(--text); border-radius: inherit; }
.bar.accent i { background: var(--accent); }

/* Tablet und halbes Fenster: Karten untereinander statt gequetscht nebeneinander */
@media (max-width: 1100px) {
  .grid > * { grid-column: 1 / -1 !important; }
}
@media (max-width: 860px) {
  .body { padding: 20px 16px 48px; }
  .flow { grid-template-columns: 1fr; gap: 10px; } .pipes { display: none; }
  .clock span { width: 36px; height: 50px; font-size: 32px; }
  .launch { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 8px; }
  .launch a { width: auto; } .launch .ic { width: 52px; height: 52px; }
  .status { height: auto; flex-wrap: wrap; padding: 8px 14px; border-radius: 16px; row-gap: 2px; } .status .sep { display: none; } .status .hi { flex-basis: 100%; padding-left: 18px; }
}

/* Bewegung für alle Apps (Toni 20.10.): Karten steigen gestaffelt auf, Balken füllen sich. prefers-reduced-motion schaltet oben alles ab. */
@keyframes sg-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes sg-grow { from { transform: scaleX(0); } }
.grid > .panel { animation: sg-rise .5s var(--ease-out) both; }
.grid > .panel:nth-child(2) { animation-delay: .07s; } .grid > .panel:nth-child(3) { animation-delay: .14s; } .grid > .panel:nth-child(n + 4) { animation-delay: .2s; }
.grid + .grid > .panel { animation-delay: .18s; } .grid + .grid > .panel:nth-child(2) { animation-delay: .25s; } .grid + .grid > .panel:nth-child(n + 3) { animation-delay: .32s; }
.bar i { transform-origin: left; animation: sg-grow .9s .3s var(--ease-out) both; }
@media (max-width: 860px) { .mobile-actions .stamp { width: 100%; } }
