:root {
  color-scheme: light dark;
  --bg: #f6f7f8;
  --surface: #fff;
  --text: #1c2024;
  --muted: #5c6670;
  --border: #d9dde1;
  --accent: #185fa5;
  --on-accent: #fff;
  --ok: #17693a;
  --ok-bg: #e3f4e9;
  --warn: #8a5300;
  --warn-bg: #fdf0d9;
  --error: #b3261e;
  --error-bg: #fbe5e3;
  --neutral-bg: #eceef0;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1e2226;
    --text: #e8eaed;
    --muted: #a0a8b0;
    --border: #363c42;
    --accent: #85b7eb;
    --on-accent: #0d1a2b;
    --ok: #6fd39a;
    --ok-bg: #173324;
    --warn: #f2c26b;
    --warn-bg: #3a2c12;
    --error: #f2968f;
    --error-bg: #3d1d1b;
    --neutral-bg: #2a2f34;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

main {
  flex: 1;
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem 1rem;
}

footer {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* App bar */

.appbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 44rem;
  width: 100%;
  margin: 0 auto;
  padding: 0.5rem 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

/* Text */

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0.5rem 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.125rem; margin: 2rem 0 0.75rem; }
h3 { display: flex; align-items: center; gap: 0.5rem; font-size: 1.0625rem; margin: 0; }
p { margin: 0.5rem 0; }
a { color: var(--accent); }
.muted, small { color: var(--muted); }
.lead { color: var(--muted); margin: -0.5rem 0 1rem; }
.error { color: var(--error); }

.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.top, .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.top h1 { margin-bottom: 0.75rem; }

.narrow { max-width: 24rem; margin: 2rem auto 0; }

/* Surfaces */

.panel, .card, .history li, .danger-zone {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.cards, .history, .connections {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.card {
  display: block;
  color: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.card .name { font-size: 1.125rem; color: var(--accent); }

@media (hover: hover) {
  .card:hover { border-color: var(--accent); }
}

.card:focus-visible, button:focus-visible, .button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card .error { margin-bottom: 0; }

.empty ol { padding-left: 1.25rem; }
.empty h2 { margin-top: 0; }

/* Status */

.badge {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--neutral-bg);
  color: var(--muted);
}

.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.error { background: var(--error-bg); color: var(--error); }
.badge.setup, .badge.paused { background: var(--warn-bg); color: var(--warn); }
.badge.waiting { background: var(--neutral-bg); color: var(--text); }

.services {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0.75rem 0;
  padding: 0;
}

.services li {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.875rem;
}

.dot { width: 0.625rem; height: 0.625rem; border-radius: 50%; }
.services .on .dot { background: var(--ok); }
/* Hollow dot: the state stays readable without color. */
.services .off { color: var(--muted); border-style: dashed; }
.services .off .dot { border: 2px solid var(--warn); }

.facts { margin: 0; display: grid; gap: 0.5rem; }
.facts dt { font-size: 0.8125rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.facts .muted { font-weight: 400; }
.facts.grid { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1rem; }

.step {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  font-size: 0.875rem;
}

.step.done { background: var(--ok); border-color: var(--ok); color: var(--surface); }

.measures { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }

.notice {
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border-left: 4px solid currentColor;
}

.notice h2 { margin-top: 0; }
.notice .guide { padding-left: 1.25rem; }
.notice .guide li { margin-bottom: 0.5rem; }
.notice a { color: inherit; }

code {
  font: 0.875rem/1.4 ui-monospace, monospace;
  overflow-wrap: anywhere;
}

/* Values to copy as is: a block, with every character selectable. */
code.copy {
  display: block;
  margin-top: 0.25rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  user-select: all;
}

.notice.success { background: var(--ok-bg); color: var(--ok); }
.notice.warning { background: var(--warn-bg); color: var(--warn); }
.notice.danger { background: var(--error-bg); color: var(--error); }

/* Forms. 16px font stops phones from zooming on focus; 44px meets touch-target size. */

label { display: block; margin: 1rem 0 0.25rem; font-weight: 600; }
label:first-child { margin-top: 0; }

input, select, button, .button {
  width: 100%;
  min-height: 44px;
  font: inherit;
  border-radius: 8px;
}

input, select {
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

form small { display: block; margin-top: 0.375rem; }

button, .button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }

button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

button.destructive { background: var(--error); border-color: var(--error); color: var(--surface); }

button.link {
  width: auto;
  margin: 0;
  padding: 0 0.25rem;
  background: none;
  border: 0;
  color: var(--muted);
  font-weight: 400;
}

.button.small { width: auto; margin: 0 0 0.75rem; }

details { margin-top: 0.75rem; }

summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.danger-zone { margin-top: 2rem; }
.danger-zone summary, .delete-day summary { color: var(--error); }
.delete-day { margin-top: 0.25rem; }
