:root {
  color-scheme: light;
  --ink: #102033;
  --muted: #5b6b7c;
  --line: rgba(16, 32, 51, 0.1);
  --panel: #ffffff;
  --bg0: #0f2740;
  --bg1: #173552;
  --accent: #1f7a6c;
  --accent-ink: #0d3d36;
  --danger: #9b2c2c;
  --ok: #1f6b45;
  --warn: #9a6700;
  --shadow: 0 18px 40px rgba(8, 18, 32, 0.28);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--accent); }
a:hover { color: var(--accent-ink); }

img { max-width: 100%; }

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

code {
  background: #eef3f8;
  padding: 2px 6px;
  border-radius: 6px;
}

h1, h2, h3 { margin: 0 0 10px; letter-spacing: -0.02em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
p { margin: 0 0 12px; }

.muted { color: var(--muted); font-size: 13px; }
.fine { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 10px 0 0; }

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  background: #fff;
}
.brand-copy strong {
  display: block;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.brand-copy span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.7;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: #e8eef4;
  color: #334155;
  white-space: nowrap;
}
.pill-ok { background: #e3f6eb; color: var(--ok); }
.pill-warn { background: #fff4e5; color: var(--warn); }
.pill-bad { background: #fde8e8; color: var(--danger); }
.pill-muted { background: #e8eef4; color: var(--muted); }

.banner, .ok, .err, .warn, .callout {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin: 0 0 14px;
}
.ok, .banner.ok, .callout.ok { background: #e3f6eb; color: var(--ok); }
.err, .banner.err, .callout.err { background: #fde8e8; color: var(--danger); }
.warn, .callout.warn { background: #fff4e5; color: var(--warn); }

.btn, button, .btn-ghost, .btn-danger {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
}
.btn:hover, button:hover { filter: brightness(1.05); }
.btn-block { width: 100%; height: 48px; font-size: 15px; margin-top: 6px; }
.btn-ghost, button.btn-ghost { background: #e8eef4; color: var(--ink); }
.btn-danger, button.btn-danger { background: #9b2c2c; color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-row button { padding: 6px 9px; font-size: 12px; border-radius: 8px; }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d5dee7;
  border-radius: 10px;
  padding: 9px 11px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(31, 122, 108, 0.28);
  border-color: var(--accent);
}
label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #3d5164;
  margin: 0 0 6px;
}
.field { margin: 0 0 14px; }
.field input, .field select, .field textarea { width: 100%; }
.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.row > label, .row .field { flex: 1; min-width: 140px; margin: 0; }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  margin: 0 0 12px;
}
.check input { width: 16px; height: 16px; }

.section-label {
  margin: 16px 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Public checkout / login / install */
body.public {
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(31, 122, 108, 0.28), transparent 55%),
    linear-gradient(165deg, var(--bg0) 0%, var(--bg1) 100%);
  color: #fff;
}
body.public a { color: #7dcec0; }
.stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 40px;
}
.sheet {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  color: var(--ink);
  border-radius: 20px;
  padding: 28px 26px 24px;
  box-shadow: var(--shadow);
}
.sheet.wide { max-width: 640px; }
.sheet .brand-lockup { margin-bottom: 18px; }
.sheet .brand-copy span { color: var(--muted); opacity: 1; }
.sheet h1 { margin-bottom: 4px; }
.lead { color: var(--muted); font-size: 14px; margin-bottom: 16px; }

.id-panel {
  background: linear-gradient(165deg, #102033, #173552);
  color: #fff;
  border-radius: 16px;
  padding: 18px 16px 16px;
  text-align: center;
  margin: 0 0 16px;
}
.id-panel .id-k {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #cfe0ef;
}
.id-panel .id-v {
  display: block;
  margin-top: 4px;
  font-size: 40px;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.id-panel .id-code {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(207, 224, 239, 0.8);
  word-break: break-all;
}

.plans {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}
.plan {
  position: relative;
  margin: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 10px;
  border: 1.5px solid #dbe4ee;
  border-radius: 14px;
  background: #f7fafc;
  font-weight: 700;
  color: var(--ink);
}
.plan input { position: absolute; opacity: 0; pointer-events: none; }
.plan-n { font-size: 13px; }
.plan-p { font-size: 15px; color: var(--accent-ink); }
.plan:hover { border-color: #b7c9d8; }
.plan:has(input:checked),
.plan.is-on {
  border-color: var(--accent);
  background: #e7f6f2;
  box-shadow: 0 0 0 3px rgba(31, 122, 108, 0.12);
}
.plan.plan-sub {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
}
.plan.plan-sub .plan-p { margin-left: auto; }

.result-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 28px;
  margin-bottom: 14px;
  background: #e3f6eb;
}
.result-icon.wait { background: #fff4e5; }

.steps { padding-left: 18px; color: #334155; }
.steps li { margin: 0 0 8px; }

.wait-copy { text-align: center; padding: 40px 20px; color: #cfe0ef; }

/* Admin */
body.admin {
  background: #e8eef4;
  color: var(--ink);
}
.topbar {
  background: #102033;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(16, 32, 51, 0.18);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  min-height: 64px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.topbar .brand-lockup { color: #fff; }
.topbar .brand-copy span { color: #cfe0ef; opacity: 1; }
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.nav a {
  color: #cfe0ef;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  padding: 7px 11px;
  border-radius: 8px;
}
.nav a:hover, .nav a.on {
  color: #fff;
  background: rgba(31, 122, 108, 0.38);
}
.nav .out {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.08);
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 16px 48px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}
.page-head h1 { margin: 0; font-size: 22px; }
.page-head p { margin: 4px 0 0; max-width: 720px; }

.card {
  background: #fff;
  border-radius: 16px;
  padding: 18px 18px 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(16, 32, 51, 0.05);
  border: 1px solid rgba(16, 32, 51, 0.05);
}
.card h2 { font-size: 15px; }
.card + .card h2 { margin-top: 2px; }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin: 0 0 14px;
}
.toolbar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}
.toolbar input { min-width: 220px; }

.scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #e8eef4;
  vertical-align: top;
}
th {
  color: #5b6b7c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
tr:hover td { background: #f7fafc; }
.id-cell strong { font-variant-numeric: tabular-nums; font-size: 15px; }
.note-form { display: flex; gap: 6px; }
.note-form input { flex: 1; min-width: 90px; padding: 7px 9px; }
.note-form button { padding: 7px 10px; }

.preview {
  max-width: 360px;
  border-radius: 10px;
  display: block;
  margin-top: 10px;
  border: 1px solid var(--line);
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.endpoint {
  display: block;
  margin: 0 0 8px;
  padding: 8px 10px;
  background: #f4f7fb;
  border-radius: 8px;
  word-break: break-all;
}
details.raw { margin-top: 6px; }
.env-cell { min-width: 220px; max-width: 420px; }
.env-cell .muted { margin-top: 4px; font-size: 12px; line-height: 1.4; }
details.raw pre {
  white-space: pre-wrap;
  max-width: 480px;
  font-size: 11px;
  background: #f4f7fb;
  padding: 8px;
  border-radius: 8px;
}

.inline { display: inline; }

@media (max-width: 720px) {
  .plans { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .sheet { padding: 22px 18px; }
  .id-panel .id-v { font-size: 32px; }
  .nav .out { margin-left: 0; }
}
