:root {
  color-scheme: light;
  --paper: #f3efe6;
  --card: #fffdf8;
  --ink: #1c1915;
  --muted: #6f675e;
  --line: #e3dcd0;
  --teal: #0e7c74;
  --teal-deep: #0b5f59;
  --teal-soft: #e6f3f1;
  --rust: #9f2d22;
  --rust-soft: #f8ebe8;
  --warn: #8a5a12;
  --warn-soft: #f8efd8;
  --blue: #2457a6;
  --blue-soft: #e7eef9;
  --green: #0f8a4a;
  --green-soft: #e4f4ea;
  --night-1: #042c2a;
  --night-2: #0a1628;
  --night-3: #0f2744;
  --mint: #5eead4;
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.05), 0 8px 24px rgba(28, 25, 21, 0.04);
  --gap: 16px;
  --section: 40px;
  --radius: 22px;
  font-family: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(14, 124, 116, 0.14), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(201, 133, 66, 0.12), transparent 60%),
    var(--paper);
  background-attachment: fixed;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
h1, h2, h3, p { margin: 0; }

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal-deep);
  font-weight: 700;
  margin-bottom: 14px;
}
.eyebrow span { color: var(--muted); letter-spacing: 0.08em; }

/* Login */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate { background: radial-gradient(800px 500px at 50% 0%, rgba(14, 124, 116, 0.18), transparent 60%); }
.gate-card {
  width: min(440px, 100%);
  background: var(--card);
  border-top: 5px solid var(--teal);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
  display: grid;
  gap: 18px;
  box-shadow: var(--shadow);
}
.gate-logo { display: grid; justify-items: center; padding: 8px 0 4px; }
.gate-logo .mark { width: 148px; height: 148px; filter: drop-shadow(0 16px 28px rgba(10, 22, 40, 0.28)); }
.gate-card label { justify-items: center; text-align: center; }
.gate-card input { width: 200px; text-align: center; }
.gate-card .primary { width: 200px; justify-self: center; }
.lede { color: var(--muted); line-height: 1.5; }

/* Form controls */
label { display: grid; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  color: var(--ink);
  font-weight: 500;
}
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14, 124, 116, 0.12); }
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
input[type="checkbox"] { width: 22px; height: 22px; padding: 0; margin: 0; accent-color: var(--teal); }
.editor { min-height: 260px; width: 100%; border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: white; resize: vertical; font-size: 18px; line-height: 1.5; }
label.row { grid-template-columns: auto 1fr; align-items: center; gap: 12px; font-size: 16px; font-weight: 600; color: var(--ink); padding: 6px 0; }

