/* Kestrel – Designsystem
   Präzisionsinstrument statt Spielzeug: dichte Typografie, Haarlinien,
   eine einzige Signalfarbe. Keine Verläufe, keine Glaseffekte. */

@font-face { font-family: 'Geist'; src: url('/fonts/Geist-Variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/fonts/GeistMono-Variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: dark;
  /* Farbwelt angelehnt an j7tracker: Anthrazit, Karten etwas heller, Indigo als Akzent */
  --bg: #141414;
  --bg-1: #1e1e1e;
  --bg-2: #252525;
  --bg-3: #2c2c2c;
  --bg-4: #343434;
  --line: #262626;
  --line-2: #303030;
  --line-3: #404040;
  --fg: #f2f2f3;
  --fg-2: #b4b4b8;
  --fg-3: #85858c;
  --fg-4: #5c5c63;

  --accent: #5b5ff0;
  --accent-hi: #7275f4;
  --accent-ink: #ffffff;
  --accent-soft: rgba(91, 95, 240, 0.16);
  --accent-line: rgba(91, 95, 240, 0.5);
  --hl: #ffe24a;
  --cashtag: #f5911e;

  --pos: #3ccb7f;
  --pos-soft: rgba(60, 203, 127, 0.1);
  --neg: #f0525b;
  --neg-soft: rgba(240, 82, 91, 0.1);
  --warn: #f2b33d;
  --warn-soft: rgba(242, 179, 61, 0.1);
  --info: #7aa7ff;

  --r-sm: 4px;
  --r: 6px;
  --r-lg: 10px;

  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --header-h: 48px;
  --status-h: 28px;
  --rail-w: 264px;
  --panel-w: 404px;

  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --shadow-pop: 0 0 0 1px var(--line-2), 0 16px 48px -12px rgba(0, 0, 0, 0.7), 0 4px 12px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body {
  font: 400 13px/1.45 var(--font);
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
  overflow: hidden;
}
#app { height: 100%; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
.mono { font-family: var(--mono); font-feature-settings: 'zero', 'ss02'; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-3); }
.dim { color: var(--fg-2); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border: 3px solid transparent; background-clip: padding-box; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--line-3); }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--bg-4) transparent; }

/* ───────── Mikro-Typografie ───────── */
.label {
  font: 500 10.5px/1 var(--mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font: 500 10.5px/1 var(--mono); color: var(--fg-3);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px;
  background: var(--bg-2);
}
.btn-primary .kbd { color: color-mix(in srgb, var(--accent-ink) 70%, transparent); border-color: rgba(0,0,0,.18); background: rgba(0,0,0,.08); }

/* ───────── Gerüst ───────── */
.shell { display: grid; grid-template-rows: var(--header-h) 1fr var(--status-h); height: 100%; }
.main { display: grid; min-height: 0; }
.main.feed-view { grid-template-columns: var(--rail-w) minmax(420px, 1fr) var(--panel-w); }
.main.feed-view.no-rail { grid-template-columns: minmax(420px, 1fr) var(--panel-w); }
.main.page-view { grid-template-columns: 1fr; }

/* Kopfzeile */
.header {
  display: flex; align-items: center; gap: 18px; padding: 0 14px 0 16px;
  border-bottom: 1px solid var(--line); background: var(--bg);
  position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-word { font: 600 13px/1 var(--font); letter-spacing: 0.22em; }
.brand-mark { width: 22px; height: 22px; display: block; }
.nav { display: flex; gap: 2px; margin-left: 6px; }
.nav button {
  height: 30px; padding: 0 11px; border: 0; background: none; border-radius: var(--r);
  color: var(--fg-3); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
}
.nav button:hover { color: var(--fg); background: var(--bg-2); }
.nav button.on { color: var(--fg); background: var(--bg-3); }
.nav .count { font: 500 10.5px/1 var(--mono); color: var(--fg-3); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.chip {
  height: 30px; display: inline-flex; align-items: center; gap: 8px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1);
  color: var(--fg-2); white-space: nowrap; cursor: default;
}
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--line-3); color: var(--fg); }
.chip strong { color: var(--fg); font-weight: 500; }

