:root {
  --bg: #f6f7f5;
  --surface: #fff;
  --text: #1c2420;
  --muted: #667069;
  --line: #dde2dd;
  --accent: #2f6f4f;
  --accent-text: #fff;
  --danger: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a17;
    --surface: #1d2521;
    --text: #e8ece9;
    --muted: #93a099;
    --line: #2c3731;
    --accent: #5fb88a;
    --accent-text: #0e1612;
    --danger: #f2877f;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
  max-width: 640px;
  margin-inline: auto;
}
header { display: flex; gap: 8px; align-items: center; padding: 12px 0; position: sticky; top: 0; background: var(--bg); }
nav { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
nav button, header > button {
  font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; white-space: nowrap; min-height: 40px;
}
nav button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
header > button { width: 40px; padding: 0; font-size: 20px; }
header > button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
#refresh.loading { opacity: .5; }
#status { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 15px; }
#status.error { color: var(--danger); border-color: var(--danger); }
h2 { font-size: 1.35rem; margin: 8px 0 12px; }
p { margin: 0 0 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.stat { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.stat .label { color: var(--muted); }
.stat .value { font-size: 1.8rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.checklist { list-style: none; margin: 0 0 12px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.checklist li + li { border-top: 1px solid var(--line); }
.checklist label { display: flex; gap: 14px; align-items: center; padding: 14px 16px; cursor: pointer; min-height: 52px; }
.checklist input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.checklist .done span { text-decoration: line-through; color: var(--muted); }
@media (hover: hover) { .checklist .delete { opacity: .35; } .checklist li:hover .delete, .checklist .delete:focus-visible { opacity: 1; } }
.checklist li { display: flex; align-items: center; }
.checklist label { flex: 1; min-width: 0; }
.checklist .delete { font: inherit; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 16px; align-self: stretch; }
.checklist .delete:hover { color: var(--danger); }
.checklist .grip { font: inherit; font-size: 1.2rem; background: none; border: 0; color: var(--muted); cursor: grab; padding: 0 4px 0 14px; align-self: stretch; touch-action: none; user-select: none; -webkit-user-select: none; }
.checklist .grip:active { cursor: grabbing; }
.checklist li.sortable label { padding-left: 8px; }
.checklist li { transition: transform .15s ease; }
.checklist li.dragging { transition: none; position: relative; z-index: 2; background: var(--surface); opacity: .75; box-shadow: 0 8px 24px rgb(0 0 0 / .28); border-radius: 12px; }
.checklist.settling li { transition: none; }
.checklist.is-dragging { overflow: visible; touch-action: none; }
.checklist.is-dragging li:not(.dragging) { pointer-events: none; }
.input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.input-row input { flex: 1; min-width: 0; font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); }
.input-row button { font: inherit; font-size: 1.4rem; line-height: 1; width: 52px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-text); cursor: pointer; }
.input-row button:disabled { opacity: .5; }
.unknown { color: var(--muted); font-style: italic; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
#login { display: grid; gap: 12px; padding-top: 48px; }
#login h1 { margin: 0; font-size: 1.5rem; }
#login p { color: var(--muted); margin: 0; }
#login input, #login button { font: inherit; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
#login button { background: var(--accent); border-color: var(--accent); color: var(--accent-text); cursor: pointer; font-weight: 600; }
h2 + .hint { color: var(--muted); }
.card { padding: 14px 16px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.card.new { border-color: var(--accent); }
.card .name { font-weight: 600; }
.card .meta { color: var(--muted); font-size: 15px; margin: 2px 0 0; }
.card .meta.revoked, .card .meta.expired { color: var(--danger); }
.card code { display: block; margin: 8px 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font: 14px/1.4 ui-monospace, monospace; overflow-wrap: anywhere; user-select: all; }
.card button { font: inherit; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; min-height: 40px; }
.card button.danger { color: var(--danger); border-color: var(--danger); }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
[hidden] { display: none !important; }
