:root {
  --bg: #f3f6fb; --surface: #ffffff; --surface2: #eef2f9; --text: #172033; --muted: #66728a; --border: #dbe2ee;
  --primary: #0b57d0; --primary-ink: #ffffff; --accent: #00a37a; --danger: #c62828; --ok: #2e7d32; --warn: #b26a00;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.05);
  --maxw: 1500px; --gut: clamp(12px, 2.6vw, 40px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1522; --surface: #172033; --surface2: #1d2940; --text: #e6ebf5; --muted: #93a0b8; --border: #2a3855;
    --primary: #7aa7ff; --primary-ink: #0b1220; --accent: #2bd1a2; --danger: #ff6b6b; --ok: #6fd07a; --warn: #f0b255; --shadow: 0 1px 2px rgba(0,0,0,.4); }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 6px; line-height: 1.25; } h2 { font-size: 16px; margin: 0 0 10px; } h3 { font-size: 14px; margin: 14px 0 8px; }
.boot, .empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .right { text-align: right; } .err { color: var(--danger); } .ok { color: var(--ok); } .warn { color: var(--warn); }

.top { background: var(--surface); border-bottom: 1px solid var(--border); border-top: 3px solid var(--accent); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gut); display: flex; align-items: center; gap: 14px; min-height: 52px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); display: flex; align-items: center; gap: 9px; } .brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; display: block; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); padding: 8px 11px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: var(--surface2); text-decoration: none; } .nav a.on { color: var(--primary); background: var(--surface2); }
.me { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; } .me b { color: var(--text); }
main { max-width: var(--maxw); margin: 0 auto; padding: 20px var(--gut) 80px; }
.banner { background: #fff4d6; color: #6b4600; border-bottom: 1px solid #f1dc9b; padding: 8px var(--gut); font-size: 14px; text-align: center; }
@media (prefers-color-scheme: dark) { .banner { background: #43371a; color: #f0c870; border-color: #6b5724; } }

button, .btn { font: inherit; cursor: pointer; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; justify-content: center; }
button:hover, .btn:hover { background: var(--surface2); text-decoration: none; }
button.primary, .btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; } button.primary:hover, .btn.primary:hover { filter: brightness(1.08); background: var(--primary); }
button.danger { color: var(--danger); } button.sm { padding: 4px 10px; font-size: 13px; } button.big { padding: 14px 22px; font-size: 17px; border-radius: 12px; } button:disabled { opacity: .55; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
textarea { min-height: 80px; resize: vertical; } input[type=checkbox], input[type=radio] { width: auto; }
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 4px; color: var(--muted); }
.field { margin-bottom: 13px; } .row { display: flex; gap: 12px; flex-wrap: wrap; } .row > * { flex: 1 1 170px; min-width: 0; }
.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; color: var(--text); font-size: 14px; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 14px; }
.auth .card { width: 100%; max-width: 440px; margin: 0; }
.auth .logo { text-align: center; margin-bottom: 16px; font-size: 26px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px; } .auth .logo img { width: 44px; height: 44px; border-radius: 11px; }
.auth .tagline { text-align: center; color: var(--muted); margin: -8px 0 18px; }

.hero { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; margin-bottom: 16px; }
.hero .scanbtn { flex: 1 1 280px; background: var(--primary); color: var(--primary-ink); border-radius: var(--radius); padding: 22px; font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 12px; border: 0; cursor: pointer; box-shadow: var(--shadow); }
.hero .scanbtn:hover { filter: brightness(1.07); text-decoration: none; }
.stats { flex: 2 1 380px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat b { font-size: 22px; display: block; line-height: 1.2; } .stat span { color: var(--muted); font-size: 13px; }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; } .filters > * { flex: 1 1 140px; min-width: 0; } .filters .grow { flex: 2 1 220px; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; } th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; } tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface2); } .num { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; } td .sub { color: var(--muted); font-size: 12.5px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.st-processing { background: #fff4d6; color: #8a5a00; border-color: #f1dc9b; } .st-review { background: #e8f0ff; color: #1d4ed8; border-color: #c7d8fb; } .st-confirmed { background: #e3f5e6; color: #1f6b2c; border-color: #b9e0c0; }
@media (prefers-color-scheme: dark) { .st-processing { background: #43371a; color: #f0c870; border-color: #6b5724; } .st-review { background: #1c2c55; color: #9db9ff; border-color: #2d4380; } .st-confirmed { background: #1b3a22; color: #86d492; border-color: #2c5b36; } }
@media (max-width: 760px) { .hide-sm { display: none; } th.hide-sm, td.hide-sm { display: none; } }

.cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } .me .who { display: none; } }
.preview { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; position: sticky; top: 64px; text-align: center; }
.preview img { max-width: 100%; max-height: 80vh; border-radius: 6px; }
.preview iframe { width: 100%; height: 78vh; border: 0; border-radius: 6px; background: #fff; }
.notice { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.notice.info { background: #e8f0ff; border-color: #c7d8fb; color: #1d3f9a; } .notice.warn { background: #fff4d6; border-color: #f1dc9b; color: #6b4600; } .notice.bad { background: #fde4e4; border-color: #f5b7b7; color: #8a1c1c; } .notice.good { background: #e3f5e6; border-color: #b9e0c0; color: #1f6b2c; }
@media (prefers-color-scheme: dark) { .notice.info { background: #1c2c55; border-color: #2d4380; color: #b9ccff; } .notice.warn { background: #43371a; border-color: #6b5724; color: #f0c870; } .notice.bad { background: #4a1f1f; border-color: #773030; color: #ffb0b0; } .notice.good { background: #1b3a22; border-color: #2c5b36; color: #a5e5ae; } }
.spin { display: inline-block; width: 16px; height: 16px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -3px; margin-right: 8px; } @keyframes sp { to { transform: rotate(360deg); } }
.pages { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; } .pg { position: relative; width: 96px; height: 128px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface2); }
.pg img { width: 100%; height: 100%; object-fit: cover; } .pg button { position: absolute; top: 3px; right: 3px; padding: 0; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; border: 0; }
.pg i { position: absolute; left: 4px; bottom: 3px; font-style: normal; background: rgba(0,0,0,.6); color: #fff; border-radius: 6px; padding: 0 6px; font-size: 12px; }
.pickers { display: flex; gap: 10px; flex-wrap: wrap; } .pickers label.btn { margin: 0; color: var(--text); font-size: 15px; } .pickers label.btn.primary { color: var(--primary-ink); }
input[type=file].hid { display: none; }
.radios { display: grid; gap: 8px; } .radio { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 9px; padding: 9px 12px; cursor: pointer; font-weight: 500; color: var(--text); font-size: 14px; margin: 0; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 10px; font-size: 14px; margin: 0; } .dl dt { color: var(--muted); } .dl dd { margin: 0; overflow-wrap: anywhere; }
.prose { max-width: 800px; } .prose h2 { margin-top: 22px; } .prose p, .prose li { color: var(--text); }
.link { background: none; border: 0; color: var(--primary); padding: 0; font-weight: 500; text-decoration: underline; cursor: pointer; display: inline; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#toast div { background: #172033; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.3); } #toast div.bad { background: #b71c1c; }

@media (max-width: 640px) { .top-in { gap: 6px 10px; padding-top: 6px; padding-bottom: 6px; } .nav { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; } .nav a { white-space: nowrap; padding: 7px 10px; } .me { margin-left: auto; } }
