:root {
  --paper: #fbfaf8;
  --card: #ffffff;
  --ink: #17181a;
  --muted: #6b6e73;
  --faint: #8e9195;
  --rule: #e4e2dd;
  --rule-strong: #cfccc5;
  --live: #1e6b52;
  --live-bg: #e8f1ec;
  --halt: #9b2c25;
  --halt-bg: #f7ebea;
  --wait: #8a6210;
  --wait-bg: #f8f1e2;
  --radius: 7px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans Georgian", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17181a;
    --card: #1e2022;
    --ink: #e9e8e4;
    --muted: #a2a5a9;
    --faint: #86898d;
    --rule: #303336;
    --rule-strong: #43474b;
    --live: #6fc7a3;
    --live-bg: #1b3229;
    --halt: #e79a94;
    --halt-bg: #33211f;
    --wait: #d9b779;
    --wait-bg: #322a1b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: 34rem; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.shell.wide { max-width: 62rem; }

h1 { font-size: 1.25rem; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 0.95rem; font-weight: 600; margin: 0 0 0.35rem; }
p { margin: 0; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.7rem;
  color: var(--ink);
}
.brand-mark { line-height: 0; }
.brand-mark svg,
img.brand-mark {
  height: 26px;
  width: auto;
  display: block;
}
.brand-word {
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
}
.topbar .who { font-size: 0.8rem; color: var(--muted); text-align: right; }
.topbar .who a { color: var(--muted); }

/* The one raised surface in the whole product. */
.control {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1.35rem 1.5rem;
}

.routing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
}
.routing-row + .routing-row { border-top: 1px solid var(--rule); }
.currency {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  padding: 0.42rem 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.segmented button + button { border-left: 1px solid var(--rule); }
.segmented button[aria-pressed="true"] {
  background: var(--live-bg);
  color: var(--live);
  font-weight: 600;
}
.segmented button:disabled { cursor: not-allowed; opacity: 0.55; }
.segmented button:focus-visible { outline: 2px solid var(--live); outline-offset: -2px; }

.pending {
  border-top: 1px solid var(--rule);
  margin-top: 1rem;
  padding-top: 1rem;
}
.pending p { margin-bottom: 0.85rem; }

button.action {
  appearance: none;
  font: inherit;
  font-size: 0.875rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule-strong);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
button.action:hover { border-color: var(--ink); }
button.action.primary { background: var(--live); border-color: var(--live); color: #fff; }
@media (prefers-color-scheme: dark) { button.action.primary { color: #10231b; } }
button.action:disabled { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.note { font-size: 0.8rem; color: var(--muted); }
.section { margin-top: 2.25rem; }
.rows { border-top: 1px solid var(--rule); }
.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}
.row .meta { font-size: 0.78rem; color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .sub { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  vertical-align: 1px;
}
.tag.live { background: var(--live-bg); color: var(--live); }
.tag.halt { background: var(--halt-bg); color: var(--halt); }
.tag.wait { background: var(--wait-bg); color: var(--wait); }
.tag.off { background: var(--rule); color: var(--muted); }

.banner {
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}
.banner.wait { background: var(--wait-bg); color: var(--wait); }
.banner.halt { background: var(--halt-bg); color: var(--halt); }
.banner.live { background: var(--live-bg); color: var(--live); }
.banner[hidden] { display: none; }

/* Status strip: answers "is everything all right?" without scrolling. */
.statusbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.4rem;
  font-size: 0.875rem;
}
.statusbar .label {
  color: var(--faint);
  font-size: 0.78rem;
  margin-right: 0.4rem;
}
.statusbar .value { color: var(--ink); }
.dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  margin-right: 0.4rem;
}
.dot.up { background: var(--live); }
.dot.down { background: var(--halt); }
.dot.wait { background: var(--wait); }

.tabs {
  display: flex;
  gap: 0.15rem;
  border-bottom: 1px solid var(--rule);
  margin: 0 0 1.6rem;
  overflow-x: auto;
}
.tabs button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--live);
}
.tabs button:focus-visible { outline: 2px solid var(--live); outline-offset: -2px; }

.loading { color: var(--faint); font-size: 0.85rem; padding: 0.9rem 0; }

/* Admin */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.75rem; }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 1rem 1.15rem; }
.orch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(21rem, 1fr));
  gap: 1.75rem 2.25rem;
}
.orch-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}
.orch-head h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
}

.trigger-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.5rem 6.5rem;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.85rem;
}
.trigger-row .name { font-family: var(--mono); font-size: 0.8rem; }
.trigger-row.head { color: var(--muted); font-size: 0.75rem; border-bottom-color: var(--rule-strong); }
.dim { color: var(--faint); }

ol.plan { margin: 0.5rem 0 0; padding-left: 1.15rem; font-size: 0.85rem; line-height: 1.9; }
ol.plan code { font-family: var(--mono); font-size: 0.8rem; }

.steps { margin: 0.5rem 0 0.25rem; font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.steps div { padding: 0.1rem 0; }
.steps .failed { color: var(--halt); }
.steps .warning { color: var(--wait); }

details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }

/* Login */
.login { max-width: 21rem; margin: 12vh auto; padding: 0 1.25rem; }
.field { margin-bottom: 0.85rem; }
.field label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.25rem; }
.field input {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
}
.field input:focus-visible { outline: 2px solid var(--live); outline-offset: -1px; }
.error { color: var(--halt); font-size: 0.85rem; margin-top: 0.6rem; }
.error[hidden] { display: none; }

@media (max-width: 34rem) {
  .trigger-row { grid-template-columns: minmax(0, 1fr) 5rem; row-gap: 0.2rem; }
  .trigger-row .when { display: none; }
}
