/* ============================================================
   JARVIS LIFE OS — HUD design system
   Teal / emerald on near-black. Full Iron-Man HUD.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;600;700;800&family=Chakra+Petch:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;600&display=swap');

:root {
  /* base — deep blue-black */
  --bg-0: #020810;
  --bg-1: #030d1c;
  --bg-2: #041428;
  --panel: rgba(8, 24, 52, 0.46);
  --panel-solid: #050f20;
  --panel-hi: rgba(16, 44, 88, 0.55);

  /* lines / borders */
  --line: rgba(0, 200, 255, 0.16);
  --line-2: rgba(0, 200, 255, 0.32);
  --line-soft: rgba(0, 200, 255, 0.08);

  /* accents — electric cyan-blue */
  --teal: #00c8ff;
  --teal-bright: #5ee7ff;
  --emerald: #00a8e8;
  --emerald-deep: #0077cc;
  --cyan: #33b5ff;
  --amber: #fbbf24;
  --rose: #fb7185;
  --violet: #818cf8;

  /* text */
  --tx: #c8f0ff;
  --tx-2: #7ab8d8;
  --tx-3: #3a6888;
  --tx-dim: #2a4a60;

  /* glow */
  --glow-teal: 0 0 18px rgba(0, 200, 255, 0.35);
  --glow-soft: 0 0 30px rgba(0, 200, 255, 0.10);

  /* type */
  --f-display: 'Orbitron', sans-serif;
  --f-ui: 'Chakra Petch', sans-serif;
  --f-mono: 'JetBrains Mono', monospace;

  --r: 4px;
  --sidebar-w: 248px;
  --topbar-h: 70px;
  --statusbar-h: 34px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--tx);
  font-family: var(--f-ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#root { height: 100vh; }

::selection { background: rgba(0, 200, 255, 0.3); color: #fff; }

/* Scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 200, 255, 0.22);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 200, 255, 0.4); background-clip: padding-box; }

/* ============================================================
   APP BACKDROP — layered grid, vignette, scanlines
   ============================================================ */
.app {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr var(--statusbar-h);
  grid-template-areas:
    "side top"
    "side main"
    "side status";
  height: 100vh;
  background:
    radial-gradient(1200px 700px at 72% -8%, rgba(0, 90, 150, 0.42), transparent 60%),
    radial-gradient(900px 600px at -5% 110%, rgba(0, 70, 130, 0.26), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  isolation: isolate;
}
.app::before {
  /* fine grid */
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0, 200, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 200, 255, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(120% 120% at 50% 30%, #000 40%, transparent 90%);
  pointer-events: none;
  z-index: -1;
}
.app::after {
  /* scanlines */
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, rgba(0,0,0,0) 0 3px, rgba(2,10,22,0.22) 3px 4px);
  pointer-events: none;
  opacity: 0.6;
  z-index: 50;
}

/* ============================================================
   PANEL / HUD FRAME
   ============================================================ */
.panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(10, 32, 60, 0.92), rgba(5, 18, 38, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 13px; height: 13px;
  pointer-events: none;
  opacity: 0.85;
}
.panel::before {
  top: -1px; left: -1px;
  border-top: 2px solid var(--teal);
  border-left: 2px solid var(--teal);
}
.panel::after {
  bottom: -1px; right: -1px;
  border-bottom: 2px solid var(--teal);
  border-right: 2px solid var(--teal);
}
.panel.flat::before, .panel.flat::after { display: none; }

.panel-pad { padding: 18px 20px; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-title {
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--tx);
  display: flex; align-items: center; gap: 9px;
}
.panel-title .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--teal); box-shadow: var(--glow-teal);
  animation: pulse 2.4s ease-in-out infinite;
}
.panel-link {
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--tx-3); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
  transition: color .15s;
}
.panel-link:hover { color: var(--teal-bright); }

