:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1d2330; --muted: #667085; --line: #e3e6eb;
  --accent: #1f5fae; --accent-ink: #ffffff; --good: #1f7a4d; --warn: #a15c00; --bad: #b42318;
  --bar: #3b78c4; --bar2: #9db8db; --soft: #eef3fa;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --surface: #1c2027; --text: #e7e9ed; --muted: #98a2b3; --line: #2e333d;
    --accent: #6ea4e8; --accent-ink: #0d1117; --good: #4cc38a; --warn: #f0a842; --bad: #f97066;
    --bar: #6ea4e8; --bar2: #3a5577; --soft: #222a36;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif; }
a { color: var(--accent); }
.top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 17px;
  display: inline-flex; align-items: center; gap: 8px; }
.brand img { display: block; }
.mascot { display: block; margin: 0 auto 8px; width: 112px; height: 112px; }
#nav { display: flex; gap: 14px; margin-left: auto; align-items: center; flex-wrap: wrap; }
#nav a, #nav button { font-size: 14px; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px;
  margin-bottom: 16px; }
.narrow { max-width: 420px; margin: 40px auto; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--text); font: inherit; }
input[type=checkbox] { width: auto; }
button, .btn { display: inline-block; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: inherit; cursor: pointer; text-decoration: none; }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--soft); }
.badge.good { color: var(--good); } .badge.warn { color: var(--warn); } .badge.bad { color: var(--bad); }
.error { color: var(--bad); margin-top: 8px; white-space: pre-wrap; }
.note { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 8px 0 14px; flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--muted); border: none; border-bottom: 2px solid transparent;
  border-radius: 0; padding: 8px 12px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.progress { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.progress > div { height: 100%; background: var(--accent); width: 30%; animation: slide 1.2s infinite linear; }
@keyframes slide { from { margin-left: -30%; } to { margin-left: 100%; } }
svg.chart text { fill: var(--muted); font-size: 11px; }
svg.chart .bar { fill: var(--bar); } svg.chart .bar2 { fill: var(--bar2); }
svg.chart .grid { stroke: var(--line); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: 4px 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.legend i.sw1 { background: var(--bar); } .legend i.sw2 { background: var(--bar2); }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text);
  color: var(--bg); padding: 8px 16px; border-radius: 6px; display: none; z-index: 10; max-width: 90vw; }
.copy { display: flex; gap: 8px; } .copy input { flex: 1; }
canvas.pallet3d { display: block; width: 100%; height: 440px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--soft); touch-action: none; cursor: grab; }
canvas.pallet3d:active { cursor: grabbing; }
.pallet-controls { margin-bottom: 10px; }
.pallet-controls input[type=range] { padding: 0; }
svg.pallet-top { width: 100%; max-width: 460px; display: block; }
svg.pallet-top .pt-pallet { fill: #a77b4f; opacity: .35; stroke: #7a5532; stroke-width: 4; }
svg.pallet-top .pt-case { fill: #d6b076; stroke: #5a3c19; stroke-width: 3; }
svg.pallet-top .pt-case2 { fill: #b8d0ea; stroke: #2c4a6e; stroke-width: 3; }
svg.pallet-top .pt-label { fill: #222; font-size: 34px; }
svg.pallet-top .pt-dim { fill: var(--muted); font-size: 30px; }
@media (max-width: 640px) { canvas.pallet3d { height: 320px; } }
@media (max-width: 640px) { main { padding: 14px 16px 40px; } .tile .v { font-size: 20px; } }
