/* =========================================================================
   Dashboard - Gestaltung
   Hell, ruhig, viel Weissraum. Eine Akzentfarbe, sonst Graustufen.
   Zahlen laufen ueberall mit Tabellenziffern, damit Spalten stehen.
   ========================================================================= */

:root {
  --bg:            #fbfbfc;
  --surface:       #ffffff;
  --surface-2:     #f6f6f8;
  --surface-3:     #efeff3;
  --border:        #e7e7ec;
  --border-strong: #d8d8e0;

  --text:   #1a1a1f;
  --text-2: #55555f;
  --text-3: #8b8b97;

  --accent:      #6965db;
  --accent-hov:  #5b57d1;
  --accent-soft: #eeedfd;
  --accent-line: #d9d7fb;

  --good:      #10806a;
  --good-soft: #e4f4ef;
  --warn:      #a1600a;
  --warn-soft: #fbf0dc;
  --bad:       #ca3a58;
  --bad-soft:  #fceaee;

  --c1: #6965db;  --c2: #0f9b8e;  --c3: #d98324;  --c4: #c94f7c;
  --c5: #3178c6;  --c6: #5c9a2f;  --c7: #8b5cf6;  --c8: #64748b;

  --r-sm: 7px;
  --r:    10px;
  --r-lg: 14px;

  --sh-sm: 0 1px 2px rgba(22, 22, 34, .05);
  --sh:    0 1px 2px rgba(22, 22, 34, .05), 0 4px 14px rgba(22, 22, 34, .05);
  --sh-lg: 0 12px 40px rgba(22, 22, 34, .14);

  --rail: 88px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Start */

.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 90; }
.boot-spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid var(--accent-line); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- Geruest */

.shell { display: flex; min-height: 100vh; }

.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 8px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 30;
}
.rail-logo { display: block; margin-bottom: 12px; border-radius: 8px; line-height: 0; }
.rail-nav { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; width: 100%; }

.rail-btn {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 2px 7px; border: 0; border-radius: var(--r);
  background: transparent; color: var(--text-2); cursor: pointer;
  transition: background .13s, color .13s;
}
.rail-btn svg { width: 21px; height: 21px; }
.rail-btn span {
  font-size: 10px; font-weight: 500; letter-spacing: -.008em; line-height: 1.15;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail-btn:hover { background: var(--surface-2); color: var(--text); }
.rail-btn.is-active { background: var(--accent-soft); color: var(--accent); }
.rail-btn.is-active svg { stroke-width: 2.1; }

.main { flex: 1; min-width: 0; margin-left: var(--rail); display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 26px;
  background: rgba(251, 251, 252, .88);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--border);
  min-height: 62px;
}
.topbar h1 { font-size: 16.5px; }
.topbar-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.content { padding: 22px 26px 72px; max-width: 1560px; width: 100%; margin: 0 auto; }

/* --------------------------------------------------------------- Bausteine */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
}
.card-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 15px 18px 0;
}
.card-head h3 { font-size: 14px; }
.card-head .card-note { font-size: 12px; color: var(--text-3); margin-left: auto; }
.card-body { padding: 14px 18px 18px; }
.card-body.tight { padding: 10px 12px 12px; }
.card-body.flush { padding: 0; }

/* Spalten fliessen mit der Breite, statt an festen Haltepunkten zu springen.
   Dadurch stimmt die Aufteilung auf jedem Gerät, nicht nur bei drei Groessen. */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.section { margin-bottom: 18px; }
.section-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3); margin: 26px 0 11px;
}
.section-title:first-child { margin-top: 4px; }
.section-title .hint { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; }

/* Kennzahl-Kacheln */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 158px), 1fr)); gap: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 13px 15px 14px; box-shadow: var(--sh-sm);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.kpi-label {
  font-size: 11.5px; color: var(--text-3); font-weight: 500;
  display: flex; align-items: center; gap: 5px;
}
.kpi-value { font-size: 23px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.kpi-foot { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 11.5px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--text-3); }
.delta svg { width: 11px; height: 11px; }