/* corner-cut variant */
.cut {
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

/* ============================================================
   LABELS / TYPE HELPERS
   ============================================================ */
.eyebrow {
  font-family: var(--f-mono);
  font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--tx-3);
}
.mono { font-family: var(--f-mono); }
.display { font-family: var(--f-display); }
.metric {
  font-family: var(--f-display);
  font-weight: 700;
  line-height: 0.95;
  color: var(--tx);
}
.tx2 { color: var(--tx-2); }
.tx3 { color: var(--tx-3); }
.teal { color: var(--teal); }
.emerald { color: var(--emerald); }
.amber { color: var(--amber); }
.rose { color: var(--rose); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.side {
  grid-area: side;
  position: relative;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(5,20,40,0.7), rgba(2,11,24,0.7));
  display: flex; flex-direction: column;
  min-height: 0;
  z-index: 10;
}
.brand {
  display: flex; align-items: center; gap: 13px;
  padding: 16px 18px 16px;
  border-bottom: 1px solid var(--line);
  height: var(--topbar-h);
}
.brand .reactor { width: 40px; height: 40px; flex: 0 0 40px; }
.brand-name {
  font-family: var(--f-display);
  font-weight: 800; font-size: 21px; letter-spacing: 0.14em;
  color: var(--tx);
  text-shadow: 0 0 16px rgba(0,200,255,0.45);
  line-height: 1;
}
.brand-sub {
  font-family: var(--f-mono);
  font-size: 8.5px; letter-spacing: 0.34em; color: var(--tx-3);
  margin-top: 4px;
}
.nav { flex: 1 1 auto; overflow-y: auto; padding: 12px 12px; min-height: 0; }
.nav-group-label {
  font-family: var(--f-mono);
  font-size: 9.5px; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--tx-dim); padding: 14px 10px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  color: var(--tx-2);
  font-size: 14.5px; font-weight: 500; letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; stroke-width: 1.7; }
.nav-item:hover { background: rgba(0,200,255,0.07); color: var(--tx); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* drag-to-reorder */
.nav-item.draggable { transition: background .15s, color .15s, padding .15s, opacity .15s; }
.nav-item.draggable:hover { padding-right: 30px; }
.nav-grip {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; opacity: 0; pointer-events: none;
  color: var(--tx-dim); transition: opacity .15s;
}
.nav-grip svg { width: 14px !important; height: 14px !important; flex: 0 0 14px !important; stroke-width: 2.4 !important; }
.nav-item.draggable:hover .nav-grip { opacity: 0.55; }
.nav-item.dragging { opacity: 0.4; background: rgba(0,200,255,0.12); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(0,200,255,0.18), rgba(0,200,255,0.02));
  color: #e0f8ff;
}
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 3px;
  background: var(--teal); box-shadow: var(--glow-teal);
}
.nav-item .badge {
  margin-left: auto;
  font-family: var(--f-mono); font-size: 11px;
  background: rgba(0,200,255,0.14); color: var(--teal-bright);
  padding: 1px 7px; border-radius: 9px;
}
.side-foot { border-top: 1px solid var(--line); padding: 14px; position: relative; }
.profile-row {
  display: flex; align-items: center; gap: 11px;
  padding: 8px; margin: -8px; border-radius: 9px;
  cursor: pointer; transition: background .15s;
}
.profile-row:hover { background: rgba(0,200,255,0.08); }
.profile-pop {
  position: absolute; left: 14px; right: 14px; bottom: calc(100% - 6px);
  background: #051527; border: 1px solid var(--line); border-radius: 13px;
  box-shadow: 0 20px 54px rgba(0,0,0,0.62), 0 0 0 1px rgba(0,200,255,0.05);
  padding: 14px; z-index: 70; animation: profile-pop-in .15s ease;
}
@keyframes profile-pop-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.profile-pop-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--tx-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: background .12s, color .12s;
}
.profile-pop-item svg { width: 16px; height: 16px; flex: 0 0 16px; stroke-width: 1.8; }
.profile-pop-item:hover { background: rgba(0,200,255,0.09); color: var(--tx); }
.profile-pop-item.danger { color: var(--rose); }
.profile-pop-item.danger:hover { background: rgba(251,113,133,0.10); color: var(--rose); }

/* ============================================================
   TOP COMMAND BAR
   ============================================================ */