.live { display: inline-flex; align-items: center; gap: 7px; }
.live i { width: 6px; height: 6px; background: var(--fg-4); display: block; }
.live.on i { background: var(--pos); box-shadow: 0 0 0 3px rgba(60, 203, 127, 0.14); animation: blink 2.4s infinite; }
.live.warn i { background: var(--warn); }
.live.err i { background: var(--neg); }
@keyframes blink { 50% { opacity: 0.45; } }

/* Statusleiste */
.statusbar {
  display: flex; align-items: center; gap: 0; padding: 0 6px;
  border-top: 1px solid var(--line); background: var(--bg);
  font: 400 11px/1 var(--mono); color: var(--fg-3); letter-spacing: -0.01em;
  overflow: hidden; white-space: nowrap;
}
.statusbar .seg { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; height: 100%; border-right: 1px solid var(--line); }
.statusbar .seg:last-child { border-right: 0; }
.statusbar .seg b { color: var(--fg-2); font-weight: 500; }
.statusbar .sp { margin-left: auto; }
.dot { width: 6px; height: 6px; display: inline-block; background: var(--fg-4); }
.dot.ok { background: var(--pos); } .dot.warn { background: var(--warn); } .dot.err { background: var(--neg); }

/* ───────── Linke Spalte: Beobachtungsliste ───────── */
.rail { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.rail-head { padding: 14px 14px 10px; display: flex; align-items: center; justify-content: space-between; }
.rail-search { margin: 0 10px 8px; }
.rail-list { overflow-y: auto; padding: 0 6px 12px; flex: 1; }
.member {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r);
  cursor: pointer; color: var(--fg-2); border: 0; background: none; width: 100%; text-align: left;
}
.member:hover { background: var(--bg-2); color: var(--fg); }
.member.on { background: var(--bg-3); color: var(--fg); }
.member img { width: 24px; height: 24px; border-radius: 6px; background: var(--bg-3); flex: none; object-fit: cover; }
.member .who { min-width: 0; flex: 1; }
.member .nm { display: block; font-weight: 500; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member .hd { display: block; font: 400 11px/1.2 var(--mono); color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member .n { font: 400 10.5px/1 var(--mono); color: var(--fg-4); }
.member.muted-acc { opacity: 0.45; }
.rail-group { padding: 12px 8px 6px; }

/* ───────── Feed ───────── */
.feed { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.feed-bar {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line);
  background: var(--bg); position: relative; z-index: 2;
}
.feed-scroll { overflow-y: auto; flex: 1; position: relative; overscroll-behavior: contain; }
.feed-list { width: 100%; max-width: 980px; margin: 0 auto; padding: 4px 0 16px; }
.paused-pill {
  position: sticky; top: 10px; z-index: 3; margin: 10px auto -38px; width: max-content;
  display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px;
  background: var(--fg); color: var(--bg); border-radius: 999px; font-weight: 600; font-size: 12px;
  border: 0; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}

.seg-ctl { display: inline-flex; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg-1); gap: 2px; }
.seg-ctl button {
  height: 24px; padding: 0 9px; border: 0; background: none; color: var(--fg-3); border-radius: 4px;
  cursor: pointer; font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.seg-ctl button:hover { color: var(--fg); }
.seg-ctl button.on { background: var(--bg-4); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg-ctl button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Tweet-Karte */
.tw {
  position: relative; margin: 10px 14px; padding: 12px 14px 12px 16px;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 8px;
  transition: border-color 0.2s, background-color 0.2s;
}
.tw:hover { border-color: var(--line-3); }
.tw.sel { border-color: var(--line-3); background: #212121; }
.tw::before { content: ''; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; border-radius: 8px 0 0 8px; background: var(--accent); }
.tw.fresh { animation: fresh-bg 3.5s var(--ease) forwards; }
.tw.hot::before { background: var(--warn); }
@keyframes fresh-bg { 0% { background: #26274a; } 100% { background: var(--bg-1); } }
.tw-top { display: flex; align-items: flex-start; gap: 10px; }
.tw-who { min-width: 0; flex: 1; }
.tw-sub { display: flex; align-items: center; gap: 6px; font: 400 11.5px/1.3 var(--mono); color: var(--fg-3); margin-top: 2px; }
.tw-sub svg { width: 11px; height: 11px; }
.tw-clock { font: 400 11px/1 var(--mono); color: var(--fg-4); }
.tw-ctxline { margin: 10px 0 0; font-size: 13px; font-weight: 500; color: var(--info); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tw-ctxline .ar { color: var(--fg-3); }
.tw-deploy { display: inline-flex; flex: none; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px var(--accent-line); }
.tw-deploy button { height: 30px; border: 0; background: var(--accent); color: #fff; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; font: 700 12px/1 var(--font); letter-spacing: 0.06em; text-transform: uppercase; padding: 0 14px; }
.tw-deploy button:hover { background: var(--accent-hi); }
.tw-deploy button.side { padding: 0 9px; background: #4b4fd6; border-right: 1px solid rgba(0,0,0,.25); }
.tw-deploy button.side:hover { background: var(--accent); }
.tw-deploy svg { width: 14px; height: 14px; }
.tw-in { animation: slide-in 0.32s var(--ease); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--bg-3); display: block; cursor: pointer; }
.tw-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; line-height: 1.3; }
.tw-name { font-weight: 700; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.tw-handle { color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: 400 12px/1 var(--mono); }
.tw-verified { width: 13px; height: 13px; color: var(--info); flex: none; align-self: center; }
.tw-meta { margin-left: auto; display: flex; align-items: baseline; gap: 10px; flex: none; font: 400 11px/1 var(--mono); color: var(--fg-3); }
.tw-delta { color: var(--fg-4); }
.tw-delta.fast { color: var(--pos); }
.tag {
  font: 500 10px/1 var(--mono); letter-spacing: 0.05em; text-transform: uppercase;
  padding: 3px 5px; border-radius: 3px; border: 1px solid var(--line-2); color: var(--fg-3); align-self: center;
}
.tag.rt { color: var(--pos); border-color: rgba(60,203,127,.3); }
.tag.qt { color: var(--info); border-color: rgba(122,167,255,.3); }
.tag.re { color: var(--fg-2); }
.tag.kw { color: var(--warn); border-color: rgba(242,179,61,.35); }
.tw-ctx { font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.tw-ctx b { color: var(--fg-2); font-weight: 500; }
.tw-text { margin: 8px 0 0; white-space: pre-wrap; word-wrap: break-word; color: var(--fg); font-size: 14px; font-weight: 500; line-height: 1.55; letter-spacing: -0.006em; }
.tw-text a { color: var(--info); }
.tw-text a:hover { text-decoration: underline; }
.tw-text mark { background: var(--hl); color: #111; border-radius: 3px; padding: 0 3px; font-weight: 700; }
.tw-text .cash { background: var(--cashtag); color: #111; border-radius: 3px; padding: 0 3px; font-weight: 700; }
.tw-text .w { cursor: text; }
.tw-text .w:hover { color: var(--accent-hi); }

.tw-media { display: grid; gap: 4px; margin-top: 10px; border-radius: var(--r-lg); overflow: hidden; max-width: 560px; }
.tw-media.n1 { grid-template-columns: 1fr; }
.tw-media.n2, .tw-media.n4 { grid-template-columns: 1fr 1fr; }
.tw-media.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.tw-media.n3 > :first-child { grid-row: span 2; }
.media {
  position: relative; background: var(--bg-3); overflow: hidden; cursor: pointer;
  border: 0; padding: 0; display: block; min-height: 120px; max-height: 340px;
}
.tw-media.n1 .media { max-height: 420px; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tw-media.n1 .media img { object-fit: contain; background: var(--bg-2); max-height: 420px; }
.media .use {
  position: absolute; left: 8px; bottom: 8px; display: none; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px; border-radius: 5px; background: rgba(8, 9, 10, 0.86);
  border: 1px solid var(--line-3); font-size: 11.5px; font-weight: 500; color: var(--fg);
}
.media:hover .use { display: inline-flex; }
.media .vid { position: absolute; right: 8px; top: 8px; font: 500 10px/1 var(--mono); padding: 4px 6px; background: rgba(8,9,10,.8); border-radius: 4px; color: var(--fg-2); }

.tw-quote { margin-top: 10px; border: 1px solid var(--line-2); border-left: 3px solid var(--line-3); border-radius: 6px; padding: 10px 12px; background: #191919; }
.tw-quote .tw-head { font-size: 12.5px; }
.tw-quote .q-av { width: 18px; height: 18px; border-radius: 5px; align-self: center; }
.tw-quote .tw-text { font-size: 13px; margin-top: 4px; }
.tw-quote .tw-media { max-width: 100%; }
.tw-card { margin-top: 10px; display: flex; border: 1px solid var(--line-2); border-radius: var(--r-lg); overflow: hidden; max-width: 560px; }
.tw-card img { width: 96px; height: 96px; object-fit: cover; flex: none; background: var(--bg-3); }
.tw-card div { padding: 10px 12px; min-width: 0; }
.tw-card .d { color: var(--fg-3); font: 400 11px/1.2 var(--mono); }
.tw-card .t { font-weight: 500; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tw-actions { display: flex; align-items: center; gap: 6px; margin-top: 11px; flex-wrap: wrap; }
.act {
  height: 26px; padding: 0 9px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); border-radius: 5px; background: var(--bg-1); color: var(--fg-2);
  font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: border-color .12s, color .12s, background-color .12s;
}
.act:hover { color: var(--fg); border-color: var(--line-3); background: var(--bg-2); }
.act svg { width: 13px; height: 13px; }
.act.go { color: #c9caff; border-color: var(--accent-line); background: var(--accent-soft); }
.act.go:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.act .k { font: 500 10px/1 var(--mono); color: var(--fg-4); margin-left: 2px; }
.act.go .k { color: inherit; opacity: .6; }
.act.alt svg { color: #9c9ef8; }
.act.ghost { border-color: transparent; background: none; color: var(--fg-3); }
.act.ghost:hover { color: var(--fg); background: var(--bg-2); }
.tw-stats { margin-left: auto; display: flex; gap: 12px; font: 400 11px/1 var(--mono); color: var(--fg-4); }

/* Text-Auswahl-Leiste */
.selbar {
  position: fixed; z-index: 40; display: flex; gap: 4px; padding: 4px; border-radius: 8px;
  background: var(--bg-2); box-shadow: var(--shadow-pop); transform: translate(-50%, calc(-100% - 8px));
  animation: pop .14s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, calc(-100% - 4px)) scale(.98); } }

/* ───────── Deploy-Panel ───────── */
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.panel-scroll { overflow-y: auto; flex: 1; }
.p-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.p-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 52px; }
.p-title { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.src-tweet { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px dashed var(--line-3); border-radius: var(--r); background: var(--bg-1); }
.src-tweet img { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.src-tweet .t { font-size: 12px; color: var(--fg-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.src-tweet .h { font: 400 11px/1.3 var(--mono); color: var(--fg-3); }
.icon-btn {
  width: 26px; height: 26px; display: inline-grid; place-items: center; border: 0; border-radius: 5px;
  background: none; color: var(--fg-3); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--bg-3); color: var(--fg); }
.icon-btn svg { width: 14px; height: 14px; }

.ident { display: grid; grid-template-columns: 96px 1fr; gap: 12px; }
.img-tile {
  width: 96px; height: 96px; border-radius: var(--r-lg); border: 1px solid var(--line-2); background: var(--bg-2);
  position: relative; overflow: hidden; cursor: pointer; padding: 0; display: grid; place-items: center; color: var(--fg-4);
}
.img-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-tile .ov { position: absolute; inset: auto 0 0 0; height: 26px; display: none; align-items: center; justify-content: center; gap: 6px; font-size: 11px; font-weight: 500; color: var(--fg); background: rgba(8,9,10,.82); }
.img-tile:hover .ov { display: flex; }
.img-tile.drop { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.img-src { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.thumb {
  width: 38px; height: 38px; border-radius: 6px; border: 1px solid var(--line-2); padding: 0; overflow: hidden;
  background: var(--bg-2); cursor: pointer; display: grid; place-items: center; color: var(--fg-3);
  font: 600 13px/1 var(--font);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { border-color: var(--line-3); color: var(--fg); }
.thumb.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.thumb svg { width: 15px; height: 15px; }

/* Eingabefelder */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 10px; }
.field-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-top .hint { font: 400 10.5px/1 var(--mono); color: var(--fg-4); }
.field-top .hint.over { color: var(--neg); }
.input, .textarea, .select {
  width: 100%; height: 34px; padding: 0 10px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--bg-1); color: var(--fg); outline: none;
  transition: border-color .12s, box-shadow .12s, background-color .12s;
}
.input::placeholder, .textarea::placeholder { color: var(--fg-4); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--line-3); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--bg-2); }
.input.big { height: 38px; font-size: 14px; font-weight: 500; }
.input.tick { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }
.input.sm { height: 28px; font-size: 12px; padding: 0 8px; }
.input.num-in { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.textarea { height: auto; min-height: 64px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(135deg, var(--fg-3) 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.affix { position: relative; display: flex; align-items: center; }
.affix .input { padding-right: 46px; }
.affix .sfx { position: absolute; right: 10px; font: 500 11px/1 var(--mono); color: var(--fg-3); pointer-events: none; }
.input-row { display: flex; gap: 6px; }
.pill-row { display: flex; gap: 4px; flex-wrap: wrap; }
.pill {
  height: 26px; padding: 0 9px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--bg-1);
  color: var(--fg-2); font: 500 11.5px/1 var(--mono); cursor: pointer; font-variant-numeric: tabular-nums;
}
.pill:hover { color: var(--fg); border-color: var(--line-3); }
.pill.on { color: var(--fg); border-color: var(--fg-3); background: var(--bg-3); }

.switch { position: relative; display: inline-block; vertical-align: middle; width: 30px; height: 18px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--bg-4); border: 1px solid var(--line-3); transition: background-color .15s, border-color .15s; }
.switch span::after { content: ''; position: absolute; width: 12px; height: 12px; left: 2px; top: 2px; border-radius: 50%; background: var(--fg-3); transition: transform .18s var(--ease), background-color .15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(12px); background: var(--accent-ink); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.toggle-row + .toggle-row { border-top: 1px solid var(--line); }
.toggle-row .t { font-weight: 500; }
.toggle-row .d { font-size: 12px; color: var(--fg-3); margin-top: 2px; }

details.adv summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary .chev { transition: transform .15s; color: var(--fg-3); }
details.adv[open] summary .chev { transform: rotate(90deg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.bundle-row { display: grid; grid-template-columns: 18px 1fr 84px; gap: 8px; align-items: center; padding: 5px 0; }
.check { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* Knöpfe */
.btn {
  height: 32px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--bg-2);
  color: var(--fg); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color .12s, border-color .12s, transform .06s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-3); border-color: var(--line-3); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn-ghost { background: none; border-color: transparent; color: var(--fg-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--fg); border-color: transparent; }
.btn-danger { color: var(--neg); }
.btn-danger:hover { background: var(--neg-soft); border-color: rgba(240,82,91,.4); }
.deploy-btn {
  width: 100%; height: 46px; border-radius: var(--r); border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font: 600 14px/1 var(--font); letter-spacing: -0.01em;
  display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 16px;
  transition: background-color .12s, transform .06s;
  position: relative; overflow: hidden;
}
.deploy-btn:hover { background: var(--accent-hi); }
.deploy-btn:active { transform: translateY(1px); }
.deploy-btn:disabled { background: var(--bg-3); color: var(--fg-4); cursor: not-allowed; }
.deploy-btn .amt { font: 600 13px/1 var(--mono); font-variant-numeric: tabular-nums; }
.deploy-btn.busy::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 40%; background: var(--accent-ink); opacity: .35; animation: busy 1s linear infinite; }
@keyframes busy { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.deploy-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.deploy-foot .meta { display: flex; justify-content: space-between; margin-top: 8px; font: 400 11px/1 var(--mono); color: var(--fg-3); }

/* Ablauf eines Deploys */
.steps { display: flex; flex-direction: column; gap: 0; margin-top: 2px; }
.step { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: 12.5px; color: var(--fg-3); }
.step i { width: 7px; height: 7px; background: var(--fg-4); justify-self: center; }
.step.done { color: var(--fg-2); } .step.done i { background: var(--pos); }
.step.run { color: var(--fg); } .step.run i { background: var(--accent); animation: blink 0.9s infinite; }
.step.fail { color: var(--neg); } .step.fail i { background: var(--neg); }
.step .ms { font: 400 11px/1 var(--mono); color: var(--fg-4); }
.result-card { border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 12px; background: var(--bg-1); }
.result-card.ok { border-color: rgba(60,203,127,.35); }
.result-card.bad { border-color: rgba(240,82,91,.35); }
.addr { font: 400 11.5px/1.3 var(--mono); color: var(--fg-2); word-break: break-all; }

/* Positionen kompakt */
.pos-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; }
.pos-row + .pos-row { border-top: 1px solid var(--line); }
.pos-row img, .tok-img { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; background: var(--bg-3); display: block; }
.pos-row .nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-row .sub { font: 400 11px/1.2 var(--mono); color: var(--fg-3); }
.sell-pills { display: flex; gap: 3px; }
.sell-pills button { height: 22px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--bg-1); color: var(--fg-2); font: 500 10.5px/1 var(--mono); cursor: pointer; }
.sell-pills button:hover { border-color: rgba(240,82,91,.45); color: var(--neg); background: var(--neg-soft); }

/* ───────── Seiten (Positionen, Verlauf, Einstellungen) ───────── */
.page { overflow-y: auto; min-height: 0; }
.page-inner { max-width: 1180px; margin: 0 auto; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; margin: 6px 0 0; }
.page-head p { margin: 6px 0 0; color: var(--fg-3); max-width: 620px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 22px; overflow: hidden; }
.kpi { padding: 14px 16px; border-right: 1px solid var(--line); background: var(--bg-1); }
.kpi:last-child { border-right: 0; }
.kpi .v { font: 500 22px/1.1 var(--mono); letter-spacing: -0.03em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi .s { font: 400 11px/1 var(--mono); color: var(--fg-3); margin-top: 6px; }

.table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.table th { text-align: left; font: 500 10.5px/1 var(--mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--fg-3); padding: 10px 14px; background: var(--bg-1); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg-1); }
.table .r { text-align: right; }
.table .tok { display: flex; align-items: center; gap: 10px; }
.status-tag { font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .05em; padding: 4px 6px; border-radius: 4px; }
.status-tag.ok { color: var(--pos); background: var(--pos-soft); }
.status-tag.bad { color: var(--neg); background: var(--neg-soft); }
.status-tag.run { color: var(--accent); background: var(--accent-soft); }

.settings { display: grid; grid-template-columns: 220px 1fr; gap: 40px; }
.snav { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; gap: 1px; }
.snav button { text-align: left; height: 32px; padding: 0 10px; border: 0; border-radius: var(--r); background: none; color: var(--fg-3); font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.snav button:hover { color: var(--fg); background: var(--bg-2); }
.snav button.on { color: var(--fg); background: var(--bg-3); }
.snav button svg { width: 15px; height: 15px; }
.card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-1); }
.card + .card { margin-top: 16px; }
.card-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.card-head p { margin: 4px 0 0; color: var(--fg-3); font-size: 12.5px; max-width: 640px; }
.card-body { padding: 16px 18px; }
.card-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.card-row:first-child { border-top: 0; }
.notice { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg-2); font-size: 12.5px; }
.notice.warn { border-color: rgba(242,179,61,.3); background: var(--warn-soft); color: #e8cf9c; }
.notice.bad { border-color: rgba(240,82,91,.3); background: var(--neg-soft); color: #f3b3b7; }
.notice svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.steps-ol { margin: 8px 0 0; padding-left: 18px; color: var(--fg-2); }
.steps-ol li { margin: 4px 0; }
code, .code { font: 400 12px/1.4 var(--mono); background: var(--bg-3); padding: 1px 5px; border-radius: 4px; color: var(--fg); }

.acc-row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.acc-row:first-child { border-top: 0; }
.meter { width: 120px; height: 4px; background: var(--bg-4); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--fg-2); }

/* Leerzustand / Einrichtung */
.empty { padding: 56px 32px; display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--fg-3); }
.empty h3 { color: var(--fg); font-size: 15px; margin: 14px 0 6px; font-weight: 600; letter-spacing: -.01em; }
.setup { max-width: 560px; margin: 48px auto; padding: 0 24px; }
.setup h2 { font-size: 20px; letter-spacing: -0.025em; margin: 10px 0 6px; font-weight: 600; }
.setup p { color: var(--fg-3); margin: 0 0 22px; }
.setup-step { display: grid; grid-template-columns: 28px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); background: var(--bg-1); }
.setup-step:first-of-type { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.setup-step:last-of-type { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.setup-step + .setup-step { border-top: 0; }
.setup-step .n { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line-3); display: grid; place-items: center; font: 500 11px/1 var(--mono); color: var(--fg-3); }
.setup-step.done .n { background: var(--pos); border-color: var(--pos); color: #06150d; }
.setup-step .t { font-weight: 500; }
.setup-step .d { color: var(--fg-3); font-size: 12px; margin-top: 2px; }

/* Anmeldung */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background:
  linear-gradient(var(--bg), var(--bg)) padding-box; }
.auth-card { width: min(400px, 100%); padding: 32px 30px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-1); box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); }
.auth-card h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 6px; }
.auth-card p { margin: 0; font-size: 12.5px; line-height: 1.55; }
.auth-msg { min-height: 30px; display: flex; align-items: center; font-size: 12.5px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font: 400 11px/1 var(--mono); color: var(--fg-4); }
.setup-step .setup-body { grid-column: 2 / -1; padding: 6px 0 4px; }
.setup-step.open { background: var(--bg-2); }

/* Überlagerungen */
.scrim { position: fixed; inset: 0; background: rgba(4, 5, 6, 0.66); z-index: 50; display: grid; place-items: start center; padding-top: 12vh; animation: fade .14s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, calc(100vw - 32px)); background: var(--bg-1); border-radius: 12px; box-shadow: var(--shadow-pop); overflow: hidden; animation: rise .18s var(--ease); }
.modal.wide { width: min(760px, calc(100vw - 32px)); }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.modal-body { padding: 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--bg); }

.palette { width: min(620px, calc(100vw - 32px)); background: var(--bg-1); border-radius: 12px; box-shadow: var(--shadow-pop); overflow: hidden; animation: rise .16s var(--ease); }
.palette input { width: 100%; height: 52px; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 0 18px; font-size: 15px; outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 360px; overflow-y: auto; }
.palette li { display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 38px; border-radius: 7px; color: var(--fg-2); cursor: pointer; }
.palette li.on { background: var(--bg-3); color: var(--fg); }
.palette li .g { margin-left: auto; font: 400 11px/1 var(--mono); color: var(--fg-4); }
.palette li svg { width: 15px; height: 15px; color: var(--fg-3); }

.toasts { position: fixed; right: 16px; bottom: calc(var(--status-h) + 12px); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: 340px; }
.toast { display: grid; grid-template-columns: 3px 1fr auto; gap: 12px; align-items: start; padding: 11px 12px 11px 0; background: var(--bg-2); border-radius: 8px; box-shadow: var(--shadow-pop); overflow: hidden; animation: rise .2s var(--ease); }
.toast .bar { align-self: stretch; background: var(--fg-3); }
.toast.ok .bar { background: var(--pos); } .toast.bad .bar { background: var(--neg); } .toast.warn .bar { background: var(--warn); } .toast.accent .bar { background: var(--accent); }
.toast .tt { font-weight: 500; }
.toast .td { color: var(--fg-3); font-size: 12px; margin-top: 2px; word-break: break-word; }

/* Zuschneiden */
.crop-stage { position: relative; background: #000; display: grid; place-items: center; user-select: none; border-radius: var(--r); overflow: hidden; }
.crop-stage img { max-width: 100%; max-height: 52vh; display: block; }
.crop-box { position: absolute; border: 1px solid var(--accent); box-shadow: 0 0 0 9999px rgba(0,0,0,.6); cursor: move; }
.crop-box::after { content: ''; position: absolute; inset: 33.33% 0; border-top: 1px solid rgba(255,255,255,.18); border-bottom: 1px solid rgba(255,255,255,.18); pointer-events: none; }
.crop-box .h { position: absolute; width: 12px; height: 12px; right: -6px; bottom: -6px; background: var(--accent); cursor: nwse-resize; }

.log { font: 400 11.5px/1.6 var(--mono); max-height: 360px; overflow-y: auto; padding: 12px 18px; color: var(--fg-3); }
.log .warn { color: var(--warn); } .log .error { color: var(--neg); }

.lock-screen { display: grid; place-items: center; height: 100%; }

@media (max-width: 1280px) {
  :root { --rail-w: 220px; --panel-w: 372px; }
}
@media (max-width: 1080px) {
  .main.feed-view { grid-template-columns: minmax(380px, 1fr) var(--panel-w); }
  .main.feed-view .rail { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .settings { grid-template-columns: 1fr; }
  .snav { position: static; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  .shell { height: auto; min-height: 100%; grid-template-columns: minmax(0, 1fr); }
  .main.feed-view { grid-template-columns: minmax(0, 1fr); }
  .feed-bar { flex-wrap: wrap; }
  .feed-bar .affix { order: 3; flex-basis: 100%; max-width: none !important; }
  .seg-ctl { max-width: 100%; overflow-x: auto; }
  .tw { padding: 12px 12px 10px; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
  .avatar { width: 34px; height: 34px; }
  .tw-handle { display: none; }
  .tw-media, .tw-card { max-width: 100%; }
  .tw-stats { display: none; }
  .header-right .chip { padding: 0 8px; }
  .brand-word { display: none; }
  .nav { margin-left: 0; }
  .nav button { padding: 0 9px; }
  .header-right .chip .mono.muted { display: none; }
  .statusbar .seg:nth-child(n+3) { display: none; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .table { display: block; overflow-x: auto; }
  .feed { border-right: 0; }
  .feed-scroll, .panel-scroll { overflow: visible; }
  .header { gap: 10px; padding: 0 12px; }
  .nav button span.l { display: none; }
  .header-right .chip.opt { display: none; }
  .page-inner { padding: 20px 16px 48px; }
}
