/* ==========================================================================
   JARVIS COMMAND CENTER V3 — design tokens
   Dark navy/graphite base, cyan/teal as the "Jarvis active" accent. Color
   semantics (see PROJECT_STATUS.md / nightshift redesign notes):
     CYAN  = Jarvis / active / online / interaction / links / focus / running
     GREEN = healthy / completed / optimal
     AMBER = degraded / waiting / warning
     RED   = error / failed / critical / "Philip must act now" (reserved,
             NOT the default "active" color anymore)
   Everything below (dashboard + login) reads from these custom properties -
   no hardcoded hex outside this block, so both pages share one design family.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* base surfaces: deep navy/graphite, not flat black */
  --bg: #060a10;
  --bg-elevated: #0c141d;
  --bg-card: rgba(14, 24, 35, 0.72);
  --bg-card-hover: rgba(18, 30, 43, 0.82);
  --bg-glass: rgba(11, 19, 28, 0.55);

  --border: rgba(112, 188, 210, 0.16);
  --border-soft: rgba(112, 188, 210, 0.1);
  --border-strong: rgba(112, 188, 210, 0.32);

  --text: #eaf3f6;
  --text-dim: #93aebd;
  --text-faint: #55707e;

  /* Jarvis / active — primary interactive accent (was red in V2) */
  --cyan: #38d6e6;
  --cyan-2: #8be9f2;
  --cyan-dim: rgba(56, 214, 230, 0.14);
  --cyan-glow: rgba(56, 214, 230, 0.35);

  /* legacy names kept so existing rules below don't need to be hunted down
     one by one — they now point at cyan, i.e. "primary interactive", not red */
  --accent: var(--cyan);
  --accent-2: var(--cyan-2);
  --accent-dim: var(--cyan-dim);
  --accent-glow: var(--cyan-glow);

  /* connect-it red — kept only as a genuine alert/urgent color now, no
     longer the default "everything active" tint */
  --urgent: #e2564a;
  --urgent-2: #f18077;
  --urgent-dim: rgba(226, 86, 74, 0.14);
  --urgent-glow: rgba(226, 86, 74, 0.3);

  --green: #4fd18a;
  --amber: #e0b256;
  --red: #e2564a;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(0,0,0,.35), 0 12px 30px -14px rgba(0,0,0,.55);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --sidebar-w: 232px;
  --voice-bar-h: 64px;
  --bottom-nav-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-top: var(--safe-top);
  padding-bottom: calc(64px + var(--voice-bar-h) + var(--safe-bottom));
  min-height: 100vh;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(56,214,230,.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

a { color: var(--cyan-2); }

/* faint HUD grid texture behind everything, very subtle */
main::before { content: none; }

/* ---------- Sidebar (Desktop) / Bottom Nav (Mobile) ---------- */

.sidebar-brand { display: none; }

.bottom-nav, .sidebar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  height: var(--bottom-nav-h);
  display: flex; background: rgba(9,15,22,.94); backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 0 8px; color: var(--text-faint); font-size: .68rem; background: none; border: none;
  cursor: pointer; transition: color .15s ease;
}
.nav-item:hover { color: var(--text-dim); }
.nav-item.active { color: var(--cyan); }
.nav-item svg { width: 22px; height: 22px; }

.voice-status-mini { display: none; }

/* ---------- Header ---------- */

.app-header {
  position: sticky; top: 0; z-index: 10;
  padding: 22px 20px 14px;
  background: linear-gradient(to bottom, var(--bg) 75%, transparent);
}

.app-header h1 { font-size: 1.6rem; margin: 2px 0 3px; letter-spacing: -0.02em; font-weight: 600; color: var(--text); }
.app-header .meta { color: var(--text-faint); font-size: .85rem; display: flex; gap: 10px; align-items: center; }

.os-brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.os-status { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: .8rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 0 3px rgba(79,209,138,.14); }
.status-dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(224,178,86,.14); }
.status-dot.bad { background: var(--urgent); box-shadow: 0 0 0 3px rgba(226,86,74,.14); }

.header-clock {
  margin-left: auto; margin-right: 8px; font-variant-numeric: tabular-nums;
  color: var(--cyan-2); font-size: .82rem; letter-spacing: .04em; display: none;
}

