:root,
html[data-theme="light"] {
  --bg: #f6f1ea;
  --bg-2: #fffaf4;
  --card: #ffffff;
  --line: rgba(40, 28, 20, 0.1);
  --ink: #1c1612;
  --muted: #6f6358;
  --red: #d01222;
  --red-dim: rgba(208, 18, 34, 0.12);
  --good: #2f7d3a;
  --warn: #b36a12;
  --info: #2b6f8f;
  --hold: #6d635a;
  --shadow: 0 10px 22px rgba(40, 28, 20, 0.08);
  --tabbar: #fffdf9;
  --wash: rgba(208, 18, 34, 0.08);
  --poc: #b40f1c;
  --btn-2: #3a332c;
  --toast-bg: #1c1612;
  --toast-ink: #f6f1ea;
  --sheet-dim: rgba(28, 22, 18, 0.4);
  --desk: #e8e0d4;
  --tab: calc(64px + env(safe-area-inset-bottom));
}
html[data-theme="dark"] {
  --bg: #161210;
  --bg-2: #1e1914;
  --card: #241e18;
  --line: rgba(244, 238, 228, 0.1);
  --ink: #f4eee4;
  --muted: #b7aa9a;
  --red: #e11d2e;
  --red-dim: rgba(225, 29, 46, 0.16);
  --good: #7dba62;
  --warn: #e0a04a;
  --info: #6ea8c9;
  --hold: #8d7f72;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  --tabbar: #100e0c;
  --wash: rgba(225, 29, 46, 0.16);
  --poc: #ff8a93;
  --btn-2: #3a332c;
  --toast-bg: #fff;
  --toast-ink: #161210;
  --sheet-dim: rgba(0, 0, 0, 0.55);
  --desk: #0c0a09;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, "Segoe UI", sans-serif;
}
body {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 0;
}
button, a, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
img { display: block; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 400px at 80% -10%, var(--wash), transparent 50%),
    var(--bg);
}
.app-desk { max-width: 960px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand > div { min-width: 0; }
.brand img { border-radius: 10px; }
.brand-name { font-weight: 800; letter-spacing: 0.01em; }
.brand-sub {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-right { text-align: right; display: grid; justify-items: end; gap: 4px; flex: none; }
.theme-btn, .text-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.clock { font-size: 12px; color: var(--muted); }

.install, .offline, .paused, .banner {
  margin: 0 16px 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  line-height: 1.4;
}
.install span, .banner span { flex: 1; }
.paused {
  border-color: var(--red);
  background: var(--red-dim);
  display: block;
}

.view {
  flex: 1;
  padding: 8px 16px var(--tab);
}
.app-desk .view { padding-bottom: 32px; }
.kicker {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}
h1 { margin: 2px 0 12px; font-size: 26px; line-height: 1.15; }
h2 { margin: 0 0 8px; font-size: 18px; }
.note { color: var(--muted); font-size: 14px; line-height: 1.45; }
.lead { font-size: 16px; line-height: 1.45; }
.error {
  color: var(--poc);
  background: var(--red-dim);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 14px;
}

.card, .person, .chase, .crew-card, .mode-card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.card, .person, .chase { padding: 12px 14px; margin-bottom: 10px; text-align: left; width: 100%; }
.card { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: start; }
.card-wide { grid-template-columns: 1fr auto; }
button.card { cursor: pointer; }
.when { color: var(--muted); font-size: 12px; font-weight: 700; }
.title { font-weight: 800; }
.meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.money { font-variant-numeric: tabular-nums; font-weight: 800; }
.money-col { text-align: right; }
.list-head {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.list-head.flush { margin-top: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--red-dim);
  color: var(--poc);
  white-space: nowrap;
}
.pill.good { background: rgba(47, 125, 58, 0.14); color: var(--good); }
.pill.warn { background: rgba(179, 106, 18, 0.16); color: var(--warn); }
.pill.info { background: rgba(43, 111, 143, 0.14); color: var(--info); }
.pill.hold { background: rgba(109, 99, 90, 0.16); color: var(--hold); }

.person { display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800;
  background: var(--red); color: #fff;
}

.tabs {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--tabbar);
  border-top: 1px solid var(--line);
  padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  min-height: 48px;
  padding: 6px 0;
}
.tabs svg { width: 20px; height: 20px; fill: currentColor; }
.tabs button.is-on { color: var(--ink); }
.tabs button.is-on svg { color: var(--red); }

.sheet {
  position: fixed;
  inset: 0;
  background: var(--sheet-dim);
  z-index: 40;
  display: grid;
  align-items: end;
}
.sheet-card {
  background: var(--bg-2);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 86dvh;
  overflow: auto;
}
.toast {
  position: fixed;
  left: 50%;
  top: calc(76px + env(safe-area-inset-top));
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: var(--toast-ink);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  z-index: 50;
  max-width: calc(100% - 32px);
  text-align: center;
}

.action, .install button, .sheet-close, button.primary {
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  padding: 8px 14px;
  min-height: 44px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.action.secondary, button.secondary { background: var(--btn-2); color: #fff; }
.ghost { background: transparent !important; color: var(--muted) !important; border: 0; min-height: 44px; font-weight: 700; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.editor { padding: 14px; }
.stack { display: grid; gap: 8px; }
.stack.gap { margin-top: 12px; }
.stack .action, .stack button.primary, .stack button.secondary { width: 100%; }

.field { display: grid; gap: 6px; font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.field span, .field { color: var(--ink); }
input, select, textarea {
  width: 100%;
  font-size: 16px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  min-height: 48px;
}
textarea { min-height: 88px; resize: vertical; }
.hint { font-weight: 500; color: var(--muted); font-size: 13px; }

.fab {
  position: fixed;
  right: max(16px, calc(50% - 240px + 16px));
  bottom: calc(var(--tab) + 12px);
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(208, 18, 34, 0.35);
  z-index: 30;
  display: grid;
  place-items: center;
}
.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.add-choice {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  min-height: 72px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.modes { display: grid; gap: 8px; }
.mode-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  color: inherit;
}
.mode-card.is-on {
  border-color: var(--red);
  box-shadow: 0 0 0 2px var(--red-dim), var(--shadow);
}
.mode-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mode-title { font-weight: 800; }
.mode-check {
  width: 22px; height: 22px; border-radius: 999px;
  display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800;
}
.mode-card.is-on .mode-check { background: var(--red); }
.mode-blurb { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; font-weight: 500; }

.steps { display: flex; gap: 6px; margin-bottom: 10px; }
.steps i {
  height: 4px; flex: 1; border-radius: 999px; background: var(--line); display: block;
}
.steps i.on { background: var(--red); }

.person-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--card);
}
.person-row .row { margin-bottom: 8px; }

.split { display: grid; gap: 16px; }
.crew-card { padding: 14px; margin-bottom: 12px; }
.crew-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.link-box, .login-box {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px dashed var(--line);
}
.link-box input { background: transparent; }
.break { overflow-wrap: anywhere; word-break: break-word; }
#add-person { width: 100%; }
.home-links { margin-top: 18px; }

@media (min-width: 720px) {
  body { background: var(--desk); }
  .app { max-width: 840px; box-shadow: 0 0 0 1px var(--line); }
  .app-desk { max-width: 960px; }
  h1 { font-size: 30px; }
  .tabs { width: min(840px, 100%); }
  .fab { right: max(16px, calc(50% - 420px + 16px)); }
  .jobs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .jobs-grid .card { margin-bottom: 0; }
}
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 340px; align-items: start; }
  .editor { position: sticky; top: 12px; }
  .modes { grid-template-columns: 1fr; }
}
