/* Holafly brand tokens: the app's HolaDriveTheme.kt palette (docs/APP-DESIGN.md "Brand"). */
:root {
  --background: #FAF9F6;
  --surface: #FFFFFF;
  --surface-alt: #F3F3F7;
  --outline: #E4E6EA;
  --ink: #292B2E;
  --ink-muted: #56575A;
  --ink-faint: #8A8C91;
  --brand: #4F46E5;
  --brand-text: #4338CA;
  --brand-soft: #EEEEFF;
  --gradient: linear-gradient(135deg, #5B4CF0, #1D6FD8);
  --wordmark: #1B1F2E;
  --on-brand-soft: #4338CA;
  --success: #206B43;
  --success-bg: #EDFFF4;
  --danger: #B3261E;
  --danger-bg: #FCEBEA;
  --info-bg: #EAF3FC;
  --info: #1F6FB5;
  --shadow: 0 2px 12px rgba(41, 43, 46, 0.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #121214;
    --surface: #1C1C1F;
    --surface-alt: #26262A;
    --outline: #34343A;
    --ink: #F4F4F6;
    --ink-muted: #A6A7AD;
    --ink-faint: #6E6F75;
    --brand: #8B87FF;
    --brand-text: #A19EFF;
    --brand-soft: #26244D;
    --wordmark: #FFFFFF;
    --on-brand-soft: #A19EFF;
    --success: #36B37E;
    --success-bg: #172B23;
    --danger: #FF6B5E;
    --danger-bg: #3A1A18;
    --info-bg: #15263A;
    --info: #5AA9F0;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --background: #121214; --surface: #1C1C1F; --surface-alt: #26262A; --outline: #34343A;
  --ink: #F4F4F6; --ink-muted: #A6A7AD; --ink-faint: #6E6F75; --brand: #8B87FF; --brand-text: #A19EFF;
  --brand-soft: #26244D; --wordmark: #FFFFFF; --on-brand-soft: #A19EFF; --success: #36B37E; --success-bg: #172B23; --danger: #FF6B5E;
  --danger-bg: #3A1A18; --info-bg: #15263A; --info: #5AA9F0; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--background);
  color: var(--ink);
  font: 16px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
a { color: var(--brand-text); }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--ink-muted); }
.pad { padding: 20px 16px; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.92em; word-break: break-all; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--outline);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.wordmark { display: inline-flex; align-items: baseline; font-size: 24px; font-weight: 800; letter-spacing: -.045em; line-height: 1; color: var(--wordmark); }
.wordmark .bps { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tag { font-size: 12px; font-weight: 500; line-height: 1; color: var(--on-brand-soft); background: var(--brand-soft); border-radius: 7px; padding: 6px 8px; }
.spacer { flex: 1; }
.who { color: var(--ink-muted); font-size: 14px; }

main { max-width: 1200px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--outline); border-radius: 20px;
  padding: 20px; margin-bottom: 12px; box-shadow: var(--shadow); min-width: 0;
}
.card h2 { font-size: 20px; font-weight: 600; margin: 0 0 12px; }
.card h3 { font-size: 16px; font-weight: 600; margin: 16px 0 8px; }
.eyebrow { font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-muted); }

.btn {
  border: 0; border-radius: 10px; padding: 11px 22px; cursor: pointer; font-weight: 500;
  background: var(--gradient); color: #fff; text-decoration: none; display: inline-block;
  transition: filter 0.15s ease;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: var(--surface-alt); color: var(--ink-muted); padding: 8px 16px; }
.btn.ghost:hover:not(:disabled) { color: var(--ink); filter: none; }
.btn.soft { background: var(--brand-soft); color: var(--brand-text); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: default; }

input[type="text"], input[type="password"], input[type="search"], select {
  background: var(--surface-alt); border: 1px solid var(--outline); border-radius: 12px; padding: 10px 12px; min-width: 0;
}
label { display: block; font-size: 14px; color: var(--ink-muted); margin-bottom: 4px; }

.login { max-width: 380px; margin: 48px auto; }
.login form > div { margin-bottom: 14px; }
.login input { width: 100%; }
.error { color: var(--danger); font-size: 14px; margin: 8px 0 0; }