.bell {
  position: relative; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); cursor: pointer; transition: color .15s ease, border-color .15s ease;
}
.bell:hover { color: var(--text); border-color: var(--border-strong); }
.bell svg { width: 18px; height: 18px; }
.bell-badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; border-radius: 999px;
  background: var(--urgent); color: #fff; font-size: .65rem; font-weight: 700; line-height: 17px; text-align: center;
  padding: 0 4px; box-shadow: 0 0 0 2px var(--bg);
}

/* ---------- Layout / Fluid Grid ----------
   Genuinely fluid: minmax()-based auto-fit columns instead of a fixed-width
   centered column, so wide/ultrawide viewports actually gain more/larger
   panels. Content is capped at a generous max-width (not "kilometer-long"
   lines) but that cap is far beyond the old 1400-1560px fixed column. */

.app-shell { max-width: 3200px; margin: 0 auto; }

main { padding: 0 20px 24px; max-width: 3200px; margin: 0 auto; }

.section { display: none; animation: fade .18s ease; }
.section.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.grid:last-child { margin-bottom: 0; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
  position: relative;
  overflow: hidden;
}

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.card h2 {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim); margin: 0 0 14px; font-weight: 700;
}

.chip-btn {
  background: var(--cyan-dim); color: var(--cyan-2); border: none; border-radius: 999px;
  padding: 5px 12px; font-size: .76rem; font-weight: 600; cursor: pointer; transition: opacity .15s ease;
}
.chip-btn:hover { opacity: .82; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.row:last-child { border-bottom: none; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 600; background: var(--cyan-dim); color: var(--cyan-2); white-space: nowrap;
}
.pill.green { background: rgba(79, 209, 138, .14); color: var(--green); }
.pill.amber { background: rgba(224, 178, 86, .14); color: var(--amber); }
.pill.red { background: rgba(226, 86, 74, .14); color: var(--urgent); }
.pill.dim { background: rgba(255,255,255,.05); color: var(--text-faint); }

.empty { color: var(--text-faint); font-size: .9rem; padding: 14px 0; text-align: center; }
.empty.friendly { color: var(--text-dim); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 14px; }
.stat .n { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.stat .l { font-size: .75rem; color: var(--text-dim); margin-top: 2px; }

/* ---------- Aktuelle Arbeit ---------- */

.work-current {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 16px;
}
.work-current .work-project { font-size: .78rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.work-current .work-goal { font-size: 1.02rem; font-weight: 500; line-height: 1.4; }
.work-current .work-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: .8rem; color: var(--text-faint); }

/* ---------- Projekte ---------- */

.project-card { display: flex; justify-content: space-between; align-items: center; gap: 14px; cursor: pointer; border-radius: var(--radius-sm); transition: background .15s ease; margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
.project-card:hover { background: var(--bg-card-hover); }
.project-card .name { font-weight: 600; }
.project-card .id { font-size: .78rem; color: var(--text-faint); margin-top: 1px; }
.project-card .badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.project-card .sub-stat { font-size: .74rem; color: var(--text-faint); }
.project-card .pc-chevron { color: var(--text-faint); flex: none; margin-left: 4px; }
.project-card:hover .pc-chevron { color: var(--cyan); }

/* ---------- Project Workspace ---------- */

.pw-back {
  background: none; border: none; color: var(--text-dim); font-size: .85rem; cursor: pointer;
  padding: 0 0 14px; display: block;
}
.pw-back:hover { color: var(--text); }
.pw-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.pw-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.pw-sub { font-size: .85rem; color: var(--text-dim); margin-top: 2px; }
.pw-summary { font-size: .82rem; color: var(--text-faint); margin-bottom: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.pw-panel { display: none; }
.pw-panel.active { display: block; }
.pw-chat-log { min-height: 160px; max-height: 340px; overflow-y: auto; font-size: .88rem; color: var(--text-dim); }
.pw-chat-input-row { display: flex; gap: 8px; margin-top: 10px; }
.pw-chat-input-row input {
  flex: 1; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text); font-family: inherit;
}
.pw-chat-input-row input:disabled { opacity: .5; cursor: not-allowed; }
.pw-chat-attach[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Todos ---------- */

.todo-item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.todo-item:last-child { border-bottom: none; }
.todo-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); flex: none;
  cursor: pointer; margin-top: 1px; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, border-color .15s ease;
}
.todo-check:hover { border-color: var(--cyan); }
.todo-check.done { background: var(--green); border-color: var(--green); }
.todo-body { flex: 1; min-width: 0; }
.todo-title { font-size: .95rem; }
.todo-title.done { color: var(--text-faint); text-decoration: line-through; }
.todo-sub { font-size: .78rem; color: var(--text-faint); margin-top: 2px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; }
.tab {
  padding: 7px 14px; border-radius: 999px; font-size: .82rem; white-space: nowrap;
  background: var(--bg-elevated); color: var(--text-dim); cursor: pointer; border: 1px solid transparent;
  transition: background .15s ease, color .15s ease;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--cyan-dim); color: var(--cyan-2); border-color: rgba(56,214,230,.35); }

.fab {
  position: fixed; right: 20px; bottom: calc(80px + var(--voice-bar-h) + var(--safe-bottom)); z-index: 20;
  width: 52px; height: 52px; border-radius: 50%; background: var(--cyan); border: none;
  color: #04141a; font-size: 1.6rem; font-weight: 600; box-shadow: 0 8px 24px rgba(56,214,230,.35); cursor: pointer;
  transition: transform .12s ease;
}
.fab:hover { transform: scale(1.05); }

/* ---------- Activity ---------- */

.activity-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); font-size: .87rem; align-items: flex-start; }
.activity-item:last-child { border-bottom: none; }
.activity-item.clickable { cursor: pointer; }
.activity-item.clickable:hover { background: rgba(56,214,230,.04); }
.activity-icon { flex: none; width: 18px; text-align: center; color: var(--text-faint); }
.activity-icon.ok { color: var(--green); }
.activity-icon.run { color: var(--cyan); }
.activity-icon.wait { color: var(--amber); }
.activity-icon.alert { color: var(--urgent); }
.activity-time { color: var(--text-faint); font-size: .72rem; white-space: nowrap; margin-left: auto; padding-left: 10px; }

