:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #667085;
  --border: #e4e8ef;
  --accent: #0b5cff;
  --accent-strong: #0847c4;
  --accent-soft: #e8f0ff;
  --ok: #087443;
  --ok-soft: #e6f7ee;
  --warn: #8a5a00;
  --warn-soft: #fff4d6;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --card: #121a2b;
    --text: #e6eaf2;
    --muted: #98a2b3;
    --border: #243047;
    --accent: #6f9bff;
    --accent-strong: #8fb2ff;
    --accent-soft: #17233c;
    --ok: #6ee7b7;
    --ok-soft: #122a22;
    --warn: #f5c451;
    --warn-soft: #2b2410;
    --danger: #ff8a80;
    --danger-soft: #2d1514;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 24px 16px calc(40px + env(safe-area-inset-bottom, 0px));
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

p { margin: 0; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: radial-gradient(circle at 30% 30%, #7fb0ff, var(--accent) 60%, var(--accent-strong));
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.auth-card {
  max-width: 430px;
  margin: max(8vh, 40px) auto 0;
}

.auth-card .brand { margin-bottom: 6px; }
.auth-card > .muted { margin-top: 14px; }

.stack { display: grid; gap: 14px; margin-top: 18px; }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input:disabled { opacity: 0.55; cursor: not-allowed; }

button {
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

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

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

.primary { background: var(--accent); color: #fff; }
.primary:hover:not(:disabled) { background: var(--accent-strong); }

.secondary {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
.secondary:hover:not(:disabled) { border-color: var(--accent); }

.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  padding: 7px 12px;
}

.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }

.small-btn { padding: 6px 10px; font-size: 13px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.topbar .brand { min-width: 0; }
.topbar h1 { font-size: 18px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head .small { text-align: right; }

.flow-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}
.flow-grid button { min-width: 116px; height: 42px; }

.status-line { margin-top: 12px; font-size: 13px; color: var(--muted); min-height: 20px; }
.status-line.ok { color: var(--ok); }
.status-line.warn { color: var(--warn); }

.error {
  margin-top: 10px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.result { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 16px; }

.cookie-box {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 180px;
  overflow: auto;
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
}

td.phone { font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.badge.valid { color: var(--ok); background: var(--ok-soft); }
.badge.expiring { color: var(--warn); background: var(--warn-soft); }
.badge.expired { color: var(--danger); background: var(--danger-soft); }
.badge.unknown { color: var(--muted); background: var(--bg); border: 1px solid var(--border); }

.remaining, .checked-at { font-variant-numeric: tabular-nums; white-space: nowrap; }
.checked-at { color: var(--muted); font-size: 13px; }
.check-error { color: var(--warn); font-size: 12px; }

details { max-width: 420px; }
summary { cursor: pointer; color: var(--accent); font-size: 13px; }
details .cookie-box { margin-top: 8px; }
details .copy-row { margin-top: 6px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 20;
  max-width: calc(100vw - 40px);
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  text-align: center;
  color: var(--danger);
}

.offscreen {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
}

@media (max-width: 640px) {
  .shell { padding-top: 16px; }
  .card { padding: 16px; border-radius: 14px; }
  .auth-card { margin-top: 4vh; }
  .flow-grid { grid-template-columns: 1fr; }
  .flow-grid button { width: 100%; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .section-head .small { text-align: left; }
  .topbar h1 { font-size: 17px; }
}