.top {
  grid-area: top;
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(6,24,46,0.6), rgba(3,14,28,0.3));
  z-index: 9;
}
.cmd {
  flex: 1 1 auto;
  display: flex; align-items: center; gap: 11px;
  height: 42px; padding: 0 14px;
  background: rgba(2,8,18,0.6);
  border: 1px solid var(--line);
  border-radius: var(--r);
  max-width: 620px;
  transition: border-color .15s, box-shadow .15s;
}
.cmd:focus-within { border-color: var(--line-2); box-shadow: 0 0 0 3px rgba(0,200,255,0.08); }
.cmd svg { width: 17px; height: 17px; color: var(--tx-3); }
.cmd input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--tx); font-family: var(--f-ui); font-size: 14.5px;
}
.cmd input::placeholder { color: var(--tx-dim); }
.kbd {
  font-family: var(--f-mono); font-size: 10.5px; color: var(--tx-3);
  border: 1px solid var(--line); border-radius: 3px; padding: 2px 6px;
}
.top-status {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.06em;
  color: var(--emerald);
}
.top-status .live {
  width: 7px; height: 7px; border-radius: 50%; background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald); animation: pulse 1.8s infinite;
}
.top-clock { font-family: var(--f-mono); font-size: 15px; color: var(--tx); letter-spacing: 0.05em; }
.top-icons { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r);
  background: rgba(2,8,18,0.4); color: var(--tx-2); cursor: pointer;
  transition: all .15s;
}
.icon-btn:hover { color: var(--teal-bright); border-color: var(--line-2); background: rgba(0,200,255,0.08); }
.icon-btn svg { width: 17px; height: 17px; }

/* ============================================================
   MAIN
   ============================================================ */
.main {
  grid-area: main;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 26px 40px;
  min-height: 0;
}
.view-head { margin-bottom: 20px; }
.view-title {
  font-family: var(--f-display); font-weight: 700;
  font-size: 30px; letter-spacing: 0.06em; color: #e0f8ff;
  text-shadow: 0 0 24px rgba(0,200,255,0.3);
}
.view-sub { color: var(--tx-3); font-size: 14px; margin-top: 6px; font-family: var(--f-mono); letter-spacing: 0.04em; }

.grid { display: grid; gap: 18px; }
.g-12 { grid-template-columns: repeat(12, 1fr); }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; }
.span-12 { grid-column: span 12; }

/* ============================================================
   STATUS BAR
   ============================================================ */
.status {
  grid-area: status;
  display: flex; align-items: center; gap: 22px;
  padding: 0 20px;
  border-top: 1px solid var(--line);
  background: rgba(2,8,18,0.7);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--tx-3);
  z-index: 9;
  overflow: hidden;
}
.status .s-item { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.status .s-dot { width: 6px; height: 6px; border-radius: 50%; }
.status .ok { background: var(--emerald); box-shadow: 0 0 7px var(--emerald); }
.status .warn { background: var(--amber); box-shadow: 0 0 7px var(--amber); }
.status .idle { background: var(--tx-dim); }
.status .right { margin-left: auto; display: flex; gap: 22px; }

/* ============================================================
   BUTTONS / CHIPS / INPUTS
   ============================================================ */
.btn {
  font-family: var(--f-ui); font-weight: 600; font-size: 13.5px;
  letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: rgba(0,200,255,0.08); color: var(--teal-bright);
  cursor: pointer; transition: all .15s;
}
.btn:hover { background: rgba(0,200,255,0.16); border-color: var(--teal); box-shadow: var(--glow-soft); }
.btn svg { width: 16px; height: 16px; }
.btn.solid { background: var(--teal); color: #020e24; border-color: var(--teal); font-weight: 700; }
.btn.solid:hover { background: var(--teal-bright); box-shadow: 0 0 18px rgba(0,200,255,0.5); }
.btn.ghost { background: transparent; color: var(--tx-2); border-color: var(--line); }
.btn.ghost:hover { color: var(--teal-bright); }
.btn.sm { padding: 6px 11px; font-size: 12px; }

.input, .textarea, .select {
  width: 100%;
  background: rgba(2,8,18,0.55);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--tx); font-family: var(--f-ui); font-size: 14px;
  padding: 10px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--line-2); box-shadow: 0 0 0 3px rgba(0,200,255,0.08);
}
.input::placeholder, .textarea::placeholder { color: var(--tx-dim); }
.textarea { resize: vertical; min-height: 90px; font-family: var(--f-ui); line-height: 1.55; }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235a8a80' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
.chip {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.05em;
  padding: 3px 10px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--tx-2);
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.chip:hover { border-color: var(--line-2); color: var(--tx); }
.chip.on { background: rgba(0,200,255,0.16); border-color: var(--teal); color: var(--teal-bright); }

