/* ============================================================
   JARVIS Cockpit — HUD Stylesheet
   ============================================================ */

:root {
  --bg: #05070c;
  --panel: rgba(255, 255, 255, 0.025);
  --panel-solid: #0a0e17;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #d6dce8;
  --muted: #8b93a7;
  --muted2: #58607355;
  --muted-solid: #586073;
  --accent: #22d3ee;
  --accent-dim: #0e7490;
  --accent-soft: rgba(34, 211, 238, 0.12);
  --accent-line: rgba(34, 211, 238, 0.35);
  --accent-glow: rgba(34, 211, 238, 0.28);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.1);
  --danger: #f87171;
  --font-ui: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  --tabbar-h: calc(60px + env(safe-area-inset-bottom, 0px));
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* dezente Grid-Textur + Glow oben — HUD-Grundstimmung */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(34, 211, 238, 0.055), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
  background-size: 100% 100%, 44px 44px, 44px 44px;
}

.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }

::selection { background: var(--accent-soft); color: var(--accent); }

/* Scrollbars dezent */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
::-webkit-scrollbar-track { background: transparent; }

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input, textarea {
  font-family: inherit;
  font-size: 16px; /* nie kleiner — iOS zoomt sonst beim Fokussieren in die Seite */
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.18s ease-out, box-shadow 0.18s ease-out;
}
input:focus, textarea:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.15), 0 0 18px -6px var(--accent-glow);
}
input::placeholder, textarea::placeholder { color: var(--muted-solid); }

/* Ecken-Ticks fuer wichtige Panels */
.ticks { position: relative; }
.ticks::before, .ticks::after {
  content: '';
  position: absolute;
  width: 11px;
  height: 11px;
  border: 0 solid rgba(34, 211, 238, 0.55);
  pointer-events: none;
}
.ticks::before { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.ticks::after { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }

/* ============================================================
   Login
   ============================================================ */

.login {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.login::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 45% at 50% 30%, rgba(34, 211, 238, 0.07), transparent 65%);
}

.login-box {
  width: 100%;
  max-width: 340px;
  padding: 40px 28px 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  backdrop-filter: blur(8px);
}

.login-mark {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.42em;
  margin-right: -0.42em; /* letter-spacing optisch zentrieren */
  color: var(--text);
  text-shadow: 0 0 24px var(--accent-glow);
}

.login-sub {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted-solid);
  margin: 8px 0 30px;
}

#login-form { display: flex; flex-direction: column; gap: 12px; }

#login-pass {
  height: 48px;
  padding: 0 16px;
  text-align: center;
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
}

#login-btn {
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.06em;
  transition: background 0.18s ease-out, box-shadow 0.18s ease-out, transform 0.15s ease-out;
}
#login-btn:hover { background: rgba(34, 211, 238, 0.2); box-shadow: 0 0 24px -6px var(--accent-glow); }
#login-btn:active { transform: scale(0.985); }
#login-btn:disabled { opacity: 0.5; }

.login-error {
  min-height: 18px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--danger);
}

.shake { animation: shake 0.4s ease-out; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

/* ============================================================
   App-Shell
   ============================================================ */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100dvh;
}

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(46px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 8px; }

.brand-mark {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.3em;
  text-shadow: 0 0 16px var(--accent-glow);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent); }
  50% { opacity: 0.35; box-shadow: 0 0 2px var(--accent); }
}

.online { font-size: 10px; letter-spacing: 0.18em; color: var(--accent); opacity: 0.85; }

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
#mrr-mini { color: var(--accent); }
.sep { width: 1px; height: 14px; background: var(--line-strong); }

/* --- Main / Views --- */
#views { overflow: hidden; position: relative; }

.view { display: none; height: 100%; }
.view.active { display: block; animation: viewIn 0.22s ease-out; }
.view-chat.active { display: flex; flex-direction: column; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.view-scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 28px;
}

.view-title {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-bottom: 14px;
}
.view-title-tag { font-size: 11px; color: var(--muted-solid); letter-spacing: 0.08em; font-weight: 400; }

.section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--muted-solid);
  margin: 26px 0 10px;
}

.empty { color: var(--muted-solid); font-size: 13px; padding: 14px 2px; }

/* Fade-Stagger fuer Listen */
.fade-item { animation: itemIn 0.28s ease-out both; }
@keyframes itemIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* ============================================================
   Tab-Bar
   ============================================================ */

.tabbar {
  display: flex;
  border-top: 1px solid var(--line);
  background: rgba(5, 7, 12, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tabbar button {
  flex: 1;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted-solid);
  position: relative;
  transition: color 0.18s ease-out;
}
.tabbar button svg { width: 21px; height: 21px; }
.tabbar button span { font-size: 10px; letter-spacing: 0.04em; }

.tabbar button.active { color: var(--accent); }
.tabbar button.active svg { filter: drop-shadow(0 0 6px var(--accent-glow)); }
.tabbar button.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 25%;
  right: 25%;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* ============================================================
   Chat
   ============================================================ */

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.view-title-sm { font-size: 16px; font-weight: 600; }

.ghost-btn {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  min-height: 32px;
  transition: color 0.18s ease-out, border-color 0.18s ease-out;
}
.ghost-btn:hover { color: var(--accent); border-color: var(--accent-line); }

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 8px;
}