/* Buttons */
.primary, .ghost, .quiet, .danger {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 13px 22px;
  font-weight: 650;
  line-height: 1.2;
}
.primary { background: linear-gradient(180deg, #13928a, var(--teal-deep)); color: white; box-shadow: 0 6px 16px rgba(14, 124, 116, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.primary:hover { filter: brightness(1.06); }
.ghost { background: transparent; border-color: var(--line); }
.quiet { background: transparent; color: var(--muted); }
.quiet:hover { color: var(--ink); }
.danger { background: var(--rust-soft); color: var(--rust); }
.error { color: var(--rust); font-weight: 600; }
.wide {
  width: 100%;
  border-radius: 14px;
  padding: 15px 18px;
  font-weight: 650;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  line-height: 1.2;
}
.wide:hover { border-color: #cfc6b8; }
.wide.primary { background: linear-gradient(180deg, #13928a, var(--teal-deep)); color: white; border-color: transparent; box-shadow: 0 6px 16px rgba(14, 124, 116, 0.22); }
.wide.primary:hover { filter: brightness(1.06); }
.wide.danger { background: var(--rust-soft); color: var(--rust); border-color: transparent; }
.stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.choice-row, .phone-picks { display: flex; gap: 10px; flex-wrap: wrap; }
.choice { border: 1px solid var(--line); background: white; border-radius: 999px; padding: 12px 18px; font-weight: 650; }
.choice.on { background: var(--teal); color: white; border-color: var(--teal); }
.pill { border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 650; background: var(--teal-soft); color: var(--teal-deep); white-space: nowrap; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.off { background: #ece8e0; color: var(--muted); }

/* App shell */
#app { min-height: 100vh; }
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 28px 32px 12px;
  max-width: 1240px;
  margin: 0 auto;
}
.top .live { justify-self: end; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand .mark { display: block; filter: drop-shadow(0 6px 14px rgba(10, 22, 40, 0.28)); flex: none; }
.brand .wordmark { font-family: "Instrument Serif", Georgia, serif; font-size: 26px; letter-spacing: 0.01em; line-height: 1; }
nav { display: flex; gap: 2px; margin: 0 auto; background: #ebe6dc; padding: 3px; border-radius: 999px; }
.tab { background: transparent; border: 0; padding: 8px 18px; border-radius: 999px; color: var(--muted); font-weight: 650; font-size: 14px; }
.tab.active { background: var(--ink); color: white; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; color: var(--muted); }
.live em { font-style: normal; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: #c8c0b6; flex: none; position: relative; }
.live.on { color: var(--teal-deep); }
.live.on i { background: var(--teal); box-shadow: 0 0 0 0 rgba(14, 124, 116, 0.45); animation: beacon 1.8s ease-out infinite; }
@keyframes beacon { 0% { box-shadow: 0 0 0 0 rgba(14, 124, 116, 0.45); } 70% { box-shadow: 0 0 0 9px rgba(14, 124, 116, 0); } 100% { box-shadow: 0 0 0 0 rgba(14, 124, 116, 0); } }
.foot { max-width: 1240px; margin: 0 auto; padding: 0 32px 40px; display: flex; gap: 22px; justify-content: center; }
.foot button { background: transparent; border: 0; padding: 6px 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.foot button:hover { color: var(--ink); }
main { max-width: 1240px; margin: 0 auto; padding: 20px 32px 96px; display: grid; gap: 28px; align-content: start; }
main > * { min-width: 0; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.screen-title { font-family: "Instrument Serif", Georgia, serif; font-size: 52px; font-weight: 400; line-height: 1; }
.back { justify-self: start; margin-bottom: -8px; padding-left: 0; }
.shelf { display: grid; gap: 18px; }
.shelf-head { display: flex; align-items: baseline; gap: 12px; }
.shelf-head h2 { font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.shelf-head h2::before { content: ""; width: 18px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--teal), var(--mint)); }
.shelf-head span { color: var(--muted); font-size: 14px; }
.shelf-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.shelf-actions .danger, .shelf-actions .primary { padding: 10px 16px; }
.spark { margin-top: 12px; padding: 10px 12px 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(14, 124, 116, 0.16); }
.spark-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.spark-head span { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.spark-head strong { font-size: 18px; font-weight: 650; letter-spacing: -0.03em; color: var(--teal-deep); line-height: 1; }
.spark svg { display: block; width: 100%; height: 44px; }
.spark-area { fill: rgba(14, 124, 116, 0.16); }
.spark-line { fill: none; stroke: var(--teal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Hero */
.hero {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, var(--night-1), var(--night-2) 70%, var(--night-3));
  border: 1px solid rgba(94, 234, 212, 0.18);
  position: relative;
  overflow: hidden;
}
.hero-kicker { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; color: rgba(255, 255, 255, 0.72); }
.hero-kicker .dot { background: rgba(255, 255, 255, 0.4); }
.hero-kicker .dot.run { background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.hero-eta { font-family: "Instrument Serif", Georgia, serif; font-size: 28px; line-height: 1; letter-spacing: -0.02em; margin: 0; }
.hero-sub { color: rgba(255, 255, 255, 0.68); font-size: 14px; margin-left: auto; }

/* Pipeline */
.pipeline {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 30px 40px 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.station { display: grid; justify-items: center; gap: 6px; min-width: 150px; position: relative; }
.station .node {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 0 5px var(--tone-soft), 0 0 14px var(--tone-soft);
  margin-bottom: 6px;
}
.station strong { font-family: "Instrument Serif", Georgia, serif; font-size: 52px; line-height: 1; font-weight: 400; color: var(--tone); font-variant-numeric: tabular-nums; display: inline-block; }
.station span { color: var(--muted); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; }
.failed-tag { position: absolute; top: 100%; margin-top: 10px; font-style: normal; font-size: 12px; font-weight: 700; color: var(--rust); background: var(--rust-soft); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.pipeline:has(.failed-tag) { padding-bottom: 48px; }
.track { position: relative; height: 4px; border-radius: 99px; background: var(--line); margin-top: -34px; }
.track::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: repeating-linear-gradient(90deg, var(--teal) 0 8px, transparent 8px 20px); opacity: 0; transition: opacity .4s ease; }
.pipeline.live .track::before { opacity: 0.45; animation: slide 1s linear infinite; }
@keyframes slide { to { background-position: 20px 0; } }
.pulse {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 12px var(--teal), 0 0 0 3px rgba(14, 124, 116, 0.18);
  animation: travel .55s cubic-bezier(.4, 0, .2, 1) forwards;
}
.pulse.fail { background: var(--rust); box-shadow: 0 0 12px var(--rust); animation: travel-fail .7s ease-in forwards; }
@keyframes travel { to { left: 100%; } }
@keyframes travel-fail { 55% { left: 60%; top: 50%; opacity: 1; } 100% { left: 68%; top: 46px; opacity: 0; } }
.bump { animation: bump .45s ease; }
@keyframes bump { 35% { transform: scale(1.14); } }

/* Mini pipeline inside job cards */
.pipeline.mini { padding: 18px 14px 14px; gap: 10px; border-radius: 18px; box-shadow: none; background: #faf7f1; margin: 6px 0 2px; }
.pipeline.mini .station { min-width: 0; gap: 3px; }
.pipeline.mini .station .node { width: 10px; height: 10px; box-shadow: 0 0 0 3px var(--tone-soft); margin-bottom: 3px; }
.pipeline.mini .station strong { font-size: 30px; }
.pipeline.mini .station span { font-size: 9px; letter-spacing: 0.08em; }
.pipeline.mini .track { height: 3px; margin-top: -22px; }
.pipeline.mini .pulse { width: 10px; height: 10px; margin: -5px 0 0 -5px; }
.pipeline.mini .failed-tag { margin-top: 6px; font-size: 11px; padding: 3px 8px; }
.pipeline.mini:has(.failed-tag) { padding-bottom: 36px; }
.pipeline.mini .pulse.fail { animation-name: travel-fail-mini; }
@keyframes travel-fail-mini { 55% { left: 60%; top: 50%; opacity: 1; } 100% { left: 68%; top: 30px; opacity: 0; } }

/* Summary strip */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap); }
.summary article { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 22px 24px; box-shadow: var(--shadow); overflow: hidden; }
.summary strong { display: block; font-family: "Instrument Serif", Georgia, serif; font-size: 44px; font-weight: 400; line-height: 1; margin-bottom: 8px; color: var(--tone, var(--ink)); }
.summary span { color: var(--muted); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; }
.summary article i { position: absolute; right: 18px; top: 20px; width: 14px; height: 14px; border-radius: 50%; background: var(--tone, var(--line)); box-shadow: 0 0 0 4px var(--tone-soft, transparent); }
.summary article::before { content: ""; position: absolute; inset: auto -30% -70% auto; width: 60%; aspect-ratio: 1; border-radius: 50%; background: var(--tone-soft, transparent); opacity: 0.7; }

/* Tones */
.tone-blue { --tone: var(--blue); --tone-soft: var(--blue-soft); }
.tone-teal { --tone: var(--teal); --tone-soft: var(--teal-soft); }
.tone-green { --tone: var(--green); --tone-soft: var(--green-soft); }
.tone-rust { --tone: var(--rust); --tone-soft: var(--rust-soft); }
.tone-warn { --tone: var(--warn); --tone-soft: var(--warn-soft); }

/* Cards */
.panel, .phone-card, .msg-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  position: relative;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  align-content: start;
}
.panel p, .mix-card p, .msg-card p { white-space: pre-wrap; line-height: 1.55; }
.msg-card { padding: 20px 24px 20px 28px; gap: 6px; border-left: 5px solid var(--tone, var(--line)); border-radius: 18px; }
.msg-card strong { font-size: 17px; color: var(--tone, var(--ink)); }
.msg-card.ready { --tone: var(--green); }
.msg-card.bad { --tone: var(--rust); }
.failure {
  margin: 8px 0 2px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff6f4;
  color: var(--ink);
  font: 13px/1.5 ui-sans-serif, system-ui, sans-serif;
  white-space: pre-wrap;
}
.feed { display: grid; gap: 12px; }
.meta, .last, .note { color: var(--muted); font-size: 14px; line-height: 1.5; }
.last { min-height: 1.5em; color: var(--ink); font-weight: 600; }
.ready { color: var(--teal-deep); font-weight: 650; }
.skip { color: var(--warn); font-weight: 650; }
.bad { color: var(--rust); font-weight: 650; }

/* Metrics inside cards */
.metrics, .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 14px; }
.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.metrics div, .kpi-grid div { min-width: 0; }
.metrics div { background: var(--tone-soft, #f7f4ee); border-radius: 14px; padding: 12px 14px; }
.kpi-grid .panel { padding: 22px 24px; gap: 8px; border-top: 4px solid var(--tone, var(--line)); }
.metrics span, .kpi-grid span { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 4px; }
.metrics strong { font-size: 22px; line-height: 1.1; color: var(--tone, var(--ink)); }
.kpi-grid strong { font-size: 34px; line-height: 1.1; font-family: "Instrument Serif", Georgia, serif; font-weight: 400; color: var(--tone, var(--ink)); }
.reservoir { height: 10px; border-radius: 99px; background: #ebe6dc; overflow: hidden; }
.reservoir.tall { height: 16px; }
.reservoir span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--teal), var(--mint)); min-width: 0; transition: width .6s ease; box-shadow: 0 0 10px rgba(94, 234, 212, 0.5); }
.avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: white;
  background: linear-gradient(135deg, var(--teal), var(--night-3));
  flex: none;
  box-shadow: 0 6px 14px rgba(14, 124, 116, 0.25);
}
.avatar.off { background: linear-gradient(135deg, #b9b1a5, #8b8378); box-shadow: none; }
.avatar.pause { background: linear-gradient(135deg, #c98542, var(--warn)); }
.signal { display: inline-flex; align-items: flex-end; gap: 2px; }
.signal i { display: block; width: 4px; border-radius: 2px; background: #d8d1c5; }
.signal i.on { background: var(--teal); }
.battery { display: inline-block; width: 34px; height: 14px; border: 1.5px solid #b9b1a5; border-radius: 4px; padding: 2px; position: relative; }
.battery::after { content: ""; position: absolute; right: -5px; top: 3px; width: 3px; height: 6px; border-radius: 0 2px 2px 0; background: #b9b1a5; }
.battery i { display: block; height: 100%; border-radius: 2px; background: var(--green); }
.battery.mid i { background: var(--warn); }
.battery.low i { background: var(--rust); }
.battery.empty i { width: 0; }
.phone-foot { padding-top: 4px; border-top: 1px dashed var(--line); margin-top: 2px; padding-top: 14px; }

/* Phones */
.fleet { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--gap); }
.phone-card { cursor: grab; text-align: left; width: 100%; padding-left: 32px; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; gap: 18px; }
.phone-card:hover { border-color: #cfc6b8; transform: translateY(-2px); box-shadow: 0 14px 34px rgba(28, 25, 21, 0.08); }
.phone-card:active { cursor: grabbing; }
.phone-card.lifting { opacity: 0.45; transform: scale(0.98); }
.phone-card.blocked { border-color: rgba(159, 45, 34, 0.35); background: linear-gradient(180deg, #fff7f5, var(--card)); }
.phone-card.blocked::before { background: var(--rust); box-shadow: 0 0 12px rgba(159, 45, 34, 0.5); }
.phone-top { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: start; }
.phone-id strong { font-size: 20px; display: block; margin-bottom: 2px; }
.phone-id .meta { line-height: 1.35; }
.phone-state { display: grid; gap: 10px; justify-items: end; }
.phone-card .warnings { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-style: normal; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.tag.bad { background: var(--rust-soft); color: var(--rust); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.note { background: var(--teal-soft); color: var(--teal-deep); }
.pill.bad { background: var(--rust); color: white; box-shadow: 0 0 0 4px var(--rust-soft); }
.dot.bad { background: var(--rust); }

/* Phone glyph */
.device {
  display: grid;
  width: 58px;
  height: 104px;
  padding: 7px 5px;
  border-radius: 14px;
  background: linear-gradient(160deg, #2a2f3a, #0f1320);
  box-shadow: 0 10px 22px rgba(10, 22, 40, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  position: relative;
  flex: none;
}
.device::before { content: ""; position: absolute; top: 3px; left: 50%; width: 18px; height: 4px; margin-left: -9px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); }
.device::after { content: ""; position: absolute; right: -3px; top: 30px; width: 3px; height: 18px; border-radius: 2px; background: #3a4150; }
.device-screen {
  border-radius: 9px;
  display: grid;
  align-content: space-between;
  justify-items: center;
  padding: 10px 6px 8px;
  background: radial-gradient(80px 60px at 50% 0%, rgba(94, 234, 212, 0.55), transparent 70%), linear-gradient(180deg, #0f6f68, #0b3f3b);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: background .4s ease;
}
.device-initials { color: white; font-weight: 700; font-size: 14px; letter-spacing: 0.04em; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35); }
.device-battery { width: 100%; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.device-battery i { display: block; height: 100%; background: var(--mint); border-radius: 99px; }
.device.off .device-screen { background: linear-gradient(180deg, #2b303a, #171b24); }
.device.off .device-initials { color: rgba(255, 255, 255, 0.5); }
.device.off .device-battery i { background: rgba(255, 255, 255, 0.35); }
.device.pause .device-screen { background: radial-gradient(80px 60px at 50% 0%, rgba(255, 200, 120, 0.5), transparent 70%), linear-gradient(180deg, #8a5a12, #4a300a); }
.device.pause .device-battery i { background: #f6c76b; }
.device.blocked .device-screen { background: radial-gradient(80px 60px at 50% 0%, rgba(255, 120, 100, 0.55), transparent 70%), linear-gradient(180deg, #9f2d22, #4b140f); animation: throb 1.6s ease-in-out infinite; }
.device.blocked .device-battery i { background: #ffb4a8; }
@keyframes throb { 50% { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 18px rgba(159, 45, 34, 0.6); } }

/* Small phones on job cards */
.job .phone-picks { gap: 14px; align-items: flex-start; }
.phone-mini { display: grid; justify-items: center; gap: 6px; padding: 8px 6px 6px; border: 0; background: transparent; cursor: grab; border-radius: 14px; transition: transform .15s ease, background .15s ease; }
.phone-mini:hover { background: var(--teal-soft); transform: translateY(-2px); }
.phone-mini:active { cursor: grabbing; }
.phone-mini.lifting { opacity: 0.45; }
.phone-mini .device { width: 36px; height: 64px; padding: 4px 3px; border-radius: 9px; box-shadow: 0 6px 14px rgba(10, 22, 40, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
.phone-mini .device::before { width: 10px; height: 3px; margin-left: -5px; top: 2px; }
.phone-mini .device::after { right: -2px; top: 18px; width: 2px; height: 12px; }
.phone-mini .device-screen { border-radius: 6px; padding: 7px 3px 5px; }
.phone-mini .device-initials { font-size: 10px; letter-spacing: 0; }
.phone-mini .device-battery { height: 3px; }
.phone-mini-name { font-size: 12px; font-weight: 650; color: var(--ink); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-mini.off .phone-mini-name { color: var(--muted); }
.phone-mini.blocked .phone-mini-name { color: var(--rust); }

/* Drag and drop */
.chip { display: inline-flex; align-items: center; gap: 8px; cursor: grab; }
.chip.lifting { opacity: 0.45; }
.chip.blocked { border-color: rgba(159, 45, 34, 0.4); color: var(--rust); }
.job.drop-over, .shelf.drop-over .fleet { outline: 2px dashed var(--teal); outline-offset: 6px; border-radius: var(--radius); }
.job.drop-over { background: var(--teal-soft); }
.drop-hint { color: var(--teal-deep); }
.drop-free { display: none; margin-top: 4px; padding: 18px; border: 2px dashed var(--line); border-radius: 18px; text-align: center; color: var(--muted); font-weight: 650; }
body.dragging .drop-free { display: block; }
.shelf.drop-over .drop-free { border-color: var(--teal); color: var(--teal-deep); background: var(--teal-soft); }

/* Alerts */
.alerts { display: grid; gap: 8px; padding: 18px 22px; border-radius: 18px; border: 1px solid; }
.alerts.warn { background: var(--warn-soft); border-color: rgba(138, 90, 18, 0.25); color: var(--warn); }
.alerts.bad { background: var(--rust-soft); border-color: rgba(159, 45, 34, 0.25); color: var(--rust); }
.alerts p { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.alerts p i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.alerts .meta { font-weight: 500; }
.phone-card::before, .job::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 24px;
  bottom: 24px;
  width: 5px;
  border-radius: 5px;
  background: var(--teal);
}
.phone-card.off::before { background: #cdc5ba; }
.phone-card.pause::before { background: var(--warn); }

/* Jobs */
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: var(--gap); }
.job {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 28px 24px 32px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.job > button[data-open-job] { padding: 0; border: 0; color: inherit; cursor: pointer; gap: 14px !important; }
.job { background: linear-gradient(180deg, #fffefb, var(--card)); }
.job:hover { border-color: #cfc6b8; }
.job h2 { font-size: 26px; font-weight: 650; line-height: 1.15; }
.job .pill + strong { font-size: 15px; color: var(--teal-deep); }
.job .pending { color: var(--teal-deep); }
.row, .actions { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.pending {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 76px;
  line-height: 0.9;
  letter-spacing: -0.03em;
}
.pending-label { color: var(--muted); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 700; margin-top: -8px; }
.job .quiet { align-self: flex-start; padding-left: 0; color: var(--teal-deep); }
.job-actions { display: flex; gap: 18px; align-items: center; }
.job .job-actions [data-delete-job] { color: var(--rust); }
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--muted); display: inline-block; }
.dot.run { background: var(--teal); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(14, 124, 116, 0.14); } }

/* Wizard */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.steps button { border: 0; border-radius: 999px; padding: 14px 12px; background: #ebe6dc; color: var(--muted); font-weight: 650; font-size: 15px; }
.steps button.on { background: linear-gradient(135deg, var(--night-1), var(--night-3)); color: white; box-shadow: 0 8px 20px rgba(10, 22, 40, 0.25); }
.pill { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04); }
.pill:not(.warn):not(.off)::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); margin-right: 7px; box-shadow: 0 0 8px var(--teal); vertical-align: 1px; }
.wizard { display: grid; gap: 24px; }
.mix-rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding: 4px 4px 12px; scroll-snap-type: x proximity; }
.mix-card { border: 1px solid var(--line); background: white; border-radius: 16px; padding: 18px; display: grid; gap: 8px; scroll-snap-align: start; }
.mix-card strong { color: var(--teal-deep); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.review-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.review-table th { text-align: left; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 0 12px 12px 0; }
.review-table td { text-align: left; padding: 12px 12px 12px 0; border-top: 1px solid var(--line); }
.review-table tr:last-child td { padding-bottom: 0; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--gap); }
.bar-bottom {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 20px;
  background: linear-gradient(to bottom, rgba(243, 239, 230, 0), var(--paper) 30%);
}
.bar-bottom .primary { margin-left: auto; min-width: 160px; }
.bar-bottom button:not(.primary) { border-radius: 999px; border: 1px solid var(--line); background: white; padding: 13px 22px; font-weight: 650; }

/* Collapsed extras */
.more { border: 1px dashed var(--line); border-radius: 18px; padding: 0; }
.more summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 22px;
  font-weight: 650;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "+"; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-size: 15px; line-height: 1; }
.more[open] summary::before { content: "–"; }
.more[open] summary { color: var(--ink); }
.more > .stack { padding: 4px 22px 22px; }
.groups { display: grid; }
.group {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 2fr;
  gap: 16px 24px;
  align-items: center;
  padding: 18px 22px;
  border-top: 1px solid var(--line);
}
.group strong { display: block; font-size: 16px; margin-bottom: 2px; }
.group .row.wrap { flex-wrap: wrap; justify-content: flex-end; }
.group .ghost, .group .danger { padding: 11px 18px; }
.group select { padding: 11px 44px 11px 16px; border-radius: 999px; }
.tiny { font-family: "Outfit", "Avenir Next", "Segoe UI", sans-serif; font-weight: 650; letter-spacing: 0; font-size: 13px; padding: 5px 12px; border-radius: 999px; background: var(--teal-soft); color: var(--teal-deep); vertical-align: middle; margin-left: 6px; }
.kpi-grid .panel .tiny { justify-self: start; margin: 2px 0 0; padding-left: 0; background: transparent; color: var(--muted); }
.kpi-grid .panel .tiny:hover { color: var(--rust); }
.primary-row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 44px; }

/* Phone / job detail header */
.head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 24px;
}
.head .screen-title { margin-top: 6px; }
.head .side { display: grid; gap: 10px; justify-items: end; }
.name-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.name-row .wide { width: auto; padding-inline: 24px; }

/* Flying chips */
#sky { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.fly {
  position: fixed;
  padding: 6px 12px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--teal);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  animation: lift 1.45s ease-out forwards;
}
.fly.fail { border-color: var(--rust); color: var(--rust); animation-name: fall; }
@keyframes lift { 0% { transform: translateY(10px); opacity: 0; } 14% { opacity: 1; } 100% { transform: translateY(-92px); opacity: 0; } }
@keyframes fall { 0% { transform: translateY(-8px); opacity: 0; } 18% { opacity: 1; } 100% { transform: translateY(42px); opacity: 0; } }

/* Dialog */
dialog {
  width: min(560px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--card);
  color: var(--ink);
}
dialog::backdrop { background: rgba(28, 25, 21, 0.28); }
.sheet { padding: 32px; display: grid; gap: 18px; }
.sheet h2 { font-family: "Instrument Serif", Georgia, serif; font-size: 40px; font-weight: 400; line-height: 1; }
.sheet code { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; word-break: break-all; background: var(--paper); border-radius: 14px; padding: 16px; }
.sheet .actions { justify-content: flex-end; }

@media (max-width: 820px) {
  :root { --section: 28px; }
  .top { grid-template-columns: 1fr auto; padding: 20px 20px 8px; gap: 14px; }
  .top nav { grid-column: 1 / -1; justify-self: start; }
  main { padding: 12px 20px 80px; gap: 22px; }
  .panel, .phone-card, .msg-card, .job { padding: 22px; }
  .phone-card, .job { padding-left: 26px; }
  .screen-title { font-size: 40px; }
  .pending { font-size: 60px; }
  .head { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding: 12px 14px; }
  .hero-sub { margin-left: 0; }
  .pipeline { grid-template-columns: 1fr; gap: 10px; padding: 24px; justify-items: center; }
  .track { width: 4px; height: 36px; margin: 0; }
  .pipeline.live .track::before { background: repeating-linear-gradient(180deg, var(--teal) 0 8px, transparent 8px 20px); animation-name: slide-down; }
  @keyframes slide-down { to { background-position: 0 20px; } }
  .pulse { left: 50%; top: 0; animation-name: travel-down; }
  @keyframes travel-down { to { top: 100%; } }
  .pulse.fail { animation-name: travel-down; }
  .failed-tag { position: static; margin-top: 4px; }
  .pipeline:has(.failed-tag) { padding-bottom: 24px; }
  .pipeline.mini { grid-template-columns: auto 1fr auto 1fr auto; gap: 8px; padding: 16px 12px 12px; justify-items: stretch; }
  .pipeline.mini .track { width: auto; height: 3px; margin-top: -22px; }
  .pipeline.mini.live .track::before { background: repeating-linear-gradient(90deg, var(--teal) 0 8px, transparent 8px 20px); animation-name: slide; }
  .pipeline.mini .pulse { left: 0; top: 50%; animation-name: travel; }
  .pipeline.mini .pulse.fail { animation-name: travel-fail-mini; }
  .hero-eta { font-size: 24px; }
  .head .side { justify-items: start; }
  .name-row { grid-template-columns: 1fr; }
  .group { grid-template-columns: 1fr; }
  .group .row.wrap { justify-content: flex-start; }
  .name-row .wide { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .fly, .dot.run, .phone-card { animation: none; transition: none; }
}
