:root {
  --bg: #f3f5f8;
  --side: #f6f7f9;
  --sheet: #ffffff;
  --ink: #2f3844;
  --muted: #6b7280;
  --line: #e6e8ee;
  --blue: #1a8cff;
  --blue-deep: #0b74db;
  --pine: #0f7a4a;
  --brass: #b45309;
  --sans: "Noto Sans TC", "PingFang HK", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
}
button, input, select { font-family: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.hidden { display: none !important; }

.app { display: flex; min-height: 100vh; }
.side {
  width: 232px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 10px 8px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.side::-webkit-scrollbar { width: 8px; }
.side::-webkit-scrollbar-thumb { background: #d5d8de; border-radius: 99px; }
.side-nav { display: flex; flex-direction: column; }
#desk-nav {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
}
.side-foot { margin-top: auto; padding-top: 8px; }

.nav-item, .tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: auto;
  margin: 2px 4px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4a5568;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  text-align: left;
}
.nav-item svg, .tab svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover, .tab:hover { background: #e8eaee; }
.nav-item.is-current,
.tab[aria-selected="true"] {
  background: var(--blue);
  color: #fff;
}
.nav-item.is-current:hover,
.tab[aria-selected="true"]:hover { background: var(--blue-deep); }

.workspace { flex: 1; min-width: 0; background: var(--bg); }
.lobby, .desk { padding: 28px 32px 48px; }
.sheet {
  width: min(1040px, 100%);
  margin: 0;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 32px 24px;
}
.login-sheet { width: min(480px, 100%); }

.kicker {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
h1, h2, h3 { font-weight: 700; }
h1 { font-size: 28px; line-height: 1.3; margin: 0 0 10px; }
.lede { max-width: 68ch; color: var(--muted); font-size: 15px; line-height: 1.7; margin: 0 0 18px; }

.callout {
  background: #eef6ff;
  border-radius: 8px;
  padding: 12px 14px;
  color: #1e4b7a;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 22px;
}

.guides { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.guide {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
  padding: 18px 18px 16px;
}
.guide h2 { margin: 0 0 6px; font-size: 20px; }
.guide .tag { color: var(--blue-deep); font-size: 12px; font-weight: 700; }
.steps { margin: 12px 0 16px; padding-left: 18px; }
.steps li { margin: 6px 0; line-height: 1.55; }
.qrs { display: flex; gap: 14px; flex-wrap: wrap; }
.qr {
  display: block;
  width: 148px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 8px 10px;
  text-align: center;
  color: inherit;
  text-decoration: none;
}
a.qr:hover { border-color: var(--blue); }
.qr svg { width: 132px; height: 132px; display: block; pointer-events: none; }
.qr span { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.qr a { color: var(--blue-deep); text-decoration: none; font-size: 12px; }

.desk-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.desk-head h1 { font-size: 26px; }
.linkish {
  background: none;
  border: 0;
  color: var(--blue-deep);
  padding: 0;
  text-decoration: none;
  font-size: 14px;
}

.form-block { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.form-block h3 { margin: 0 0 4px; font-size: 16px; }
.req { color: #c24141; font-size: 12px; font-weight: 700; margin-left: 4px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; line-height: 1.5; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
label.field.wide { grid-column: 1 / -1; }
.store-multi { display: flex; flex-direction: column; gap: 8px; }
.store-chosen { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.store-options {
  max-height: 220px;
  overflow: auto;
  border: 1px solid #d5d9e0;
  border-radius: 8px;
  background: white;
}
.store-option {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.store-option:last-child { border-bottom: 0; }
.store-option input { margin-top: 3px; }
input, select {
  background: white;
  border: 1px solid #d5d9e0;
  border-radius: 8px;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 15px;
}
input:focus, select:focus { border-color: var(--blue); outline: none; }
.checks { display: grid; gap: 8px; }
.choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.choice-row .check:has(input:checked) { border-color: var(--blue); background: #eef6ff; }
#hik-fields { margin-top: 16px; }
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px 12px;
}
.check input { margin-top: 3px; }
.check b { display: block; }
.check span { color: var(--muted); font-size: 13px; }
.confirm { margin-top: 8px; }
.captcha-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.captcha-code {
  min-width: 132px;
  padding: 8px 12px 8px 16px;
  border: 1px dashed #b9c6d6;
  border-radius: 8px;
  background:
    repeating-linear-gradient(-18deg, transparent, transparent 6px, rgba(37, 99, 235, 0.07) 6px, rgba(37, 99, 235, 0.07) 7px),
    #f4f7fb;
  color: #1d4f91;
  font-family: Consolas, "Courier New", monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.28em;
  line-height: 1.2;
  text-align: center;
  user-select: none;
}
.captcha-field { flex: 1; min-width: 180px; }
.captcha-row .ghost { height: 42px; }
.errors {
  background: #fdecec;
  border: 1px solid #f3c3c3;
  border-radius: 8px;
  color: #9b1c1c;
  padding: 10px 12px;
  margin: 0 0 12px;
}
.errors ul { margin: 6px 0 0; padding-left: 18px; }
.actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.actions.start { justify-content: flex-start; align-items: center; gap: 16px; }
.login-form { display: grid; gap: 12px; margin-top: 16px; }
.login-form .actions { margin-top: 4px; }
.primary, .ghost {
  border-radius: 8px;
}
.primary {
  background: var(--blue);
  color: white;
  border: 0;
  padding: 11px 18px;
  font-size: 15px;
}
.primary:hover { background: var(--blue-deep); }
.ghost {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 12px;
}
.receipt {
  margin-top: 16px;
  border: 1px solid #c9e6d6;
  border-radius: 8px;
  background: #eef8f2;
  padding: 12px 14px;
}
.record-list { margin: 18px 0 0; padding: 0; list-style: none; max-height: 520px; overflow: auto; }
.record-list li {
  border-top: 1px solid var(--line);
  padding: 10px 0;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.record-list li span:first-child { min-width: 0; word-break: break-word; }
.record-list .bind { display: flex; align-items: center; gap: 8px; flex: none; }
.record-list .bind select { width: auto; min-width: 108px; padding: 6px 8px; }
.record-list .store-lines { display: block; margin-top: 6px; }
.record-list .store-lines span { display: block; line-height: 1.45; }
.record-list .acct {
  background: #ffe566;
  color: #1a1a1a;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 6px;
}
.badge {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  height: fit-content;
  white-space: nowrap;
}
.badge.done { color: var(--pine); border-color: #b7e0cb; background: #e7f6ee; }
.badge.wait { color: var(--brass); border-color: #f3d7a8; background: #fff6e8; }
.badge.left { color: var(--muted); border-color: var(--line); background: #f3f4f6; }
.empty { color: var(--muted); padding: 12px 0 4px; }

@media (max-width: 800px) {
  .app { flex-direction: column; }
  .side {
    width: 100%;
    height: auto;
    position: sticky;
    z-index: 5;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px;
  }
  .side-nav { flex-direction: row; overflow-x: auto; }
  #desk-nav { border-top: 0; margin-top: 0; padding-top: 0; }
  .side-foot { margin-top: 0; padding-top: 0; }
  .nav-item, .tab { white-space: nowrap; }
  .lobby, .desk { padding: 16px 14px 32px; }
  .sheet { padding: 18px 16px; }
  .guides, .grid, .choice-row { grid-template-columns: 1fr; }
  .desk-head { flex-direction: column; align-items: flex-start; }
  .record-list li { flex-direction: column; }
}
