:root {
  color-scheme: light;
  --bg: #f7fafc;
  --surface: #ffffff;
  --text: #111827;
  --muted: #5d697a;
  --line: #d9e1ea;
  --green: #22a06b;
  --green-soft: #dff7ea;
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --orange: #f97316;
  --ink: #0f172a;
  --shadow: 0 14px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 99, 235, 0.08), transparent 30rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 38%, #ffffff 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: var(--ink);
  color: white;
}

.brand,
.top-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand {
  font-size: 1.35rem;
  font-weight: 800;
}

.brand-mark {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: #4ade80;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.top-actions a {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  color: white;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
}

.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 2rem;
}

.intro,
.section-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.intro {
  margin-bottom: 1.8rem;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 1.1rem;
  line-height: 1.25;
}

.intro p,
.muted {
  color: var(--muted);
  line-height: 1.6;
}

.intro p {
  margin-top: 0.6rem;
  font-size: 1.05rem;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.35rem;
}

.panel-heading {
  margin-bottom: 1rem;
}

.panel-heading h2 {
  flex: 1;
}

.icon {
  display: inline-grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border-radius: 8px;
  color: white;
  font-size: 0.78rem;
  font-weight: 900;
}

.cloudflare {
  background: var(--orange);
}

.supabase {
  background: var(--green);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.7rem;
  border-radius: 999px;
  background: #eef2f7;
  color: #3f4a5a;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.7rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill.online {
  background: var(--green-soft);
  color: #087443;
}

.pill.error {
  background: #ffe4e6;
  color: #be123c;
}

.facts {
  display: grid;
  gap: 0.9rem;
  margin: 1.5rem 0;
}

.compact-facts {
  margin-bottom: 0;
}

.facts div {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
}

dt {
  color: #465366;
  font-weight: 700;
}

dd {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  background: var(--green);
}

.success-box,
.info-box {
  border-radius: 8px;
  line-height: 1.55;
  padding: 1rem;
}

.success-box {
  border: 1px solid #a9e8c5;
  background: linear-gradient(135deg, #effdf4, #e6f8ef);
  color: #087443;
  font-weight: 800;
}

.success-box.error {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #be123c;
}

.info-box {
  margin-top: 1rem;
  border: 1px solid #bcd0ff;
  background: var(--blue-soft);
  color: #334155;
}

.form {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.2rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: #263244;
  font-weight: 800;
}

input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  padding: 0.85rem 0.9rem;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  outline: none;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.button {
  border: 1px solid var(--blue);
  border-radius: 8px;
  background: var(--blue);
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
}

.button:hover {
  filter: brightness(0.96);
}

.button.secondary,
.button.ghost {
  background: white;
  color: var(--blue);
}

.button.ghost {
  border-color: var(--line);
  color: #334155;
}

.button.compact {
  min-height: 2.2rem;
  padding: 0.4rem 0.7rem;
}

.button.danger {
  border-color: #e11d48;
  background: #e11d48;
  color: white;
}

.checklist-panel,
.panel + .panel {
  margin-top: 1rem;
}

.crud-panel {
  margin-top: 1rem;
}

.inline-form {
  grid-template-columns: minmax(12rem, 1fr) minmax(12rem, 1.4fr) auto;
  align-items: end;
  margin: 1rem 0;
}

.items {
  display: grid;
  gap: 0.75rem;
}

.item-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
}

.item-row.is-done .item-title {
  color: #64748b;
  text-decoration: line-through;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-row input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--green);
}

.item-fields {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.item-title,
.item-note {
  min-height: 2.3rem;
  padding: 0.55rem 0.7rem;
}

.item-title {
  font-weight: 800;
}

.item-meta {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
}

.item-actions {
  display: flex;
  gap: 0.5rem;
}

.empty-state {
  border: 1px dashed #b8c4d4;
  border-radius: 8px;
  color: var(--muted);
  padding: 1.2rem;
  text-align: center;
}

.error-text {
  color: #be123c;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.checklist {
  display: grid;
  gap: 0;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  display: grid;
  grid-template-columns: 1.8rem minmax(8rem, 1fr) minmax(10rem, 2fr) 4rem;
  gap: 0.9rem;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 0.95rem 0;
}

.check {
  display: inline-grid;
  width: 1.5rem;
  height: 1.5rem;
  place-items: center;
  border-radius: 999px;
  background: var(--green);
  color: white;
  font-size: 0.9rem;
  font-weight: 900;
}

.check.pending {
  background: #94a3b8;
}

.check.error {
  background: #e11d48;
}

.check-title {
  font-weight: 800;
}

.check-detail {
  color: var(--muted);
  line-height: 1.45;
}

.check-status {
  justify-self: end;
}

.log {
  min-height: 13rem;
  max-height: 22rem;
  overflow: auto;
  margin: 1rem 0 0;
  border-radius: 8px;
  background: #0b1220;
  color: #dbeafe;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.7;
  padding: 1rem;
  white-space: pre-wrap;
}

.footer {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 1.5rem 1rem 2.5rem;
  text-align: center;
}

@media (max-width: 780px) {
  .topbar,
  .intro,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions a {
    flex: 1;
    text-align: center;
  }

  .checklist li {
    grid-template-columns: 1.8rem minmax(0, 1fr) 4rem;
  }

  .check-detail {
    grid-column: 2 / -1;
  }

  .inline-form,
  .item-row {
    grid-template-columns: 1fr;
  }

  .item-actions {
    justify-content: stretch;
  }

  .item-actions .button {
    flex: 1;
  }
}
