:root {
  --bg: #f5f6f8; --card: #fff; --text: #1b1f24; --muted: #667080; --line: #dfe3e8;
  --accent: #2f6fde; --accent-text: #fff; --danger: #c93a3a; --warn: #b4690e;
  --ok-bg: #e6f4ea; --err-bg: #fdeaea; --share-bg: #eaf1fd;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418; --card: #1a1f25; --text: #e6e9ed; --muted: #8b95a3; --line: #2b323b;
    --accent: #5a8ff0; --danger: #ef6a6a; --warn: #e3a54a;
    --ok-bg: #16301f; --err-bg: #3a1b1b; --share-bg: #172640;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 24px; margin: 8px 0 12px; }
h2 { font-size: 18px; margin: 24px 0 10px; }
.card h2 { margin-top: 0; }
.muted, small { color: var(--muted); }
.warn { color: var(--warn); }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; color: var(--text); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 12px 0; }
.narrow { max-width: 360px; margin: 10vh auto; }
summary { cursor: pointer; font-weight: 600; }

label { display: block; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
input { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--text); font: inherit; }
button { padding: 8px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
button:disabled { opacity: .6; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 12px; align-items: end; }
.grid button { margin-bottom: 10px; }
.inline { display: flex; gap: 8px; }
.inline input { margin: 0; }
.copy { display: flex; gap: 8px; margin-bottom: 10px; }
.copy input { margin: 0; }

.list { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--text); }
.row:first-child { border-top: 0; }
.row small { display: block; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.actions form, .row form { margin: 0; }

.flash { padding: 12px 14px; border-radius: 10px; margin: 12px 0; }
.flash.ok { background: var(--ok-bg); }
.flash.error { background: var(--err-bg); }
.flash.share { background: var(--share-bg); }
.flash.share label { margin: 8px 0 0; }

.qr { max-width: 320px; margin: 0 auto; background: #fff; border-radius: 8px; padding: 6px; }
.qr svg { display: block; width: 100%; height: auto; }

@media (max-width: 600px) {
  .row { flex-direction: column; align-items: stretch; }
  .actions { justify-content: flex-start; }
  .inline { flex-direction: column; }
}
[hidden] { display: none !important; }
