:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb;
  --brand: #1f6feb; --brand-ink: #fff; --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
  --ok-bg: #ecfdf3; --warn-bg: #fffbeb; --bad-bg: #fef2f2; --tag-bg: #eef2ff;
  --radius: 10px; --gap: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif; }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
h3 { font-size: 15px; margin: 12px 0 6px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; background: #1f2937; color: #fff; }
.topbar .brand { color: #fff; font-weight: 600; flex: 1; }
.topbar .who { font-size: 13px; opacity: .8; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 22px; padding: 4px 6px; cursor: pointer; }
.drawer { position: fixed; top: 52px; left: 0; bottom: 0; width: 240px; background: #fff; border-right: 1px solid var(--line); z-index: 19; padding: 8px 0; overflow-y: auto; box-shadow: 4px 0 16px rgba(0,0,0,.08); }
.drawer a { display: block; padding: 11px 20px; color: var(--ink); }
.drawer a.active { background: var(--tag-bg); color: var(--brand); font-weight: 600; }
.drawer .sep { height: 1px; background: var(--line); margin: 8px 0; }
.page { max-width: 960px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: var(--gap); }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.tile { display: flex; flex-direction: column; justify-content: center; min-height: 82px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--ink); }
.tile b { font-size: 16px; }
.tile span { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
label.f { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label.f > input, label.f > select, label.f > textarea { margin-top: 4px; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: var(--ink); }
input[type=checkbox], input[type=radio] { width: auto; margin-right: 6px; }
textarea { min-height: 90px; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; padding: 9px 16px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.danger { border-color: var(--bad); color: var(--bad); }
button.ok { border-color: var(--ok); color: var(--ok); }
button.small { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 500; background: #fafafa; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: var(--gap); }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .3px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--tag-bg); color: #3730a3; margin-right: 4px; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.notice { padding: 10px 12px; border-radius: 8px; margin: 8px 0; font-size: 14px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice ul { margin: 4px 0 0; padding-left: 18px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.seg { display: inline-flex; border: 1px solid #d1d5db; border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-left: 1px solid #d1d5db; padding: 6px 10px; font-size: 13px; }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--brand); color: #fff; }
.seg button.on.bad { background: var(--bad); }
.seg button.on.warn { background: var(--warn); }
.insp-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.insp-row .name { flex: 1 1 120px; }
.insp-row input { flex: 1 1 100%; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: .95; }
.login { max-width: 360px; margin: 48px auto; }
.empty { text-align: center; color: var(--muted); padding: 24px 0; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
@media (min-width: 900px) {
  .page { padding: 24px; }
}
@media print {
  .topbar, .drawer, .no-print, .toast { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
}
.labels { display: flex; flex-wrap: wrap; gap: 4mm; }
.label { width: 40mm; height: 30mm; border: 1px dashed #ccc; padding: 2mm; display: flex; flex-direction: column; justify-content: space-between; page-break-inside: avoid; }
.label .t { font-size: 9pt; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.label .c { font-size: 8pt; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; }
@media print { .label { border: 0; } }