/* Knoepfe */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface-2); border-color: #c9c9d4; }
.btn:active { transform: translateY(.5px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hov); border-color: var(--accent-hov); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--bad); border-color: #f0ccd4; }
.btn.danger:hover { background: var(--bad-soft); border-color: #e8b6c1; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Eingaben */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.input, .select {
  padding: 7px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  font: inherit; font-size: 13px; color: var(--text); min-width: 0;
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select {
  appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8b97' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 9px; width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 30px; }

/* Reiter - auf schmalen Fenstern waagerecht scrollbar statt umbrechend */
.tabs {
  display: flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: var(--r);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs .tab { flex: 0 0 auto; }
.tab {
  padding: 6px 13px; border: 0; border-radius: var(--r-sm); background: transparent;
  font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer;
  transition: background .12s, color .12s;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--sh-sm); }

/* Etiketten */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.chip.good { background: var(--good-soft); color: var(--good); border-color: #c6e6dc; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: #eddcb8; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: #f2ccd5; }
.chip.plain { background: transparent; }

.dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }

.note {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 10px 13px; border-radius: var(--r); font-size: 12.5px; line-height: 1.5;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--text-3); }
.note.accent { background: var(--accent-soft); border-color: var(--accent-line); color: #45429c; }
.note.accent svg { color: var(--accent); }
.note.warn { background: var(--warn-soft); border-color: #eddcb8; color: #7a4a08; }
.note.warn svg { color: var(--warn); }

/* Tabellen */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--r-lg) var(--r-lg); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 8px 12px; text-align: left; vertical-align: middle; }
table.data thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-2);
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data thead th.sortable { cursor: pointer; user-select: none; }
table.data thead th.sortable:hover { color: var(--text); background: var(--surface-3); }
table.data thead th .sort-arrow { opacity: .45; margin-left: 3px; font-size: 9px; }
table.data thead th.is-sorted { color: var(--accent); }
table.data thead th.is-sorted .sort-arrow { opacity: 1; }
table.data tbody tr { border-bottom: 1px solid var(--border); }
table.data tbody tr:last-child { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.data .rank { color: var(--text-3); font-size: 12px; width: 30px; text-align: right; }

.post-cell { display: flex; flex-direction: column; gap: 2px; min-width: 240px; max-width: 460px; }
.post-title {
  font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.post-meta { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.bar-cell { position: relative; min-width: 120px; }
.bar-cell .bar-fill {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  height: 18px; border-radius: 4px; background: var(--accent-soft); z-index: 0;
}
.bar-cell span { position: relative; z-index: 1; }

/* Diagramme */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .axis-label { font-size: 10.5px; fill: var(--text-3); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .grid-line.zero { stroke: var(--border-strong); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover ~ .marker, .chart .point:hover { opacity: 1; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.chart-legend .item { display: inline-flex; align-items: center; gap: 6px; cursor: default; }

.heat-cell { stroke: var(--surface); stroke-width: 1.5; cursor: default; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 52px 20px; text-align: center; color: var(--text-3);
}
.empty svg { width: 30px; height: 30px; opacity: .5; }
.empty h3 { font-size: 15px; color: var(--text-2); }
.empty p { margin: 0; max-width: 430px; font-size: 13px; line-height: 1.6; }

/* Hinweisblase */
.tooltip {
  position: fixed; z-index: 80; pointer-events: none;
  background: #23232b; color: #fff; border-radius: 8px;
  padding: 7px 10px; font-size: 12px; line-height: 1.45;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .22);
  max-width: 300px; transition: opacity .08s;
}
.tooltip b { font-weight: 600; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip .t-row span:last-child { font-variant-numeric: tabular-nums; }
.tooltip .t-head { font-weight: 600; margin-bottom: 3px; }
.tooltip .t-sub { color: #a6a6b4; font-size: 11px; }

/* Meldungen */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 85; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: flex-start; gap: 9px;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r); box-shadow: var(--sh-lg); padding: 11px 14px;
  font-size: 13px; max-width: 400px;
  animation: toast-in .18s ease-out forwards;
}
.toast.ok { border-left-color: var(--good); }
.toast.err { border-left-color: var(--bad); }
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.toast.ok svg { color: var(--good); }
.toast.err svg { color: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Fenster */
.modal-back {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: rgba(26, 26, 31, .34); padding: 20px;
  animation: fade-in .13s ease-out forwards;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-lg);
  width: min(620px, 100%); max-height: min(84vh, 780px);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modal-in .16s ease-out forwards;
}
.modal.wide { width: min(940px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; gap: 12px; flex: none;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; }
.modal-head .btn { margin-left: auto; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end; flex: none;
  padding: 13px 18px; border-top: 1px solid var(--border); background: var(--surface-2);
}

/* Ablegeflaeche */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r);
  padding: 30px 20px; text-align: center; color: var(--text-2);
  background: var(--surface-2); cursor: pointer; transition: all .13s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone svg { width: 24px; height: 24px; margin-bottom: 6px; }
.dropzone strong { display: block; font-size: 14px; color: inherit; }
.dropzone small { color: var(--text-3); }

/* Anmeldung */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh); padding: 30px 28px;
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-logo h1 { font-size: 17px; }
.login p.lead { color: var(--text-2); font-size: 13px; margin: 0 0 18px; line-height: 1.6; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.login .btn { justify-content: center; padding: 9px; }
.login .err { color: var(--bad); font-size: 12.5px; min-height: 17px; }

/* Beitrags-Detail */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; }
.detail-metric {
  background: var(--surface-2); border-radius: var(--r-sm); padding: 9px 11px;
  border: 1px solid var(--border);
}
.detail-metric .l { font-size: 11px; color: var(--text-3); }
.detail-metric .v { font-size: 16px; font-weight: 600; }
.caption-box {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 13px; font-size: 12.5px; line-height: 1.65; color: var(--text-2);
  white-space: pre-wrap; max-height: 240px; overflow-y: auto;
}

/* =========================================================== Schmale Fenster */

/* Spalten, die auf dem Handy wegfallen duerfen, ohne dass etwas fehlt:
   ihre Werte stehen dort ohnehin in der Karten-Ansicht. */
@media (max-width: 720px) {
  .hide-sm { display: none !important; }
}

@media (max-width: 720px) {
  :root { --rail: 0px; }

  /* Leiste wandert nach unten - Daumenreichweite, wie in einer App */
  .rail {
    inset: auto 0 0 0; width: 100%; height: auto;
    flex-direction: row; justify-content: space-evenly; align-items: center;
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom, 0px));
    border-right: 0; border-top: 1px solid var(--border);
  }
  .rail-logo { display: none; }
  .rail-nav, .rail-foot { flex-direction: row; margin: 0; width: auto; gap: 2px; }
  .rail-btn { padding: 6px 14px; }
  .rail-btn span { font-size: 10px; }

  .main { margin-left: 0; padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }

  /* Nicht klebend: auf einem Handy ist der Platz zu kostbar, um Titel und
     Auswahlfelder dauerhaft stehen zu lassen. */
  .topbar { position: static; padding: 10px 14px; gap: 8px 10px; min-height: 0; backdrop-filter: none; }
  .topbar h1 { font-size: 15.5px; }
  .topbar-sub { font-size: 11.5px; }
  .topbar-actions { width: 100%; margin-left: 0; gap: 6px; }
  .topbar-actions .select { flex: 1 1 auto; min-width: 0; font-size: 12.5px; padding: 6px 26px 6px 8px; }
  /* Beschriftungen wie "Stichtag" und "vs." kosten hier nur Platz */
  .topbar-actions .sel-label { display: none; }
  .topbar-actions .btn-label { display: none; }
  .topbar-actions .btn { padding: 7px 10px; }

  .content { padding: 14px 14px 32px; }
  /* Der erklaerende Zusatz rutscht unter die Ueberschrift, statt sie zu brechen */
  .section-title { margin: 20px 0 9px; flex-wrap: wrap; gap: 2px 9px; }
  .section-title .hint { flex-basis: 100%; }
  .card-head { padding: 13px 14px 0; }
  .card-body { padding: 12px 14px 14px; }
  .kpi { padding: 11px 13px 12px; }
  .kpi-value { font-size: 21px; }

  .toasts { left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .toast { max-width: none; }

  /* Fenster als Blatt von unten - auf dem Handy angenehmer als ein Kaestchen */
  .modal-back { padding: 0; align-items: flex-end; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .modal-body { padding: 15px; }
  .modal-foot { padding-bottom: calc(13px + env(safe-area-inset-bottom, 0px)); }

  /* --- Tabellen werden zu Karten -------------------------------------
     Eine 14-Spalten-Tabelle laesst sich auf einem Handy nicht sinnvoll
     schieben. Jede Zeile wird deshalb zu einem Block, in dem jeder Wert
     seine Beschriftung aus data-label mitbringt. */
  table.data.stack { display: block; }
  table.data.stack thead { display: none; }
  table.data.stack tbody { display: block; }
  table.data.stack tbody tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border);
  }
  table.data.stack tbody tr:hover { background: transparent; }
  table.data.stack td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
    padding: 0; text-align: left; font-size: 12.5px; min-width: 0;
  }
  table.data.stack td::before {
    content: attr(data-label);
    color: var(--text-3); font-size: 11px; font-weight: 500;
    white-space: nowrap; flex: none;
  }
  table.data.stack td[data-label=""]::before, table.data.stack td:not([data-label])::before { content: none; }
  table.data.stack td.wide { grid-column: 1 / -1; }
  table.data.stack td.wide::before { content: none; }
  table.data.stack td.n { text-align: right; }
  table.data.stack td.rank { display: none; }
  table.data.stack .post-cell { min-width: 0; max-width: none; }
  table.data.stack .post-title { white-space: normal; }
  table.data.stack td > span, table.data.stack td > b { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .table-wrap:has(table.stack) { overflow-x: visible; }
}

/* Auf dem Handy zwei Kacheln nebeneinander - fuenf volle Breiten waeren
   nichts als Scrollweg. */
@media (max-width: 720px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-value { font-size: 19px; }
  .kpi-label { font-size: 11px; }
  .kpi-foot, .kpi-value small { font-size: 11px; }
}

/* Sehr schmale Geraete (iPhone SE & Co.) */
@media (max-width: 340px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  table.data.stack tbody tr { grid-template-columns: minmax(0, 1fr); }
  .topbar-actions .select { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