.filters { position: relative; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters .grow { flex: 1 1 260px; }
.filters .btn { align-self: stretch; }

/* date-range picker (rangepicker.js) */
.dr-wrap { display: contents; }
.dr { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-alt); border: 1px solid var(--outline); border-radius: 10px; padding: 10px 12px; cursor: pointer; color: var(--ink); white-space: nowrap; min-width: 150px; }
.dr svg { flex: none; color: var(--ink-muted); }
.dr-label.empty { color: var(--ink-muted); }
.dr[aria-expanded="true"] { outline: 2px solid var(--brand); outline-offset: 1px; }
.pop { position: absolute; top: calc(100% + 8px); right: 0; width: 340px; background: var(--surface); border: 1px solid var(--outline); border-radius: 16px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18); padding: 14px; z-index: 20; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.quick button { border: 0; border-radius: 8px; padding: 5px 10px; font-size: 13px; font-weight: 500; background: var(--surface-alt); color: var(--ink-muted); cursor: pointer; }
.quick button:hover { color: var(--ink); }
.quick button.on { background: var(--brand-soft); color: var(--brand-text); }
.quick .clear { margin-left: auto; background: none; color: var(--brand-text); padding: 5px 4px; }
.mon { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mon strong { font-size: 15px; }
.mon button { border: 0; background: var(--surface-alt); color: var(--ink); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; }
.wk, .days { display: grid; grid-template-columns: repeat(7, 1fr); }
.wk span { text-align: center; font-size: 12px; color: var(--ink-faint); padding: 4px 0; }
.days button { border: 0; background: none; color: var(--ink); height: 40px; font-size: 14px; cursor: pointer; padding: 0; }
.days button span { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; }
.days button:hover span { background: var(--surface-alt); }
.days button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 10px; }
.days button.today span { box-shadow: inset 0 0 0 1.5px var(--ink-faint); font-weight: 600; }
.days button.mid { background: var(--brand-soft); color: var(--brand-text); }
.days button.mid:hover span { background: transparent; }
.days button.start, .days button.end { background: var(--brand-soft); }
.days button.start { border-radius: 10px 0 0 10px; }
.days button.end { border-radius: 0 10px 10px 0; }
.days button.start.end { border-radius: 10px; background: none; }
.days button.start span, .days button.end span { background: var(--gradient); color: #fff; font-weight: 600; box-shadow: none; }
.days button.preview { opacity: 0.75; }
.pop-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--ink-muted); }

.chip {
  display: inline-block; border-radius: 8px; padding: 4px 10px; font-size: 13px; font-weight: 500;
  background: var(--surface-alt); color: var(--ink-muted); white-space: nowrap;
}
.chip.ok { background: var(--success-bg); color: var(--success); }
.chip.warn { background: var(--brand-soft); color: var(--brand-text); }
.chip.bad { background: var(--danger-bg); color: var(--danger); }
.chip.info { background: var(--info-bg); color: var(--info); }
/* Run-level status: equal-width chips so the column reads evenly. */
.chip.status { min-width: 92px; text-align: center; }