.msg { display: flex; margin-bottom: 10px; animation: itemIn 0.22s ease-out both; }
.msg.user { justify-content: flex-end; }
.msg.jarvis { justify-content: flex-start; }

.bubble {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 14.5px;
  overflow-wrap: break-word;
}
.msg.user .bubble {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-bottom-right-radius: 4px;
  color: #e8fbff;
}
.msg.jarvis .bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.chat-hint {
  color: var(--muted-solid);
  font-size: 13px;
  text-align: center;
  padding: 48px 24px;
  line-height: 1.7;
}
.chat-hint b { color: var(--muted); font-weight: 500; }

/* "Jarvis denkt…" */
.bubble.typing { display: flex; align-items: center; gap: 4px; padding: 12px 14px; }
.typing .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotPulse 1.2s ease-in-out infinite;
}
.typing .dot:nth-child(2) { animation-delay: 0.15s; }
.typing .dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotPulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
.typing-label { font-size: 12px; color: var(--muted-solid); margin-left: 6px; }

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: rgba(5, 7, 12, 0.9);
}

#chat-input {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  padding: 11px 14px;
  line-height: 1.45;
  border-radius: 10px;
}

#chat-send {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  transition: background 0.18s ease-out, box-shadow 0.18s ease-out, opacity 0.18s ease-out;
}
#chat-send svg { width: 18px; height: 18px; }
#chat-send:hover { background: rgba(34, 211, 238, 0.2); box-shadow: 0 0 16px -4px var(--accent-glow); }
#chat-send:disabled { opacity: 0.4; }

/* ============================================================
   Markdown-Rendering
   ============================================================ */

.md p { margin: 0.35em 0; }
.md p:first-child { margin-top: 0; }
.md p:last-child { margin-bottom: 0; }
.md h3, .md h4, .md h5 {
  margin: 0.9em 0 0.35em;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.md h3:first-child, .md h4:first-child, .md h5:first-child { margin-top: 0; }
.md h3 { font-size: 17px; color: var(--accent); }
.md h4 { font-size: 15px; }
.md h5 { font-size: 13.5px; color: var(--muted); }
.md ul, .md ol { margin: 0.4em 0; padding-left: 1.35em; }
.md li { margin: 0.18em 0; }
.md a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-line); }
.md code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: rgba(34, 211, 238, 0.08);
  color: #9fecf8;
  padding: 0.12em 0.38em;
  border-radius: 4px;
}
.md pre {
  margin: 0.6em 0;
  padding: 10px 12px;
  background: #070a12;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}
.md pre code { background: none; padding: 0; color: #b8ecf5; font-size: 12.5px; line-height: 1.55; }
.md hr { border: none; border-top: 1px solid var(--line); margin: 0.9em 0; }
.md strong { color: #eef2f9; }

.md-view { padding: 4px 2px 24px; font-size: 15px; }

/* ============================================================
   Notizen & Briefings
   ============================================================ */

.search-wrap { position: relative; margin-bottom: 12px; }
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted-solid);
  pointer-events: none;
}
#note-search {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 38px;
  -webkit-appearance: none;
}
#note-search::-webkit-search-cancel-button { -webkit-appearance: none; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  font-size: 12px;
  font-family: var(--font-mono);
  padding: 7px 13px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  transition: all 0.18s ease-out;
}
.chip.active {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
  box-shadow: 0 0 14px -6px var(--accent-glow);
}

.file-list { display: flex; flex-direction: column; gap: 6px; }

.list-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  width: 100%;
  min-height: 52px;
  padding: 9px 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.18s ease-out, background 0.18s ease-out, transform 0.15s ease-out;
}
.list-item:hover { border-color: var(--accent-line); background: rgba(34, 211, 238, 0.04); }
.list-item:active { transform: scale(0.99); }

.li-name { font-size: 14.5px; font-weight: 500; color: var(--text); }
.li-meta { font-size: 11px; color: var(--muted-solid); }
.li-meta .dir-tag { color: var(--accent-dim); }