/* ---------- Buttons ---------- */

button.primary {
  background: var(--cyan); color: #04141a; border: none; border-radius: var(--radius-sm);
  padding: 11px 16px; font-weight: 700; cursor: pointer; width: 100%; font-size: .95rem;
  transition: filter .15s ease;
}
button.primary:hover { filter: brightness(1.08); }
button.primary:active { filter: brightness(.96); }
button.ghost {
  background: transparent; color: var(--text-dim); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer; font-size: .85rem;
  transition: color .15s ease, border-color .15s ease;
}
button.ghost:hover { color: var(--text); border-color: var(--border-strong); }

/* ---------- Form controls ---------- */

#job-compose-form textarea,
#job-compose-form select,
#job-compose-form input,
.modal input, .modal textarea, .modal select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text); margin-bottom: 10px; font-size: .95rem; font-family: inherit;
  transition: border-color .15s ease;
}
#job-compose-form textarea { resize: vertical; }
#job-compose-form select:focus, #job-compose-form input:focus, #job-compose-form textarea:focus,
.modal input:focus, .modal textarea:focus, .modal select:focus { border-color: var(--cyan); outline: none; }

.modal-body-text { font-size: .88rem; color: var(--text-dim); margin-bottom: 14px; white-space: pre-wrap; line-height: 1.5; }

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(2,6,10,.65); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #0d1620; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0;
  padding: 20px; padding-bottom: calc(20px + var(--safe-bottom));
  box-shadow: 0 -12px 40px rgba(0,0,0,.5);
  border: 1px solid var(--border); border-bottom: none;
}
.modal h3 { margin: 0 0 16px; }
.modal .actions { display: flex; gap: 10px; margin-top: 8px; }
.modal .actions button { flex: 1; }

.modal--notif {
  display: flex; flex-direction: column;
  max-height: min(80vh, 80dvh);
}
.modal--notif h3,
.modal--notif .actions,
.modal--notif #notif-push-row { flex: 0 0 auto; }
.notif-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.modal--job {
  display: flex; flex-direction: column;
  max-height: min(85vh, 85dvh);
}
.modal--job h3,
.modal--job .actions,
.modal--job #job-modal-answer { flex: 0 0 auto; }
.modal--job #job-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ---------- Card HUD accent line ---------- */