/* priority pill colors */
.pri { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }
.pri-high { background: var(--rose); box-shadow: 0 0 8px var(--rose); }
.pri-med { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.pri-low { background: var(--teal); box-shadow: 0 0 8px var(--teal); }

/* ============================================================
   CHECKBOX (HUD)
   ============================================================ */
.check {
  width: 20px; height: 20px; flex: 0 0 20px;
  border: 1.5px solid var(--line-2); border-radius: 3px;
  display: grid; place-items: center; cursor: pointer;
  transition: all .15s; color: transparent;
  background: rgba(2,8,18,0.4);
}
.check:hover { border-color: var(--teal); }
.check.done {
  background: var(--teal); border-color: var(--teal);
  color: #020e24; box-shadow: var(--glow-teal);
}
.check svg { width: 13px; height: 13px; stroke-width: 3; }

/* ============================================================
   GAUGES / RINGS / DECOR
   ============================================================ */
.ring-wrap { position: relative; display: inline-grid; place-items: center; }
.ring-wrap .ring-center {
  position: absolute; inset: 0; display: grid; place-items: center;
  text-align: center; pointer-events: none;
}
.orbit { animation: spin 18s linear infinite; transform-origin: center; }
svg.spin { animation: spin 0.9s linear infinite; transform-origin: center; }
.orbit-rev { animation: spin 26s linear infinite reverse; transform-origin: center; }
.sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(0,200,255,0.0) 270deg, rgba(0,200,255,0.45) 350deg, rgba(100,230,255,0.7) 360deg);
  animation: spin 4s linear infinite;
  mask: radial-gradient(circle, transparent 38%, #000 39%);
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 39%);
  pointer-events: none;
}

/* waveform */
.wave { display: flex; align-items: flex-end; gap: 2px; height: 44px; }
.wave i {
  flex: 1; min-width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, var(--teal-bright), var(--emerald-deep));
  animation: wave 1.3s ease-in-out infinite;
  opacity: 0.85;
}

/* stat tile */
.stat {
  display: flex; flex-direction: column; gap: 4px;
}
.stat .v { font-family: var(--f-display); font-weight: 700; font-size: 30px; color: var(--tx); line-height: 1; }
.stat .l { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--tx-3); }

/* list rows */
.row {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: none; }
.row .t { flex: 1; min-width: 0; }
.row .t .name { font-size: 14.5px; color: var(--tx); }
.row .t .name.done { color: var(--tx-dim); text-decoration: line-through; }
.row .t .meta { font-family: var(--f-mono); font-size: 11px; color: var(--tx-3); margin-top: 3px; }
.row .x { color: var(--tx-dim); cursor: pointer; opacity: 0; transition: all .15s; }
.row:hover .x { opacity: 1; }
.row .x:hover { color: var(--rose); }

/* module summary card on overview */
.modcard { cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.modcard:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--glow-soft); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes wave {
  0%,100% { height: 22%; }
  50% { height: 100%; }
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  94% { opacity: 0.4; }
  96% { opacity: 1; }
}
@keyframes fadeUp {
  from { transform: translateY(9px); }
  to { transform: translateY(0); }
}
/* transform-only intro — never gates visibility (paused iframes keep content visible) */
.fade-up { animation: fadeUp .4s ease; }

@media (prefers-reduced-motion: reduce) {
  .orbit, .orbit-rev, .sweep, .wave i, .panel-title .dot, .top-status .live { animation: none !important; }
}