/* Suchtreffer */
.hit-line { color: var(--muted-solid); }
.hit-text {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.hit-text mark {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 3px;
  padding: 0 2px;
}

/* Viewer */
.viewer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--accent);
  min-height: 44px;
  padding-right: 8px;
}
.back-btn svg { width: 17px; height: 17px; }
.viewer-title {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Aufgaben
   ============================================================ */

.task-add { display: flex; gap: 8px; margin-bottom: 14px; }
#task-new { flex: 1; height: 44px; padding: 0 14px; }
.task-add button {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: background 0.18s ease-out, box-shadow 0.18s ease-out;
}
.task-add button svg { width: 18px; height: 18px; }
.task-add button:hover { background: rgba(34, 211, 238, 0.2); box-shadow: 0 0 16px -4px var(--accent-glow); }

.task-list { display: flex; flex-direction: column; gap: 6px; }
.task-list.collapsed { display: none; }

.task {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.18s ease-out, opacity 0.2s ease-out;
}
.task:hover { border-color: var(--line-strong); }

.task .box {
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: border-color 0.18s ease-out, background 0.18s ease-out;
}
.task .box svg { width: 12px; height: 12px; }
.task:hover .box { border-color: var(--accent-line); }

.task.done { opacity: 0.5; }
.task.done .box { background: var(--accent-soft); border-color: var(--accent-line); }
.task.done .task-text { text-decoration: line-through; text-decoration-color: var(--muted-solid); }

.task-text { font-size: 14px; line-height: 1.45; }
.task-text .task-date { color: var(--muted-solid); font-family: var(--font-mono); font-size: 11.5px; }

.section-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
  transition: color 0.18s ease-out;
}
.section-toggle:hover { color: var(--text); }
.section-toggle .chev { display: inline-block; transition: transform 0.18s ease-out; color: var(--accent); }
.section-toggle.open .chev { transform: rotate(90deg); }
.section-toggle .count { font-size: 11px; color: var(--muted-solid); }

/* Erinnerungen */
.reminder-list { display: flex; flex-direction: column; gap: 6px; }
.reminder {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent-dim);
  border-radius: 8px;
}
.reminder-at { font-size: 11px; font-family: var(--font-mono); color: var(--accent); letter-spacing: 0.03em; }
.reminder-text { font-size: 14px; }

/* ============================================================
   Ziel
   ============================================================ */

.ring-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 16px;
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.ring-wrap { position: relative; width: 220px; height: 220px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.06); stroke-width: 7; }
.ring-prog {
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
  filter: drop-shadow(0 0 7px var(--accent-glow));
  transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}
.ring-pct {
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  color: #eef7fa;
  text-shadow: 0 0 26px var(--accent-glow);
}
.ring-sub { font-size: 11.5px; color: var(--accent); letter-spacing: 0.02em; }
.ring-sub .muted { color: var(--muted-solid); }

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px 11px;
  transition: border-color 0.18s ease-out;
}
.tile-val { font-size: 24px; font-weight: 600; line-height: 1.15; }
.tile-label { font-size: 11px; color: var(--muted-solid); letter-spacing: 0.04em; margin-top: 2px; }

.tile.amber { border-color: rgba(251, 191, 36, 0.35); background: var(--amber-soft); }
.tile.amber .tile-val { color: var(--amber); text-shadow: 0 0 16px rgba(251, 191, 36, 0.35); }

/* Status-Balken */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { animation: itemIn 0.28s ease-out both; }
.bar-top { display: flex; justify-content: space-between; margin-bottom: 5px; }
.bar-label { font-size: 11.5px; color: var(--muted); letter-spacing: 0.04em; }
.bar-val { font-size: 11.5px; color: var(--accent); }
.bar-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 3px;
  box-shadow: 0 0 8px var(--accent-glow);
  transform-origin: left;
  animation: barIn 0.7s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}
@keyframes barIn { from { transform: scaleX(0); } }

.db-error { margin-top: 16px; font-size: 11px; color: var(--amber); }

/* ============================================================
   Toast
   ============================================================ */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px);
  transform: translate(-50%, 12px);
  z-index: 100;
  max-width: 88vw;
  padding: 10px 18px;
  font-size: 13px;
  background: #0b101c;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { border-color: rgba(248, 113, 113, 0.4); color: #fecaca; }
#toast.warn { border-color: rgba(251, 191, 36, 0.4); color: #fde68a; }

/* ============================================================
   Desktop: Tab-Bar wird linke Rail
   ============================================================ */

@media (min-width: 900px) {
  .app {
    grid-template-columns: 78px 1fr;
    grid-template-rows: auto 1fr;
  }
  .topbar { grid-column: 1 / 3; padding: 0 24px; }
  #views { grid-column: 2; }

  .tabbar {
    grid-column: 1;
    grid-row: 2;
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
    padding: 14px 0 0;
    border-top: none;
    border-right: 1px solid var(--line);
  }
  .tabbar button { flex: none; width: 100%; min-height: 62px; }
  .tabbar button.active::before {
    top: 20%;
    bottom: 20%;
    left: -1px;
    right: auto;
    width: 1px;
    height: auto;
  }

  .view-scroll,
  .chat-scroll { padding-left: max(24px, calc(50% - 380px)); padding-right: max(24px, calc(50% - 380px)); }
  .chat-head, .chat-input-row { padding-left: max(24px, calc(50% - 380px)); padding-right: max(24px, calc(50% - 380px)); }

  .tiles { grid-template-columns: repeat(4, 1fr); }
  #toast { bottom: 28px; }
}