.card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent 65%);
  opacity: .3; pointer-events: none;
}

.sync-time { color: var(--text-faint); font-size: .74rem; }

/* ---------- "Philip braucht dich" ----------
   Neutral/cyan by default (nothing waiting = good, not an alert). Only gets
   the red/urgent treatment via .card--urgent, toggled in app.js exactly when
   something real is actually waiting on Philip. */

.core-panel--attention {
  border-color: var(--border);
}
.core-panel--attention::before { background: linear-gradient(90deg, var(--cyan), transparent 65%); }
.core-panel--attention.card--urgent {
  border-color: rgba(226, 86, 74, .4);
  background: linear-gradient(180deg, rgba(226, 86, 74, .08), var(--bg-card) 45%);
}
.core-panel--attention.card--urgent h2 { color: var(--urgent-2); }
.core-panel--attention.card--urgent::before { background: linear-gradient(90deg, var(--urgent), transparent 65%); opacity: .7; }

.attention-item { padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.attention-item:last-child { border-bottom: none; }
.attention-item .a-title { font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.attention-item .a-meta { font-size: .8rem; color: var(--text-dim); }

.empty-good { text-align: center; padding: 16px 0; color: var(--green); font-size: .88rem; }

/* ---------- Mission Control ---------- */

.mission-card {
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 14px; margin-bottom: 10px; background: var(--bg-elevated); cursor: default;
}
.mission-card:last-child { margin-bottom: 0; }
.mission-card .m-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.mission-card .m-obj { font-weight: 600; font-size: .92rem; line-height: 1.35; min-width: 0; overflow-wrap: break-word; }
.mission-card .m-head .pill { flex: none; }
.mission-card .m-meta { font-size: .78rem; color: var(--text-faint); display: flex; gap: 10px; flex-wrap: wrap; }
.mission-card .m-checkpoint { font-size: .8rem; color: var(--text-dim); margin-top: 6px; line-height: 1.4; overflow-wrap: break-word; }

/* ==========================================================================
   Jarvis Core visual — own lightweight SVG/CSS centerpiece (not a clone of
   any reference image). Concentric rings, a pulsing halo, a few network
   dots. Status word is driven 1:1 by the real ONLINE/DEGRADED/ATTENTION
   value computed in app.js — never a fabricated metric.
   ========================================================================== */

.core-panel--jarvis {
  display: flex; align-items: center; justify-content: center;
  min-height: 260px; padding: 10px;
}
.core-panel--jarvis::before { display: none; }

.jarvis-core { position: relative; width: 220px; height: 220px; display: flex; align-items: center; justify-content: center; }

.jarvis-core-glow {
  position: absolute; inset: 10%; border-radius: 50%;
  background: radial-gradient(circle, var(--cyan-glow) 0%, transparent 70%);
  filter: blur(2px);
  animation: core-pulse 4s ease-in-out infinite;
}
.jarvis-core.state-warn .jarvis-core-glow { background: radial-gradient(circle, rgba(224,178,86,.35) 0%, transparent 70%); }
.jarvis-core.state-bad .jarvis-core-glow { background: radial-gradient(circle, rgba(226,86,74,.4) 0%, transparent 70%); }

@keyframes core-pulse {
  0%, 100% { opacity: .55; transform: scale(.96); }
  50% { opacity: 1; transform: scale(1.04); }
}

.jarvis-core-rings { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.jarvis-core-rings .ring {
  fill: none; stroke: var(--cyan); stroke-width: 1;
  transform-origin: 120px 120px;
}
.ring-1 { opacity: .5; stroke-dasharray: 4 10; animation: spin 60s linear infinite; }
.ring-2 { opacity: .35; stroke-dasharray: 2 6; animation: spin-rev 46s linear infinite; }
.ring-3 { opacity: .8; animation: spin 30s linear infinite; }
.core-dots .dot { fill: var(--cyan-2); opacity: .8; }
.jarvis-core.state-warn .jarvis-core-rings .ring, .jarvis-core.state-warn .core-dots .dot { stroke: var(--amber); fill: var(--amber); }
.jarvis-core.state-bad .jarvis-core-rings .ring, .jarvis-core.state-bad .core-dots .dot { stroke: var(--urgent); fill: var(--urgent); }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes spin-rev { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }

.jarvis-core-label {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center;
}
.jcl-name { font-size: 1.5rem; font-weight: 800; letter-spacing: .16em; color: var(--text); text-shadow: 0 0 18px var(--cyan-glow); }
.jcl-sub { font-size: .62rem; letter-spacing: .18em; color: var(--text-faint); text-transform: uppercase; }
.jcl-status { margin-top: 6px; font-size: .72rem; letter-spacing: .08em; color: var(--cyan-2); text-transform: uppercase; font-weight: 700; }
.jarvis-core.state-warn .jcl-status { color: var(--amber); }
.jarvis-core.state-bad .jcl-status { color: var(--urgent-2); }

/* ---------- System Overview panel ---------- */

.overview-list { display: flex; flex-direction: column; gap: 2px; }
.overview-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: .85rem;
}
.overview-row:last-child { border-bottom: none; }
.overview-row .ov-label { color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.overview-row .ov-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.overview-row .ov-dot.warn { background: var(--amber); }
.overview-row .ov-dot.bad { background: var(--urgent); }
.overview-row .ov-dot.unknown { background: var(--text-faint); }
.overview-row .ov-value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Quick Commands ---------- */

.quick-commands { display: flex; flex-direction: column; gap: 8px; }
.qc-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--bg-elevated); border: 1px solid var(--border-soft); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 12px; font-size: .87rem; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.qc-btn:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }
.qc-icon { color: var(--cyan); font-size: 1rem; width: 18px; text-align: center; flex: none; }

/* ==========================================================================
   Voice Bar — bottom HUD pill in the spirit of the "TALK TO JARVIS" bar from
   the reference design, but with an honest current status (voice/mic is not
   live yet per PROJECT_STATUS.md — macOS 26 required, macOS app missing).
   Never claims "Listening...".
   ========================================================================== */

.voice-bar {
  /* Mobile: bottom-nav already occupies bottom:0 (fixed, --bottom-nav-h tall)
     - stack the voice bar directly above it, don't overlap/hide behind it. */
  position: fixed; left: 0; right: 0; bottom: var(--bottom-nav-h); z-index: 25;
  height: var(--voice-bar-h);
  display: flex; align-items: center; justify-content: center; gap: 16px;
  background: rgba(8, 14, 20, .92); backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-family: inherit;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.voice-bar-text { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.vb-sub { font-size: .68rem; color: var(--text-faint); letter-spacing: .02em; }

.voice-bar-wave { display: flex; align-items: center; gap: 3px; height: 22px; }
.voice-bar-wave span {
  display: block; width: 3px; border-radius: 2px; background: var(--text-faint); opacity: .55;
  animation: voice-wave 1.6s ease-in-out infinite;
}
.voice-bar-wave span:nth-child(1) { height: 6px; animation-delay: -1.4s; }
.voice-bar-wave span:nth-child(2) { height: 12px; animation-delay: -1.2s; }
.voice-bar-wave span:nth-child(3) { height: 18px; animation-delay: -1.0s; }
.voice-bar-wave span:nth-child(4) { height: 9px; animation-delay: -.8s; }
.voice-bar-wave span:nth-child(5) { height: 16px; animation-delay: -.6s; }
.voice-bar-wave span:nth-child(6) { height: 9px; animation-delay: -.4s; }
.voice-bar-wave span:nth-child(7) { height: 18px; animation-delay: -.2s; }
.voice-bar-wave span:nth-child(8) { height: 12px; animation-delay: 0s; }
.voice-bar-wave span:nth-child(9) { height: 6px; animation-delay: .2s; }
@keyframes voice-wave { 0%, 100% { transform: scaleY(.4); opacity: .35; } 50% { transform: scaleY(1); opacity: .85; } }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .section { animation: none; }
  .fab, button.primary, .chip-btn { transition: none; }
  .jarvis-core-glow, .ring-1, .ring-2, .ring-3 { animation: none; }
  .voice-bar-wave span { animation: none; opacity: .6; transform: scaleY(.7); }
}

/* ==========================================================================
   Mobile priority order (per spec): System Status (top bar, always first),
   Philip braucht dich, Current Mission, Current Job, Quick Action/Talk,
   Activity, System details. Applied via CSS `order` (not inline styles) so
   it can be overridden per breakpoint below.
   ========================================================================== */

/* Desktop/tablet: no forced `order` - natural DOM order already matches the
   intended reading order (System Overview / Jarvis Core / Philip braucht
   dich, then Mission Control, Execution, Quick Commands, ...). Mobile gets
   its own explicit priority order below. */

/* ---------- Desktop ---------- */

@media (min-width: 768px) {
  body { padding-bottom: 0; display: flex; }

  .sidebar, .bottom-nav {
    position: sticky; top: 0; left: 0; bottom: auto; height: 100vh; width: var(--sidebar-w);
    flex-direction: column; justify-content: flex-start; padding: 20px 12px; gap: 2px;
    border-top: none; border-right: 1px solid var(--border); flex: none;
    background: rgba(7,12,18,.7);
  }
  .sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 20px; }
  .brand-mark { width: 26px; height: 26px; color: var(--cyan); flex: none; filter: drop-shadow(0 0 6px var(--cyan-glow)); }
  .brand-mark svg { width: 100%; height: 100%; }
  .brand-text { display: flex; flex-direction: column; line-height: 1.1; }
  .brand-name { font-size: 1.05rem; font-weight: 800; letter-spacing: .12em; color: var(--text); }
  .brand-sub { font-size: .6rem; font-weight: 600; letter-spacing: .16em; color: var(--text-faint); }

  .nav-item { flex-direction: row; justify-content: flex-start; gap: 11px; padding: 10px 12px; border-radius: 10px; font-size: .88rem; }
  .nav-item:hover { background: var(--bg-elevated); }
  .nav-item.active { background: var(--cyan-dim); color: var(--cyan-2); box-shadow: inset 2px 0 0 var(--cyan); }

  .voice-status-mini {
    display: block; margin-top: auto; padding: 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft); background: var(--bg-elevated);
  }
  .vsm-state { display: block; margin-top: 8px; font-size: .68rem; color: var(--text-faint); letter-spacing: .02em; text-align: center; }
  .vsm-wave { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
  .vsm-wave span { flex: 1; background: var(--border-strong); border-radius: 1px; height: 30%; }

  .app-shell { flex: 1; min-width: 0; }
  main { padding: 8px 32px 40px; }
  .app-header { padding: 26px 32px 6px; background: var(--bg); }
  .app-header h1 { font-size: 1.85rem; }
  .header-clock { display: inline-block; }

  .grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
  .span-2 { grid-column: span 2; }
  .span-3 { grid-column: span 3; }

  .grid--core-row { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

  .fab { right: 40px; bottom: calc(40px + var(--voice-bar-h)); }
  .voice-bar { left: var(--sidebar-w); bottom: 0; height: calc(var(--voice-bar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom); }
}

@media (min-width: 1000px) {
  .grid--core-row { grid-template-columns: 1fr 1.15fr 1fr; }
}

@media (min-width: 1280px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .span-2 { grid-column: span 2; }
  .span-3 { grid-column: span 3; }
  #command-card { grid-column: span 3; }
}

@media (min-width: 1760px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .span-2 { grid-column: span 2; }
  .span-3 { grid-column: span 3; }
  #command-card { grid-column: span 2; }
}

@media (min-width: 2200px) {
  .grid { grid-template-columns: repeat(5, 1fr); }
  #command-card { grid-column: span 2; }
}

/* ---------- Mobile (~390px): explicit priority order ----------
   Spec priority: 1) System Status (top bar, outside the grid) 2) Philip
   braucht dich 3) Current Mission 4) Current Job 5) Quick Action/Talk to
   Jarvis (voice bar is fixed/always visible) 6) Activity 7) System details.
   Own mobile layout, not a shrunk desktop grid. */

@media (max-width: 767px) {
  #home-waiting-card { order: 1; }
  #home-overview-card { order: 2; }
  #jarvis-core-card { order: 3; }

  #home-missions-card { order: 1; }
  #home-current-job-card { order: 2; }
  #quick-commands-card { order: 3; }
  #home-next-card { order: 4; }
  #command-card { order: 5; }
  #home-today-card { order: 6; }
  #home-projects-card { order: 7; }
  #home-activity-card { order: 8; }
  #home-systems-card { order: 9; }

  .core-panel--jarvis { min-height: 200px; }
  .jarvis-core { width: 170px; height: 170px; }
}