.runs { width: 100%; border-collapse: collapse; }
.runs th, .runs td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--outline); vertical-align: middle; white-space: nowrap; }
.runs th { font-size: 13px; font-weight: 500; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.runs th.r, .runs td.r { text-align: right; }
.runs tbody tr { cursor: pointer; }
.runs tbody tr:hover td { background: var(--surface-alt); }
.runs tbody tr:last-child td { border-bottom: 0; }
.runs td .top { display: block; font-weight: 600; }
.runs td .sub { display: block; color: var(--ink-muted); font-size: 13px; }
.runs td.run .mono { display: block; font-size: 13px; color: var(--ink-muted); }
.runs td.run .sub { color: var(--ink); font-size: 14px; }
.runs td.num { font-weight: 600; }
.runs td.num .unit { font-size: 0.78em; font-weight: 500; color: var(--ink-muted); }
.runs tr.empty td { cursor: default; color: var(--ink-muted); padding: 20px 8px; }
.runs tr.empty:hover td { background: none; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.list-head .count { font-size: 18px; margin: 0; }

.headline { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.headline + .headline { margin-top: 12px; }
.metric { background: var(--surface-alt); border-radius: 16px; padding: 14px; min-width: 0; }
.metric .eyebrow { margin-bottom: 4px; }
.metric .value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.metric .unit { font-size: 14px; color: var(--ink-muted); margin-left: 4px; }
.metric .note { font-size: 13px; color: var(--ink-muted); margin-top: 2px; }
.metric .reading { white-space: nowrap; }
.metric .ping-icon { width: 22px; height: 22px; margin-right: 6px; vertical-align: -2px; fill: none; stroke: var(--ink-muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.metric.text .value { font-size: 20px; overflow-wrap: anywhere; }
.metric .value.missing { color: var(--ink-faint); }

.scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.grid { border-collapse: collapse; font-size: 14px; width: 100%; }
table.grid th, table.grid td { padding: 6px 8px; border-bottom: 1px solid var(--outline); text-align: left; vertical-align: top; }
table.grid th { color: var(--ink-muted); font-weight: 500; white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
table.grid td { white-space: nowrap; }
.missing { color: var(--ink-faint); }

details { border: 1px solid var(--outline); border-radius: 12px; margin: 8px 0; background: var(--surface); }
details > summary { cursor: pointer; padding: 10px 12px; font-weight: 600; list-style-position: inside; }
details > .body { padding: 0 12px 12px; min-width: 0; }
details details { background: transparent; }
.card > details { margin: 0; border: 0; }
.card > details > summary { padding: 0; }
.card > details > .body { padding: 12px 0 0; }

.step-head > * { margin-right: 8px; }
.step-head .chip { vertical-align: 1px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 8px; }

/* run page */
.run-head { margin: 4px 0 12px; }
.back { display: inline-block; text-decoration: none; font-weight: 600; margin-bottom: 8px; }
.run-title { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.run-title h1 { font-size: 28px; font-weight: 700; margin: 0; }
.run-id { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.run-id .mono { font-size: 13px; color: var(--ink-muted); }
.when { margin: 4px 0 0; }
div.when p { margin: 0; }
table.iters { width: 100%; border-collapse: collapse; }
table.iters th, table.iters td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--outline); vertical-align: top; }
table.iters th { font-size: 13px; font-weight: 500; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.4px; }
table.iters td.it { font-weight: 600; white-space: nowrap; }
table.iters td .unit { color: var(--ink-muted); font-size: 13px; }
table.iters td.bad { color: var(--danger); font-weight: 600; }
table.iters td.missing { color: var(--ink-faint); }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 8px 32px; }
.group h3 { margin: 8px 0 4px; }
dl { margin: 0; }
dl .pair { display: grid; grid-template-columns: minmax(120px, 42%) 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--outline); font-size: 15px; }
dl .pair:last-child { border-bottom: 0; }
dt { color: var(--ink-muted); }
dd { margin: 0; overflow-wrap: anywhere; }
table.steps { width: 100%; border-collapse: collapse; font-size: 15px; }
table.steps td { padding: 8px 6px; border-bottom: 1px solid var(--outline); vertical-align: middle; }
table.steps tr:last-child td { border-bottom: 0; }
table.steps td.num { text-align: right; white-space: nowrap; }
pre.raw { margin: 0; max-height: 70vh; overflow: auto; font-size: 12px; background: var(--surface-alt); padding: 12px; border-radius: 12px; }

@media (max-width: 760px) {
  main { padding: 12px 16px; }
  .card { padding: 16px; border-radius: 16px; }
  .filters .grow { flex-basis: 100%; }
  .filters select { flex: 1 1 40%; min-width: 0; }
  .filters .dr { flex: 1 1 100%; min-width: 0; }
  .filters .btn { flex: 1 1 40%; }
  /* Full width of the screen less the 16px page gutters (card padding 16 + border 1). */
  .pop { left: -17px; right: -17px; width: auto; }
  /* The table slides sideways inside its card; the Run column stays pinned. */
  .runs th, .runs td { padding: 9px 6px; }
  .runs th:first-child, .runs td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
  .headline { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { padding: 12px; }
  .metric .value { font-size: 24px; }
  .metric.text .value { font-size: 18px; }
  .run-title h1 { font-size: 24px; }
  .run-title .spacer { display: none; }
  .run-id { flex-basis: 100%; }
  .groups { grid-template-columns: 1fr; }
  table.steps { font-size: 14px; }
  table.steps .chip { white-space: normal; }
  table.steps td.muted.num { display: none; }
  table.steps td.num { white-space: normal; overflow-wrap: anywhere; }
  .step-head > .muted { display: block; font-size: 14px; font-weight: 400; margin: 2px 0 0 18px; }
  table.iters thead { display: none; }
  table.iters, table.iters tbody, table.iters tr, table.iters td { display: block; width: 100%; }
  table.iters tr { border-bottom: 1px solid var(--outline); padding: 8px 0; }
  table.iters td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; }
  table.iters td.it { padding-bottom: 6px; justify-content: flex-start; gap: 8px; }
  table.iters td[data-label]::before { content: attr(data-label); color: var(--ink-muted); font-weight: 400; font-size: 14px; }
  table.iters td > span { text-align: right; }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wordmark .bps { background: linear-gradient(135deg, #9C95FF, #5FB0FF); -webkit-background-clip: text; background-clip: text; } }
:root[data-theme="dark"] .wordmark .bps { background: linear-gradient(135deg, #9C95FF, #5FB0FF); -webkit-background-clip: text; background-clip: text; }
