:root {
  --ink: #17201c; --muted: #56605b; --line: #e2e6e4; --bg: #f4f6f5; --card: #fff;
  --accent: #12704a; --accent-ink: #fff;
  --ok: #12704a; --ok-bg: #e3f3ea; --warn: #8a5300; --warn-bg: #fcf0d9; --bad: #b42318; --bad-bg: #fde7e5;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--ink); background: var(--bg); }
[hidden] { display: none !important; }
h1 { font-size: 20px; margin: 10px 0 18px; font-weight: 650; }
h2 { font-size: 16px; margin: 0; font-weight: 650; }
h3 { font-size: 14px; margin: 20px 0 8px; font-weight: 650; }
.muted { color: var(--muted); margin: 4px 0 12px; }
label { display: block; font-weight: 600; margin: 10px 0 6px; }
input { width: 100%; padding: 10px 12px; border: 1px solid #c6ccc9; border-radius: 8px; font: inherit; font-size: 16px; background: #fff; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
code { font: 13px ui-monospace, Consolas, monospace; background: #eef1ef; padding: 2px 5px; border-radius: 4px; word-break: break-all; }
a { color: var(--accent); }

.btn { border: 0; border-radius: 8px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; background: var(--accent); color: var(--accent-ink); white-space: nowrap; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #c6ccc9; font-weight: 500; }
.btn.wide { width: 100%; margin-top: 12px; padding: 11px; }
.btn.danger { background: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--muted); margin-top: 10px; cursor: pointer; font: inherit; text-decoration: underline; }
.err { color: var(--bad); margin: 10px 0 0; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-box { width: 100%; max-width: 380px; background: var(--card); padding: 28px 24px; border-radius: 12px; }
.qr { width: 220px; margin: 8px auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.qr svg { display: block; width: 100%; height: auto; }
.secret { font-size: 13px; color: var(--muted); }

/* app frame */
.top { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.tabs { display: flex; gap: 4px; height: 100%; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 0 12px; font: inherit; color: var(--muted); cursor: pointer; height: 100%; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
main { padding: 20px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
.card { background: var(--card); border-radius: 12px; padding: 18px 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #eef1ef; color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--bad-bg); color: var(--bad); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions.end { justify-content: flex-end; }
.linkbox { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.linkbox .row { margin-top: 10px; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.steps { padding-left: 20px; } .steps li { margin: 4px 0; }
.code-big { font: 650 28px/1.2 "Segoe UI", sans-serif; letter-spacing: 6px; text-align: center; padding: 12px; background: var(--bg); border-radius: 8px; margin-top: 10px; user-select: all; }

.list { list-style: none; padding: 0; margin: 8px 0 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .meta { color: var(--muted); font-size: 13px; }
.list .grow { min-width: 0; flex: 1; }
.list.log li { display: block; }
.list.log .meta { display: block; }
.badge { font-size: 12px; font-weight: 600; color: var(--ok); }
.empty { color: var(--muted); padding: 10px 0; }

dialog { border: 0; border-radius: 12px; padding: 20px; width: min(380px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0,0,0,.18); }
dialog p { margin: 0 0 12px; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 8px; z-index: 20; max-width: calc(100vw - 32px); }

.bottom { display: none; }
@media (max-width: 760px) {
  .tabs { display: none; }
  .top { padding: 0 16px; }
  main { padding: 14px 12px 90px; }
  .grid2 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .bottom { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
  .bottom button { flex: 1; background: none; border: 0; padding: 12px 4px; font: inherit; font-size: 13px; color: var(--muted); }
  .bottom button.on { color: var(--accent); font-weight: 650; }
}
