:root {
  --bg: #f5f3ee;
  --card: #ffffff;
  --ink: #1b2420;
  --muted: #5d6a64;
  --line: #e0dcd2;
  --accent: #0f5c4c;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ec;
  --wait-bg: #fbefd5;
  --wait-ink: #7a5200;
  --off-bg: #ebe8e1;
  --off-ink: #5d6a64;
  --danger: #a8321f;
  --field: #ffffff;
  --shadow: 0 1px 2px rgba(27, 36, 32, .06), 0 4px 16px rgba(27, 36, 32, .05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121715;
    --card: #1b2320;
    --ink: #eef2ef;
    --muted: #9fada6;
    --line: #2d3833;
    --accent: #5fc9ae;
    --accent-ink: #06231c;
    --accent-soft: #1d3a33;
    --wait-bg: #3d3113;
    --wait-ink: #f1cf7f;
    --off-bg: #2a322f;
    --off-ink: #9fada6;
    --danger: #ff8f7a;
    --field: #141a18;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.05rem; margin: 0; }
p { margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky; top: 0; z-index: 5;
}
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30vw; }
@media (max-width: 480px) { .who { display: none; } }

.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
  width: 20px; height: 24px; border-radius: 10px 10px 3px 3px;
  background: var(--accent); position: relative; flex: none;
}
.brand-mark::after {
  content: ""; position: absolute; right: 4px; top: 12px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent-ink);
}

.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.lang button {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: .8rem; font-weight: 600; padding: 6px 9px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); }

.page { max-width: 680px; margin: 0 auto; padding: 20px 16px 64px; display: grid; gap: 16px; }
.page > * { min-width: 0; }
.page-narrow { max-width: 460px; padding-top: 24px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.page-head > div { min-width: 0; overflow-wrap: anywhere; }
.auth-top { display: flex; align-items: center; justify-content: space-between; }
.auth-head { display: grid; gap: 8px; margin-top: 8px; }
.auth-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.muted { color: var(--muted); }
.pad { padding: 16px; }
.fineprint { color: var(--muted); font-size: .85rem; }
.notice { background: var(--wait-bg); color: var(--wait-ink); padding: 10px 14px; border-radius: 10px; font-size: .95rem; }
.install {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px;
  color: var(--muted); font-size: .9rem;
}
.install[hidden] { display: none; }
.install .btn { flex: none; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; }
.noscript { padding: 24px; text-align: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.stack { display: grid; gap: 14px; }
.stack > * { min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.empty { display: grid; gap: 12px; justify-items: start; padding: 28px 20px; }
.center { justify-items: center; text-align: center; }
.tick {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 1.6rem; font-weight: 700;
}

.field { display: grid; gap: 5px; }
.field-label { font-weight: 600; font-size: .95rem; }
.field-hint { color: var(--muted); font-size: .85rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], textarea, .link-box {
  width: 100%; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 46px;
}
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.link-box { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; color: var(--muted); }
.form-error { color: var(--danger); font-weight: 600; font-size: .95rem; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  min-height: 46px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-wide { width: 100%; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-quiet { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn-small { min-height: 38px; padding: 6px 12px; font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions-quiet { gap: 6px 20px; padding-top: 4px; border-top: 1px solid var(--line); }
.link, .back {
  background: none; border: 0; padding: 8px 0; font: inherit; cursor: pointer;
  color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}
.back { text-decoration: none; font-weight: 600; justify-self: start; padding: 4px 0; }
.link-danger { color: var(--danger); }
.danger-zone { padding-top: 4px; }

.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge-ok { background: var(--accent-soft); color: var(--accent); }
.badge-wait { background: var(--wait-bg); color: var(--wait-ink); }
.badge-off { background: var(--off-bg); color: var(--off-ink); }
@media (prefers-color-scheme: light) { .badge-ok { color: #0a4a3d; } }

.search { margin-bottom: -4px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; min-height: 60px;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--accent-soft); }
.row-main { display: grid; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.details { display: grid; }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-main { display: grid; gap: 2px; min-width: 0; }
.detail-label { color: var(--muted); font-size: .85rem; }
.value { white-space: pre-wrap; overflow-wrap: anywhere; }
.value-code { font-family: ui-monospace, Consolas, monospace; font-size: 1.25rem; font-weight: 600; letter-spacing: .06em; }
.detail-actions { display: flex; gap: 6px; flex: none; }

.recovery-code {
  font-family: ui-monospace, Consolas, monospace; font-size: 1.1rem; font-weight: 600; letter-spacing: .04em;
  background: var(--accent-soft); border-radius: 10px; padding: 16px; text-align: center; overflow-wrap: anywhere;
  user-select: all;
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: .95rem; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center; z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* privacy page */
.prose { display: block; }
.prose > *, .prose div[lang] > * { margin-top: 14px; }
.prose h1 { margin-top: 28px; }
.prose h2 { margin-top: 28px; font-size: 1.15rem; }
.prose h3 { margin-top: 18px; font-size: 1rem; }
.prose ul { padding-left: 22px; display: grid; gap: 6px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0 0; }
.prose a { color: var(--accent); }
a.brand { color: inherit; text-decoration: none; }
