:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #182026;
  --muted: #62717d;
  --line: #d9e0e5;
  --accent: #146b75;
  --accent-strong: #0d5259;
  --ok: #d9f2df;
  --warn: #fff1c7;
  --danger: #ffe0df;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Microsoft JhengHei", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; margin-bottom: 10px; }
p { color: var(--muted); margin-top: 4px; }

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 9px 13px;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

button.secondary {
  background: #fff;
  color: var(--accent);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.layout { display: grid; gap: 16px; padding: 18px; max-width: 1280px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.scanner { border-top: 4px solid var(--accent); }
.field { display: grid; gap: 7px; }
label { color: var(--muted); font-size: 13px; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  font: inherit;
  background: #fff;
}

#scanInput { font-size: 22px; padding: 13px 14px; }
.links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.links button { background: #fff; color: var(--accent-strong); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.items { display: grid; gap: 8px; }
.item {
  display: grid;
  grid-template-columns: minmax(86px, 130px) 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 56px;
}

.item.ok { background: var(--ok); border-color: #9bd6a8; }
.item.force { background: var(--warn); border-color: #e4c568; }
.code { font-weight: 700; }
.meta { color: var(--muted); font-size: 13px; }
.count { font-weight: 700; }
.alert {
  margin-top: 12px;
  border: 1px solid #d8ad49;
  background: var(--warn);
  padding: 12px;
  border-radius: 6px;
}
.alert.danger { background: var(--danger); border-color: #e19791; }
.hidden { display: none; }
.filters { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 12px; }
.filter-field { display: grid; gap: 6px; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; }
th { color: var(--muted); cursor: pointer; }
.settings { display: grid; gap: 10px; margin-top: 12px; }
summary { cursor: pointer; font-weight: 700; }

@media (max-width: 820px) {
  .topbar, .section-title { align-items: stretch; flex-direction: column; }
  .grid.two, .filters { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr; }
}
