/* The spotfleet console. The palette comes from the snail: violet shell, teal, pink lycra,
   orange body, electric blue trainers. */
:root {
  --bg: #faf7ff;
  --surface: #ffffff;
  --surface-2: #f3eefc;
  --ink: #1d1530;
  --ink-2: #5b5274;
  --line: #e4dcf3;
  --violet: #7b3fe4;
  --teal: #12b5b0;
  --pink: #e8338e;
  --orange: #f2771f;
  --blue: #2f5ce8;
  --good: #11906a;
  --warn: #b86a00;
  --bad: #d22f4a;
  --shadow: 0 1px 2px rgba(40, 20, 80, .06), 0 8px 24px rgba(40, 20, 80, .08);
  --radius: 16px;
  --spark-activity: #7b3fe4; --spark-cpu: #e8338e; --spark-mem: #f2771f; --spark-disk: #12b5b0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #120d1e; --surface: #1b1429; --surface-2: #241b37; --ink: #f2edff; --ink-2: #b2a7cc;
    --line: #342851; --violet: #a77bff; --teal: #3fd6cf; --pink: #ff5aa8; --orange: #ff9a4d;
    --blue: #6d8dff; --good: #39c99a; --warn: #f0a640; --bad: #ff6178;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --spark-activity: #8a5cec; --spark-cpu: #e0408a; --spark-mem: #de7428; --spark-disk: #1fa8a2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #120d1e; --surface: #1b1429; --surface-2: #241b37; --ink: #f2edff; --ink-2: #b2a7cc;
  --line: #342851; --violet: #a77bff; --teal: #3fd6cf; --pink: #ff5aa8; --orange: #ff9a4d;
  --blue: #6d8dff; --good: #39c99a; --warn: #f0a640; --bad: #ff6178; color-scheme: dark;
  --spark-activity: #8a5cec; --spark-cpu: #e0408a; --spark-mem: #de7428; --spark-disk: #1fa8a2;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, sans-serif; }
h1, h2, h3 { font-family: "Bricolage Grotesque", Inter, sans-serif; letter-spacing: -.02em; margin: 0 0 .5em; }
h2 { font-size: 1.25rem; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .86em; }
a { color: var(--violet); }
[hidden] { display: none !important; }

.btn { display: inline-flex; align-items: center; gap: .5em; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: 600 .95rem Inter, sans-serif; padding: .6em 1.1em; border-radius: 999px; cursor: pointer;
  text-decoration: none; transition: transform .08s ease, background .15s ease; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--violet), var(--pink)); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.github { background: #1d1530; color: #fff; border-color: #1d1530; width: 100%; justify-content: center; }
.btn.github svg { width: 18px; height: 18px; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger.armed { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: .35em .8em; font-size: .85rem; }

input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: .55em .8em; min-width: 0; }
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
label, legend { font-weight: 600; font-size: .85rem; color: var(--ink-2); display: block; margin-bottom: .35em; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 20px; }
.message { min-height: 1.4em; margin: .6em 0 0; color: var(--ink-2); }
.fine { font-size: .82rem; color: var(--ink-2); margin: .6em 0 0; }

/* ---------- Signed out ---------- */
.hero { min-height: 100vh; background-size: cover; background-position: 30% center; display: flex; align-items: center;
  justify-content: flex-end; padding: 32px 16px; }
.hero-copy { width: min(500px, 100%); margin-right: max(0px, 6vw); }
.eyebrow { font: 800 .9rem "Bricolage Grotesque", sans-serif; text-transform: uppercase; letter-spacing: .14em;
  color: #fff; background: var(--violet); display: inline-block; padding: .2em .7em; border-radius: 999px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.02; color: #2a1650; margin: .3em 0; }
.hero .lede { color: #3d2a63; font-size: 1.08rem; margin: 0 0 1.4em; }
.signin .row { display: flex; gap: 8px; }
.signin .row input { flex: 1; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: .8rem; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 760px) {
  .hero { align-items: flex-end; background-position: 18% top; padding-top: 42vh; }
  .hero-copy { margin: 0; }
  .hero h1, .hero .lede { color: #fff; text-shadow: 0 2px 12px rgba(30, 10, 60, .55); }
  .signin .row { flex-direction: column; }
}

body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.narrow { max-width: 380px; text-align: center; }

/* ---------- Signed in ---------- */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
  font: 800 1.2rem "Bricolage Grotesque", sans-serif; }
.brand img { border-radius: 10px; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tabs button { background: none; border: 0; font: 600 .95rem Inter, sans-serif; color: var(--ink-2); padding: .5em .9em;
  border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--violet); }
.who { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: .88rem; }
main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
.banner { background: color-mix(in srgb, var(--teal) 14%, var(--surface)); border: 1px solid var(--teal);
  border-radius: 12px; padding: 10px 14px; }
.banner.bad { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); border-color: var(--bad); }
.setup { border: 2px dashed var(--violet); }

.fleet-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.fleet-head h2 { margin: 0; }
.fleet-head .repo { color: var(--ink-2); }
.pill { font: 600 .78rem Inter, sans-serif; padding: .25em .7em; border-radius: 999px; }
.pill.running { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.pill.paused { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.stat .label { font-size: .78rem; color: var(--ink-2); }
.stat .value { font: 700 1.6rem "Bricolage Grotesque", sans-serif; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .78rem; color: var(--ink-2); }

.chart { width: 100%; height: 180px; display: block; }
.chart text { fill: var(--ink-2); font: 11px Inter, sans-serif; }
.chart .grid { stroke: var(--line); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-2); margin: 6px 0 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.box h3 { font-size: 1rem; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.controls .field { display: flex; flex-direction: column; }
.steps { margin: 0; padding-left: 1.2em; }
.steps li { margin-bottom: .7em; }
.snippet { position: relative; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-top: .4em;
  overflow-x: auto; white-space: pre; }
.snippet button { position: absolute; top: 6px; right: 6px; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { font-size: .78rem; color: var(--ink-2); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.invite { display: grid; grid-template-columns: 2fr 1.4fr; gap: 12px; align-items: end; }
.invite fieldset { border: 0; padding: 0; margin: 0; grid-column: 1 / -1; display: flex; gap: 14px; flex-wrap: wrap; }
.invite fieldset label { display: inline-flex; gap: 6px; align-items: center; color: var(--ink); font-weight: 500; }
.invite .field { display: flex; flex-direction: column; }
@media (max-width: 640px) { .invite { grid-template-columns: 1fr; } }
tr.selected td { background: color-mix(in srgb, var(--violet) 8%, transparent); }
.count { background: var(--pink); color: #fff; border-radius: 999px; font-size: .72rem; padding: .05em .5em; margin-left: 4px; }
.checks { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.checks label { display: inline-flex; gap: 4px; align-items: center; color: var(--ink); font-weight: 500; margin: 0; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--good); margin-left: auto; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: pulse 1.6s ease-in-out infinite; }
.live.stale { color: var(--warn); }
.live.stale i { background: var(--warn); animation: none; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .live i { animation: none; } }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.picker { position: relative; }
.picker-panel { position: absolute; z-index: 10; top: calc(100% + 6px); left: 0; min-width: 260px; max-height: 60vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; }
.picker-panel label { display: flex; gap: 8px; align-items: center; color: var(--ink); font-weight: 500; padding: 4px 0; margin: 0; cursor: pointer; }
.picker-group { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.picker-group label:not(:first-child) { padding-left: 22px; }
.chevron { background: none; border: 0; color: var(--ink-2); font-size: 1.1rem; cursor: pointer; transition: transform .15s ease; padding: 0 2px; }
.fleet.collapsed .chevron { transform: rotate(-90deg); }
.fleet.collapsed .fleet-body { display: none; }
.fleet.collapsed .fleet-head { margin-bottom: 0; }
.fleet-head .client { font-size: .78rem; color: var(--ink-2); background: var(--surface-2); padding: .15em .6em; border-radius: 999px; }
.summary-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; background: var(--surface-2); border-radius: 10px; padding: 6px 10px;
  font-size: .85rem; font-variant-numeric: tabular-nums; }
.chip-label { color: var(--ink-2); font-size: .75rem; }
details.section { border-top: 1px solid var(--line); padding: 10px 0; }
details.section > summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; min-height: 32px; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before { content: "▸"; color: var(--ink-2); transition: transform .15s ease; }
details.section[open] > summary::before { transform: rotate(90deg); }
details.section[open] > summary { margin-bottom: 10px; }
.section-part + .section-part { margin-top: 16px; }
.section-part h3 { font-size: .95rem; }
.chart-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.chart-head h3 { margin: 0; font-size: 1rem; }
.chart-head .legend { margin: 0; }
.spark { display: block; overflow: visible; cursor: crosshair; }
.spark-base { stroke: var(--line); stroke-width: 1; }
.spark-empty { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.chip .spark { margin-left: 4px; align-self: center; }
.chip { align-items: center; }
.spark-tile .spark { margin: 6px 0 2px; width: 100%; }
.spark-cell { white-space: nowrap; }
.spark-cell .spark { display: inline-block; vertical-align: middle; margin-right: 6px; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--bg); font-size: .78rem;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.estimated { display: inline-flex; align-items: baseline; gap: 4px; }
.est { font: 600 .66rem Inter, sans-serif; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 3px; cursor: help; }

/* ---------- Phone ---------- */
select { max-width: 100%; }
.chevron { min-width: 32px; min-height: 32px; }
@media (max-width: 640px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .brand span { display: none; }
  .tabs { order: 3; flex-basis: 100%; }
  .tabs button { padding: .45em .75em; font-size: .9rem; }
  .who { margin-left: auto; font-size: .8rem; min-width: 0; }
  .who > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
  main { padding: 16px 12px 48px; }
  .card { padding: 14px; border-radius: 14px; }
  .box { padding: 12px; }
  .fleet-head { gap: 8px; }
  .fleet-head h2 { font-size: 1.15rem; }
  .fleet-head .repo { font-size: .78rem; flex-basis: 100%; order: 5; }
  .live { margin-left: 0; flex-basis: 100%; order: 6; }
  .summary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .chip { justify-content: space-between; flex-wrap: wrap; padding: 6px 8px; font-size: .8rem; min-width: 0; }
  .chip .spark { width: 100%; margin: 4px 0 0; }
  .chip:has(.estimated), .chip:nth-last-child(3) { grid-column: 1 / -1; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 8px 10px; min-width: 0; }
  .stat .value { font-size: 1.2rem; overflow-wrap: anywhere; }
  .controls { flex-direction: column; align-items: stretch; }
  .controls .btn { justify-content: center; }
  th, td { padding: 6px 6px; }
  .hide-sm { display: none; }
  .spark-cell .spark { width: 56px; }
  .toolbar .btn.small { padding: .35em .6em; }
  details.section > summary .fine { flex-basis: 100%; }
}
