:root {
  --navy: #14213d; --navy-2: #1f3158; --amber: #f2a541; --amber-soft: #fdf1dc;
  --bg: #f4f5f8; --card: #fff; --ink: #1b1f2a; --muted: #6b7280; --line: #e3e6ec;
  --good: #1f8a4c; --good-soft: #e3f4ea; --warn: #b7791f; --warn-soft: #fdf3dd; --bad: #c0392b; --bad-soft: #fbe7e5;
  --info: #2563eb; --info-soft: #e6eefc;
  font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
a { color: var(--navy-2); }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; width: 100%; }
textarea { min-height: 70px; }
label { display: block; font-size: 13px; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 3px; color: var(--ink); }
.btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 14px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--navy-2); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: var(--navy); font-weight: 600; }
.btn.danger { color: var(--bad); border-color: #f0c4be; }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: 0; color: #cfd6e6; cursor: pointer; font: inherit; text-decoration: underline; }

.top { display: flex; align-items: center; gap: 24px; background: var(--navy); color: #fff; padding: 0 20px; height: 54px; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; letter-spacing: .5px; }
.brand span, .brand-lg span { color: var(--amber); font-weight: 600; margin-left: 4px; }
nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
nav a { color: #cfd6e6; text-decoration: none; padding: 16px 12px; border-bottom: 3px solid transparent; white-space: nowrap; }
nav a.on { color: #fff; border-bottom-color: var(--amber); }
.who { font-size: 13px; color: #cfd6e6; white-space: nowrap; }
.badge { background: var(--amber); color: var(--navy); border-radius: 10px; padding: 1px 7px; font-size: 12px; }
.badge:empty { display: none; }
.warnbar { background: var(--warn-soft); color: #7a4f0e; padding: 8px 20px; font-size: 13px; border-bottom: 1px solid #f1dcb0; }

main { padding: 20px; max-width: 1500px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--bad); font-size: 13px; min-height: 1em; }
.stack > * + * { margin-top: 12px; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; position: sticky; top: 54px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f8f9fc; }

.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef0f4; color: var(--muted); white-space: nowrap; }
.chip.valid { background: var(--good-soft); color: var(--good); }
.chip.expiring, .chip.pending { background: var(--warn-soft); color: var(--warn); }
.chip.expired, .chip.resubmit, .chip.retake, .chip.error { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.bar { height: 6px; background: #eceef3; border-radius: 3px; overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; }
.bar > i { display: block; height: 100%; background: var(--good); }

/* review */
.review { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.qlist { max-height: calc(100vh - 140px); overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.qitem { display: flex; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.qitem.on { border-color: var(--navy-2); box-shadow: 0 0 0 2px #d6dcec; }
.qitem img { width: 76px; height: 54px; object-fit: cover; border-radius: 4px; background: #eee; }
.qitem .t { font-weight: 600; font-size: 14px; }
.viewer { background: #2a2f3a; border-radius: 8px; display: flex; align-items: center; justify-content: center; min-height: 340px; padding: 10px; }
.viewer img { max-width: 100%; max-height: 62vh; }
.checks { background: var(--bad-soft); color: var(--bad); border-radius: 6px; padding: 8px 12px; font-size: 13px; }
.checks.ok { background: var(--good-soft); color: var(--good); }
.staff-flag { background: var(--amber-soft); color: #8a5a10; border-radius: 6px; padding: 6px 10px; font-size: 13px; }

.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; }
.item .t { font-weight: 600; margin-bottom: 4px; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); }
.login-card { width: 320px; display: flex; flex-direction: column; gap: 12px; }
.brand-lg { font-size: 20px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; }
.toast.bad { background: var(--bad); }
.modal { position: fixed; inset: 0; background: rgba(15, 20, 35, .45); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 10; overflow: auto; }
.modal-box { background: #fff; border-radius: 10px; padding: 20px; width: 560px; max-width: 100%; }

@media (max-width: 900px) {
  .review, .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 6px; }
  th { top: 0; }
}
