/* 後台：簡潔中性、手機可用 */
:root {
  --bg: #f4f5f7; --card: #fff; --line: #d9dce1; --text: #1f2933; --muted: #66707d; --primary: #2b5fb4; --primary-d: #1e4688;
  --ok: #1f7a4d; --warn: #b36b00; --danger: #c0302b; --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif; }
a { color: var(--primary); }
.top { position: sticky; top: 0; z-index: 10; background: #1f2933; color: #fff; display: flex; align-items: center; gap: 12px; padding: 8px 14px; flex-wrap: wrap; }
.brand { font-weight: 800; }
nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; min-width: 0; }
nav a { color: #cfd6df; text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
nav a.on { background: #3a4756; color: #fff; }
.who { font-size: 13px; color: #cfd6df; white-space: nowrap; }
.main { max-width: 1040px; margin: 0 auto; padding: 14px; }
h1 { font-size: 24px; margin: 6px 0 12px; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { margin: 0 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.err-card { border-color: var(--danger); color: var(--danger); }
.muted { color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 10px; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.field { margin-bottom: 12px; }
.field > label, label.l { display: block; font-weight: 700; margin-bottom: 4px; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 2px; }
.err { color: var(--danger); font-size: 14px; }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=datetime-local], input[type=password], input[type=email], select, textarea {
  width: 100%; font: inherit; padding: 9px 10px; border: 1px solid #b9bfc8; border-radius: 8px; background: #fff; color: var(--text); min-height: 42px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.check { display: inline-flex; align-items: center; gap: 8px; margin-right: 14px; min-height: 36px; cursor: pointer; }
.check input { width: 20px; height: 20px; }
.btn { font: inherit; border: 1px solid #b9bfc8; background: #fff; color: var(--text); border-radius: 8px; padding: 8px 14px; min-height: 42px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { min-height: 34px; padding: 4px 10px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 13px; background: #e6e9ee; color: #3d4752; white-space: nowrap; }
.badge.ok { background: #d9f0e4; color: var(--ok); } .badge.warn { background: #fdebd0; color: var(--warn); } .badge.danger { background: #fadbd9; color: var(--danger); } .badge.muted { background: #eceff3; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.scroll { overflow-x: auto; }
.row select, .row input[type=number], .row input[type=date] { width: auto; }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs button { font: inherit; border: 0; background: none; padding: 10px 14px; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; color: var(--muted); }
.tabs button.on { color: var(--primary); border-color: var(--primary); font-weight: 700; }
.counted { position: relative; }
.counted .count { position: absolute; right: 8px; bottom: 6px; font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, .85); padding: 0 4px; border-radius: 4px; pointer-events: none; }
.counted .count.over { color: var(--danger); font-weight: 700; }
.counted input, .counted textarea { padding-right: 52px; }
.savebar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 14px; margin: 0 -14px -14px; display: flex; gap: 8px; justify-content: flex-end; align-items: center; border-radius: 0 0 var(--radius) var(--radius); }
.toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(92vw, 420px); }
.toast { background: #1f2933; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.toast.err { background: var(--danger); }
.dialog-bg { position: fixed; inset: 0; background: rgba(15, 20, 28, .55); display: flex; align-items: center; justify-content: center; padding: 14px; z-index: 60; }
.dialog { background: #fff; border-radius: 12px; padding: 18px; width: min(100%, 520px); max-height: 90vh; overflow: auto; }
.prob { font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: #e6e9ee; border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--primary); }
.list-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.preview { background: #fbf7ee; border: 1px dashed #d9c9a3; border-radius: 8px; padding: 10px; white-space: pre-wrap; font-size: 14px; max-height: 260px; overflow: auto; }
.preview mark { background: #ffe08a; }
.problems li { margin: 4px 0; }
.ok-text { color: var(--ok); font-weight: 700; }
.prize-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; background: #fcfcfd; }
.prize-card.arch { opacity: .6; }
@media (max-width: 640px) {
  .top nav { order: 3; flex-basis: 100%; }
  .who { margin-left: auto; }
  .main { padding: 10px; }
  th, td { padding: 6px 5px; font-size: 13px; }
  .card { padding: 12px; }
}
