:root {
  --bg: #f4f5f7; --surface: #ffffff; --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --line: #e1e0d9; --accent: #1c5cab; --accent-ink: #ffffff; --danger: #b42318; --ok: #006300;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.topbar nav { display: flex; gap: .9rem; align-items: center; font-size: .95rem; }
.topbar nav a { text-decoration: none; }
.container { max-width: 760px; margin: 0 auto; padding: 1rem; }
.container.wide { max-width: 1100px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: .9rem 0; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.flash { padding: .7rem 1rem; border-radius: var(--radius); margin: .6rem 0; border: 1px solid; }
.flash.ok { background: #eef8ee; border-color: #bfe3bf; color: var(--ok); }
.flash.err { background: #fdeeed; border-color: #f2c2be; color: var(--danger); }
label { display: block; font-weight: 600; margin: .8rem 0 .3rem; }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; padding: .65rem .7rem; border: 1px solid #c9c8c2; border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 4.5em; }
input.code { font-size: 1.5rem; letter-spacing: .25em; text-transform: uppercase; text-align: center; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.row { display: flex; gap: .7rem; }
.row > * { flex: 1; }
.btn { display: inline-block; font: inherit; font-weight: 600; padding: .7rem 1.1rem; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; text-align: center; }
.btn.block { display: block; width: 100%; margin-top: 1rem; font-size: 1.1rem; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.sm { padding: .4rem .7rem; font-size: .9rem; font-weight: 500; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.motion { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .9rem; }
.motion:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.motion h3 { margin-top: 0; }
.motion .desc { color: var(--ink-2); white-space: pre-line; }
.choices { display: grid; gap: .5rem; margin-top: .6rem; }
.choice { display: flex; align-items: center; gap: .8rem; padding: .8rem .9rem; border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-weight: 600; margin: 0; }
.choice input { width: 1.3rem; height: 1.3rem; margin: 0; flex: none; }
.choice:has(input:checked) { border-color: var(--accent); background: #eef4fb; }
.summary { width: 100%; border-collapse: collapse; }
.summary th, .summary td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.summary th { color: var(--ink-2); font-weight: 600; width: 40%; }
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list th, table.list td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { color: var(--ink-2); font-weight: 600; background: #f7f7f5; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
.status { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.status.draft { background: #eeeeea; color: var(--ink-2); }
.status.open { background: #e3f6e3; color: var(--ok); }
.status.closed { background: #eef4fb; color: var(--accent); }
.big { font-size: 2.4rem; font-weight: 700; line-height: 1.1; }
.hero { font-size: 3rem; font-weight: 700; line-height: 1; }
.qr { max-width: 260px; margin: 0 auto; }
.qr svg { width: 100%; height: auto; display: block; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } .row { flex-direction: column; gap: 0; } }
.option-row { display: flex; gap: .5rem; align-items: center; margin: .35rem 0; }
.option-row input { flex: 1; }
.option-row .kind { flex: none; font-size: .8rem; color: var(--muted); width: 4.5rem; }
.chart-block { margin: 1rem 0 1.4rem; }
.chart-block h3 { margin: 0 0 .3rem; }
.chart-wrap { position: relative; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { background: #f0efec; border-radius: 6px; padding: .15rem .5rem; font-size: .9rem; font-variant-numeric: tabular-nums; }
.tag-time { color: var(--muted); font-size: .85rem; margin-left: .3rem; }
details summary { cursor: pointer; font-weight: 600; }
.bar-row { display: grid; grid-template-columns: 9em 1fr 7em; gap: .6rem; align-items: center; margin: .35rem 0; }
.bar-track { height: 18px; background: #f0efec; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-val { font-variant-numeric: tabular-nums; text-align: right; }

/* ---- big screen */
body.screen { background: #0d0d0d; color: #fff; }
body.screen .topbar { display: none; }
body.screen .container { max-width: none; padding: 2vh 3vw; }
.screen-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 3vw; align-items: center; min-height: 92vh; }
.screen-grid .qr { max-width: min(46vh, 90%); background: #fff; padding: 2vh; border-radius: 12px; }
.screen-title { font-size: clamp(1.4rem, 3.2vw, 3rem); font-weight: 700; margin-bottom: 2vh; }
.screen-sub { font-size: clamp(1.1rem, 2.2vw, 2rem); color: #c3c2b7; }
.screen-url { font-size: clamp(1rem, 2vw, 1.8rem); color: #fff; font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }
.screen-count { font-size: clamp(3rem, 9vw, 9rem); font-weight: 800; line-height: 1; margin-top: 3vh; font-variant-numeric: tabular-nums; }
.screen-count small { font-size: .35em; font-weight: 500; color: #c3c2b7; }
.screen-results { min-height: 92vh; }
.screen-results .chart-block { background: #1a1a19; border-radius: 12px; padding: 1.5vh 2vw; }
.screen-results h2 { font-size: clamp(1.4rem, 3vw, 2.6rem); margin: 0 0 1vh; }
.screen-results h3 { font-size: clamp(1.1rem, 2.2vw, 2rem); color: #fff; }
.screen-results .muted { color: #c3c2b7; }
.screen-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 2vw; }
@media (max-width: 800px) { .screen-grid { grid-template-columns: 1fr; min-height: 0; } }

/* ---- print (slips, report) */
.slips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.slip { border: 1px dashed #888; padding: 10px 12px; height: 62mm; break-inside: avoid; display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; }
.slip .unit { font-size: 20px; font-weight: 700; }
.slip .code { font-size: 28px; font-weight: 800; letter-spacing: .18em; font-family: ui-monospace, Menlo, Consolas, monospace; margin: 4px 0; }
.slip .note { color: #333; line-height: 1.3; }
.report h1 { font-size: 1.4rem; }
.report table.list { font-size: .9rem; }
.print-only { display: none; }
@media print {
  body { background: #fff; color: #000; font-size: 12px; }
  .topbar, .no-print, .flash { display: none !important; }
  .container { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; margin: 0 0 1rem; }
  .print-only { display: block; }
  .page-break { break-after: page; }
  .bar-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

[hidden] { display: none !important; }