/* helpers */
.flex { display: flex; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.wrap { flex-wrap: wrap; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.fill { flex: 1; }
.scrolly { overflow-y: auto; }
.nowrap { white-space: nowrap; }
.pointer { cursor: pointer; }
.rel { position: relative; }
.empty {
  text-align: center; color: var(--tx-dim); font-family: var(--f-mono);
  font-size: 12.5px; letter-spacing: 0.06em; padding: 30px 10px;
}

/* ============================================================
   RESPONSIVE — collapsible sidebar drawer + mobile layout
   ============================================================ */
/* hamburger lives in the top bar; hidden on desktop */
.nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 38px;
  margin-right: 4px;
  background: rgba(0,200,255,0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--tx); cursor: pointer;
}
.nav-toggle:hover { background: rgba(0,200,255,0.12); }
/* backdrop behind the open drawer; hidden until needed */
.nav-backdrop { display: none; }

@media (max-width: 880px) {
  /* single-column shell — sidebar comes out of the grid flow */
  .app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "main"
      "status";
  }

  /* sidebar becomes an off-canvas drawer */
  .side {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    max-width: 84vw;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .25s ease;
    /* opaque now that it floats over content */
    background: linear-gradient(180deg, #06182e, #02101f);
    box-shadow: 8px 0 40px rgba(0,0,0,0.5);
  }
  .app.nav-open .side { transform: translateX(0); }

  /* dim/clickable backdrop while the drawer is open */
  .app.nav-open .nav-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(2,8,18,0.6);
    backdrop-filter: blur(2px);
    z-index: 55;
  }

  /* show the hamburger */
  .nav-toggle { display: inline-flex; }

  /* trim the top bar so the search field has room */
  .top { padding: 0 12px; gap: 10px; }
  .top-status, .top-clock, .top-icons, .cmd .kbd { display: none; }
  .cmd { flex: 1; min-width: 0; }
  .cmd input { min-width: 0; }

  /* roomier touch targets, tighter page padding */
  .main { padding: 16px 14px 32px; }
  .view-title { font-size: 24px; }

  /* every multi-column grid stacks to one column on phones */
  .g-12 { grid-template-columns: 1fr; }
  .span-3, .span-4, .span-5, .span-6,
  .span-7, .span-8, .span-9, .span-12 { grid-column: 1 / -1; }

  /* status bar: keep it from overflowing */
  .status { gap: 12px; font-size: 10px; }
  .status .right { gap: 12px; }

  /* never allow sideways scroll on phones */
  html, body, .app, .main { overflow-x: hidden; max-width: 100vw; }
  .panel { max-width: 100%; overflow: hidden; }
  /* let flex/grid children actually shrink so ellipsis works + nothing pushes wide */
  .main * { min-width: 0; }

  /* hero: stack the text above the day-ring / year-dots instead of side-by-side */
  .hero-inner { flex-direction: column; align-items: stretch; gap: 18px; }
  .hero-aside { justify-content: center; gap: 36px; flex: 0 0 auto; }
  .display { font-size: 30px !important; }
}

/* ---- Vault: read-only markdown reader ---- */
.vault-md {
  max-height: calc(100vh - 320px); overflow-y: auto; padding: 2px 4px;
  color: var(--tx); font-size: 14.5px; line-height: 1.7;
}
.vault-md h1, .vault-md h2, .vault-md h3, .vault-md h4 {
  color: #e0f8ff; font-family: var(--f-display); margin: 18px 0 8px; line-height: 1.3;
}
.vault-md h1 { font-size: 24px; } .vault-md h2 { font-size: 20px; }
.vault-md h3 { font-size: 17px; } .vault-md h4 { font-size: 15px; }
.vault-md p { margin: 8px 0; color: var(--tx-2); }
.vault-md ul { margin: 8px 0; padding-left: 22px; color: var(--tx-2); }
.vault-md li { margin: 3px 0; }
.vault-md code {
  font-family: var(--f-mono); font-size: 12.5px; background: rgba(45,212,191,0.1);
  color: #5eead4; padding: 1px 5px; border-radius: 4px;
}
.vault-md pre {
  background: rgba(2,16,12,0.7); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; margin: 10px 0;
}
.vault-md pre code { background: none; color: var(--tx-2); padding: 0; }
.vault-md a { color: #38bdf8; text-decoration: none; }
.vault-md a:hover { text-decoration: underline; }
.vault-md a.vault-wiki {
  color: #5eead4; background: rgba(45,212,191,0.08);
  padding: 0 4px; border-radius: 4px; border-bottom: 1px solid rgba(94,234,212,0.3);
}
.vault-md a.vault-wiki:hover { background: rgba(45,212,191,0.18); text-decoration: none; }
