:root {
  --ink: #17283c;
  --muted: #637387;
  --line: #dfe6ee;
  --bg: #f5f7fb;
  --card: #ffffff;
  --brand: #12466e;
  --accent: #145a8a;
  --warn: #b64729;
  --done: #2f6b47;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); min-height: 100vh; background: var(--bg); }
main, .top, footer { max-width: 960px; margin: 0 auto; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 19px; margin: 0 0 6px; }
code { font-size: 14px; overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border-radius: 10px; border: 1px solid #c9d3df; padding: 11px 14px; background: #fff; color: var(--ink); font-weight: 600; min-height: 44px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.secondary { background: #fff; }
.ghost { background: transparent; border-color: transparent; color: var(--accent); }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #c9d3df; border-radius: 10px; background: #fff; color: var(--ink); min-height: 44px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid #8fbadb; outline-offset: 1px; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: #46586b; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 18px; }
.symbol { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: #fff; font-weight: 800; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; max-width: 460px; margin: 24px auto; }
.stack { display: grid; gap: 14px; }
.qr { display: block; width: 200px; height: 200px; margin: 8px auto; background: #fff; }
.message { padding: 12px 14px; border-radius: 10px; border-left: 4px solid var(--accent); background: #edf4f9; line-height: 1.5; }
.message.error { border-left-color: var(--warn); background: #fbefeb; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 8px 0 14px; }
.stats article { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stats span { display: block; font-size: 13px; color: var(--muted); }
.stats strong { display: block; font-size: 26px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.bar { display: grid; gap: 10px; margin-bottom: 14px; }

.list { display: grid; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 8px; }
.cardHead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card p { margin: 0; }
.subject { font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.mono { font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 4px 9px; border-radius: 20px; background: #eef3f6; font-size: 13px; }
.chip.warn { background: #fbe9e3; color: var(--warn); font-weight: 600; }
.chip.done { background: #e5f2ea; color: var(--done); }
.card button { justify-self: start; }
.empty { text-align: center; padding: 28px 0; }

dialog { border: 1px solid var(--line); border-radius: 18px; width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 18px; }
dialog::backdrop { background: #14273990; }
#editForm { display: grid; gap: 12px; }
#editForm p { margin: 0; }
.grid { display: grid; gap: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
textarea { resize: vertical; }
footer { margin-top: 24px; line-height: 1.5; }

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bar { grid-template-columns: 1fr 220px auto; }
  .grid { grid-template-columns: 1fr 1fr; }
}
