:root {
  --paper: #f3f5f7;
  --panel: #ffffff;
  --ink: #15213b;
  --ink-2: #4a5570;
  --ink-3: #8a93a8;
  --line: #dde2ea;
  --blue: #2f5bea;
  --blue-soft: #e8edfd;
  --star: #f2b01e;
  --low: #c8472b;
  --low-soft: #fbe9e4;
  --ok: #1e8a5a;
  --ok-soft: #e2f3ea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(21, 33, 59, 0.06), 0 8px 24px -16px rgba(21, 33, 59, 0.25);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.4em; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }

/* ---- top bar */
.topbar {
  background: var(--ink);
  color: #fff;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.topbar .brand { font-weight: 800; color: #fff; font-size: 1.05rem; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.topbar .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--star); display: inline-block; }
.topbar nav { display: flex; gap: 4px; margin-left: 8px; }
.topbar nav a { color: rgba(255,255,255,0.82); padding: 6px 10px; border-radius: 6px; }
.topbar nav a:hover, .topbar nav a.active { background: rgba(255,255,255,0.12); color: #fff; text-decoration: none; }
.topbar .spacer { flex: 1; }
.topbar .who { color: rgba(255,255,255,0.7); font-size: 0.875rem; }
.topbar form { margin: 0; }
.topbar button { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 0.875rem; }
.topbar button:hover { background: rgba(255,255,255,0.12); }

/* ---- page */
.page { max-width: 1040px; margin: 0 auto; padding: 28px 20px 64px; }
.page.narrow { max-width: 460px; padding-top: 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--ink-2); margin: 4px 0 0; }

/* ---- panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.panel h2 { margin-bottom: 4px; }
.panel .lead { color: var(--ink-2); margin-bottom: 16px; }
.panel.danger { border-color: #f1c4b8; }

/* ---- forms */
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
label .hint { font-weight: 400; color: var(--ink-3); margin-left: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], textarea, select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(47, 91, 234, 0.35); outline-offset: 1px; }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 16px; }
.row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.inline { display: flex; gap: 10px; align-items: flex-start; }
.inline input { flex: 1; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }
input[type="color"] { width: 48px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 10px 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--blue); color: #fff; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: #f6f7f9; }
.btn.danger { background: var(--low); }
.btn.sm { padding: 6px 10px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

/* ---- flash + alerts */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; display: flex; gap: 12px; align-items: flex-start; }
.flash.ok { background: var(--ok-soft); color: #145c3c; }
.flash.err { background: var(--low-soft); color: #8a2c17; }
.flash .secret { font-family: ui-monospace, Menlo, monospace; background: #fff; padding: 2px 8px; border-radius: 5px; border: 1px solid rgba(0,0,0,0.08); user-select: all; }
.note { background: var(--blue-soft); color: #1d3aa3; padding: 10px 14px; border-radius: 8px; font-size: 0.9rem; }
.note.warn { background: #fff5d6; color: #6f4d00; }

/* ---- table / lists */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--blue-soft); color: #1d3aa3; }
.badge.low { background: var(--low-soft); color: #8a2c17; }
.badge.ok { background: var(--ok-soft); color: #145c3c; }
.badge.plain { background: #eef0f4; color: var(--ink-2); }

/* ---- stats strip */
.stats { display: flex; flex-wrap: wrap; gap: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; }
.stats > div { padding: 18px 22px; border-right: 1px solid var(--line); min-width: 150px; flex: 1; }
.stats > div:last-child { border-right: 0; }
.stats .big { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.stats .big .star { color: var(--star); font-size: 1.4rem; vertical-align: 8px; margin-left: 2px; }
.stats .lbl { color: var(--ink-2); font-size: 0.85rem; margin-top: 6px; }
.dist { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; font-size: 0.85rem; min-width: 220px; }
.dist .bar { height: 8px; background: #edf0f4; border-radius: 4px; overflow: hidden; }
.dist .bar i { display: block; height: 100%; background: var(--star); }
.dist .bar.low i { background: var(--low); }

/* ---- feedback list */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: 0.9rem; }
.tabs a.active { background: var(--ink); color: #fff; }
.tabs a:hover { text-decoration: none; background: #e6e9ef; }
.tabs a.active:hover { background: var(--ink); }
.fb { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px; display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; align-items: start; }
.fb.handled { opacity: 0.68; }
.fb .stars { color: var(--star); font-size: 1.05rem; letter-spacing: 1px; white-space: nowrap; }
.fb .stars.low { color: var(--low); }
.fb .when { color: var(--ink-3); font-size: 0.8rem; margin-top: 2px; }
.fb .comment { white-space: pre-wrap; margin: 0 0 6px; }
.fb .meta { color: var(--ink-2); font-size: 0.85rem; }
.fb .meta b { font-weight: 600; color: var(--ink); }
.fb form { margin: 0; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty strong { color: var(--ink); display: block; font-size: 1.1rem; margin-bottom: 4px; }

/* ---- link resolver + NFC */
.result { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-top: 12px; background: #fafbfc; }
.result .url { word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; background: #fff; border: 1px solid var(--line); padding: 8px 10px; border-radius: 6px; margin: 8px 0; user-select: all; }
.linkbox { display: flex; gap: 10px; align-items: center; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.linkbox code { flex: 1; word-break: break-all; }
.nfc { display: grid; grid-template-columns: 1fr 160px; gap: 20px; align-items: start; }
.nfc .qr { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; }
.nfc .qr img { width: 100%; display: block; }
.nfc-status { min-height: 24px; font-size: 0.9rem; margin-top: 10px; }
.nfc-status.ok { color: var(--ok); }
.nfc-status.err { color: var(--low); }
.steps { margin: 8px 0 0; padding-left: 20px; }
.steps li { margin-bottom: 4px; }
@media (max-width: 640px) {
  .nfc { grid-template-columns: 1fr; }
  .fb { grid-template-columns: 1fr; }
  .topbar nav { display: none; }
  .stats > div { min-width: 50%; border-bottom: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
