:root {
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --surface: #f1f5f9;
  --card: #ffffff;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-soft: #ccfbf1;
  --accent-ink: #115e59;
  --warn: #c2410c;
  --warn-soft: #ffedd5;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --ok: #047857;
  --ok-soft: #d1fae5;
  --info: #0369a1;
  --info-soft: #e0f2fe;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", sans-serif;
  --mono: "IBM Plex Sans", ui-monospace, monospace;
  --sidebar-w: 248px;
  --bottom-h: 64px;
  --top-h: 72px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}
button, input, select, textarea { font: inherit; color: inherit; max-width: 100%; }
img, video, svg, canvas { max-width: 100%; height: auto; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* —— Brand —— */
.brand-mark {
  width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #14b8a6, #0f766e);
  color: #fff; font-weight: 700; letter-spacing: .04em;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .35);
}
.brand-mark.sm { width: 36px; height: 36px; border-radius: 9px; font-size: 12px; box-shadow: none; }
.brand-name { font-weight: 700; letter-spacing: .02em; }
.brand-tag { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* —— Auth —— */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--surface);
}
.auth-shell-simple { grid-template-columns: 1fr; place-items: center; padding: 24px; }
.auth-visual {
  background:
    radial-gradient(800px 500px at 20% 10%, rgba(20, 184, 166, .22), transparent 60%),
    radial-gradient(600px 400px at 80% 80%, rgba(14, 165, 233, .12), transparent 55%),
    linear-gradient(160deg, #0f172a 0%, #1e293b 55%, #0f172a 100%);
  color: #e2e8f0;
  padding: clamp(32px, 6vw, 72px);
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-visual .brand-name { color: #fff; font-size: 22px; }
.auth-visual .brand-tag { color: #94a3b8; }
.auth-brand { display: flex; gap: 14px; align-items: center; }
.auth-points {
  list-style: none; padding: 0; margin: 48px 0 0;
  display: grid; gap: 14px; max-width: 360px;
}
.auth-points li {
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, .25);
  border-radius: var(--radius);
  background: rgba(255,255,255,.04);
  font-size: 14px; color: #cbd5e1;
}
.auth-points li::before {
  content: "";
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #2dd4bf; margin-right: 10px; vertical-align: middle;
}
.auth-panel {
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(28px, 5vw, 64px);
  max-width: 440px; width: 100%; margin: 0 auto;
}
.auth-panel.alone {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px;
}
.auth-panel h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.02em; }
.auth-sub { margin: 0 0 28px; color: var(--muted); font-size: 14px; }
.auth-form { display: grid; gap: 16px; }
.input-with-action {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.input-with-action input,
.input-with-action select {
  flex: 1;
  min-width: 0;
}
.input-with-action .btn {
  flex-shrink: 0;
  white-space: nowrap;
  align-self: stretch;
}
.auth-panel .brand-mark { margin-bottom: 16px; }

/* —— Fields / Buttons —— */
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: -2px; }

/* 登记页：字段名加粗黑字 */
#usageFormPanel .field > span:not(.field-hint) {
  color: #000;
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .18);
}
.form-error { color: var(--danger); font-size: 13px; min-height: 1.2em; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: var(--radius-sm);
  padding: 9px 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: #fff; color: var(--ink-2);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--surface); }
.btn-ghost.danger { color: var(--danger); border-color: #fecaca; }
.btn-ghost.danger:hover { background: var(--danger-soft); }
.btn-warn { background: var(--warn); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-lg { padding: 13px 18px; font-size: 15px; }
.btn-block { width: 100%; }
.nowrap { white-space: nowrap; }
.btn-icon {
  width: 40px; height: 40px; padding: 0; border-radius: var(--radius-sm);
}

/* —— App shell —— */
.app-shell {
  min-height: 100vh;
  display: block;
}
.sidebar { display: none !important; }

.main-col { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  min-height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 20px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left {
  display: flex; align-items: center; gap: 20px; min-width: 0; flex: 1;
}
.topbar-right {
  display: flex; gap: 8px; align-items: center; flex-shrink: 0;
}
.brand-btn {
  display: flex; align-items: center; gap: 10px;
  border: none; background: transparent; cursor: pointer;
  padding: 6px 8px 6px 0; border-radius: var(--radius-sm);
  text-align: left;
}
.brand-btn:hover { background: var(--surface); }
.brand-btn-text { display: grid; line-height: 1.2; }
.brand-btn .brand-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.brand-btn .brand-tag { font-size: 11px; color: var(--muted); margin-top: 1px; }

.main-tabs {
  display: flex; align-items: center; gap: 4px;
  padding: 4px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line);
}
.main-tabs button {
  border: none; background: transparent;
  padding: 11px 26px; border-radius: 9px;
  font-size: 16px; font-weight: 600; color: var(--muted);
  cursor: pointer; transition: background .15s, color .15s, box-shadow .15s;
}
.main-tabs button:hover { color: var(--ink); background: rgba(255,255,255,.7); }
.main-tabs button.active {
  background: #fff; color: var(--accent-ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

.page-kicker {
  font-size: 12px; color: var(--muted); font-weight: 600;
  letter-spacing: .04em;
}
.page-title { margin: 2px 0 0; font-size: 20px; letter-spacing: -.02em; }
.topbar-meta { display: flex; gap: 10px; align-items: center; }
.meta-pill {
  font-size: 12px; font-weight: 600;
  padding: 6px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.meta-user { font-size: 13px; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-icon-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
}
.topbar-icon-btn:hover { background: var(--surface); color: var(--ink); }
.top-settings.active {
  color: var(--accent-ink) !important;
  border-color: var(--accent) !important;
  background: var(--accent-soft) !important;
}

.page {
  padding: 22px 24px 40px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  animation: fadeUp .28s ease;
  box-sizing: border-box;
  overflow-x: hidden;
}
.page.page-core { max-width: 1240px; }
.page.page-home { max-width: 1280px; padding-top: 28px; }
.page.page-secondary { max-width: 920px; }
.page.page-settings {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.main-col:has(.page-settings) {
  min-height: 100vh;
}
.main-col:has(.page-settings) .page-settings {
  min-height: calc(100vh - var(--top-h));
}

/* —— Settings shell (admin-style, full bleed) —— */
.settings-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 0;
  flex: 1;
  width: 100%;
  min-height: calc(100vh - var(--top-h));
  border: none;
  border-radius: 0;
  overflow: hidden;
  background: var(--card);
  box-shadow: none;
}
.settings-nav {
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  padding: 18px 12px 14px;
}
.settings-nav-head { padding: 4px 10px 16px; border-bottom: 1px solid rgba(148,163,184,.18); margin-bottom: 10px; }
.settings-nav-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #94a3b8;
}
.settings-nav-user {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.settings-nav-user strong {
  font-size: 15px;
  color: #fff;
  font-weight: 650;
}
.settings-nav-user .pill {
  align-self: flex-start;
  background: rgba(45, 212, 191, .15);
  color: #99f6e4;
  border: 1px solid rgba(45, 212, 191, .25);
}
.settings-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.settings-nav-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  text-align: left;
  width: 100%;
  border: none;
  background: transparent;
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.settings-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.settings-nav-item.active {
  background: rgba(20, 184, 166, .18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, .35);
}
.settings-nav-ico {
  font-size: 16px;
  line-height: 1.4;
  opacity: .9;
}
.settings-nav-item strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.3;
}
.settings-nav-item small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.35;
}
.settings-nav-item.active small { color: #99f6e4; }
.settings-nav-foot {
  margin-top: 12px;
  padding: 10px 12px 4px;
  border-top: 1px solid rgba(148,163,184,.18);
  font-size: 11px;
  line-height: 1.5;
  color: #94a3b8 !important;
}
.settings-nav-foot .mono { color: #cbd5e1; font-size: 11px; }
.settings-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(700px 280px at 100% 0%, rgba(20,184,166,.06), transparent 55%),
    #f8fafc;
}
.settings-main-head {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
}
.settings-main-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -.02em;
}
.settings-main-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.settings-main-body {
  padding: 20px 28px 32px;
  flex: 1;
  width: 100%;
  max-width: none;
}
.settings-main-body > .stack,
.settings-main-body > .card {
  max-width: none;
  width: 100%;
}

.stack-core { gap: 28px; }
.stack-core .card-primary + .card-secondary,
.stack-core .card-primary + .card-secondary,
.stack-core .card-secondary + .card-secondary {
  margin-top: 8px;
}

.card-primary {
  padding: 22px 24px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .06), 0 12px 32px rgba(15, 23, 42, .06);
}
.card-secondary {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #fafbfc;
  box-shadow: none;
  border-color: #e8edf2;
}
.card-secondary .card-hd h3 { font-size: 14px; }
.card-secondary .card-hd p { font-size: 12px; }

.page-head-core { margin-bottom: 4px; }
.page-head-core h2 { font-size: clamp(24px, 3vw, 30px); }
.page-head-core p { font-size: 14px; max-width: 640px; }

.bottom-nav { display: none; }

/* —— Content primitives —— */
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-stretch > * { flex: 1; min-width: 140px; }
.muted { color: var(--muted); font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card-hd {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 14px;
}
.card-hd h3 { margin: 0; font-size: 16px; }
.card-hd p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: ""; position: absolute; right: -12px; top: -12px;
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent-soft); opacity: .7;
}
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-value {
  margin-top: 8px; font-size: 28px; font-weight: 700;
  letter-spacing: -.03em; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-card.tone-teal .stat-value { color: var(--accent); }
.stat-card.tone-blue .stat-value { color: var(--info); }
.stat-card.tone-amber .stat-value { color: var(--warn); }
.stat-card.tone-green .stat-value { color: var(--ok); }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.quick-actions.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* —— Home: core dominant layout —— */
.home-shell {
  display: grid;
  gap: 0;
}

.home-core-zone {
  padding-bottom: 12px;
  min-height: min(62vh, 560px);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.home-secondary-zone {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 2px solid var(--line);
}
.home-secondary-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .06em;
  margin-bottom: 16px;
}
.home-secondary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 20px;
  align-items: start;
}

.home-greet {
  padding: 8px 4px 0;
}
.home-greet h2 {
  margin: 0; font-size: clamp(24px, 3.5vw, 32px); letter-spacing: -.02em;
}
.home-greet p { margin: 8px 0 0; color: var(--muted); font-size: 15px; }

.core-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  flex: 1;
  align-content: stretch;
}
.core-tile {
  display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  padding: clamp(28px, 4vw, 40px);
  min-height: clamp(200px, 28vh, 280px);
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .05), 0 16px 40px rgba(15, 23, 42, .07);
}
.core-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .14), 0 16px 40px rgba(15, 23, 42, .08);
  transform: translateY(-2px);
}
.core-tile .qa-ico {
  width: 56px; height: 56px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 700; font-size: 22px;
}
.core-tile strong { font-size: clamp(22px, 2.5vw, 28px); color: var(--ink); }
.core-tile span { font-size: 14px; color: var(--muted); line-height: 1.55; max-width: 28ch; }
.core-tile.claim { border-top: 4px solid #0f766e; }
.core-tile.usage { border-top: 4px solid #0369a1; }
.core-tile.stocktake { border-top: 4px solid #c2410c; }

.home-bag.card { padding: 14px 16px; }
.home-bag .card-hd { margin-bottom: 8px; }
.home-bag .card-hd h3 { font-size: 14px; margin: 0; }
.home-bag .card-hd p { font-size: 12px; margin: 2px 0 0; }

.home-side {
  display: grid; gap: 10px;
}

.side-stats {
  display: grid; gap: 8px;
}
.side-stat {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
}
.side-stat .stat-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.side-stat .stat-value { margin-top: 4px; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.side-stat.tone-teal .stat-value { color: var(--accent); }
.side-stat.tone-blue .stat-value { color: var(--info); }
.side-stat.tone-amber .stat-value { color: var(--warn); }
.side-stat.tone-green .stat-value { color: var(--ok); }

.side-panel {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px; color: var(--muted);
}
.side-panel strong { display: block; color: var(--ink); font-size: 13px; margin-bottom: 4px; }

.sub-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 4px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
  margin-bottom: 14px;
}
.sub-tabs button {
  border: none; background: transparent;
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer;
}
.sub-tabs button:hover { color: var(--ink); background: rgba(255,255,255,.8); }
.sub-tabs button.active {
  background: #fff; color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
}
.sub-pane { display: none; }
.sub-pane.active { display: block; }

.page-head {
  margin-bottom: 16px;
}
.page-head h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.quick-btn {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  text-align: left; padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.quick-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
.quick-btn strong { font-size: 15px; }
.quick-btn span { font-size: 12px; color: var(--muted); }
.quick-btn .qa-ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
  font-weight: 700; margin-bottom: 4px;
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  max-width: 100%;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  background: #f8fafc; color: var(--muted);
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  position: sticky; top: 0;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
.mono { font-family: var(--mono); letter-spacing: .02em; font-weight: 600; }

/* 登记：待选串码紧凑列表 */
.usage-pick-list {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}
.usage-pick-head,
.usage-pick-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
}
.usage-pick-head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.usage-pick-head span:first-child { grid-column: 2; }
.usage-pick-item {
  margin: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.usage-pick-item:last-child { border-bottom: none; }
.usage-pick-item:hover,
.usage-pick-item.active { background: var(--accent-soft); }

tr.is-clickable {
  cursor: pointer;
  transition: background .12s ease;
}
tr.is-clickable:hover,
tr.is-clickable:focus {
  background: var(--accent-soft);
  outline: none;
}

.stock-total {
  font-size: 28px;
  letter-spacing: -.03em;
  color: var(--ink);
}
.stock-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: var(--panel-2, #f3f4f6);
  border: 1px solid var(--line);
}
.stock-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.stock-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}
.stock-type-list { display: grid; gap: 10px; }
.stock-type-card { padding: 0; overflow: hidden; }
.stock-type-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
}
.stock-type-nums {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.stock-type-count {
  min-width: 2ch;
  text-align: right;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--ink);
}
.stock-model-box { padding: 0 16px 14px; border-top: 1px solid var(--line); }
.stock-model-meta {
  font-size: 12px;
  padding: 10px 0 4px;
}
.stock-model-head,
.stock-model-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
}
.stock-model-head {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.stock-model-row { border-top: 1px dashed var(--line); }

.stock-tree-wrap { display: grid; gap: 8px; }
.stock-node-list { display: grid; gap: 4px; }
.stock-node { display: grid; gap: 2px; }
.stock-node-row {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-left: calc(12px + var(--depth, 0) * 14px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel, #fff);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.stock-node-row:hover { background: var(--panel-2, #f8fafc); }
.stock-node-row[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--accent, #2563eb) 35%, var(--line));
}
.stock-node-caret {
  width: 1em;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform .15s ease;
}
.stock-node-caret.is-open { transform: rotate(90deg); }
.stock-node-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}
.stock-node-count {
  font-size: 18px;
  letter-spacing: -.03em;
  flex-shrink: 0;
}
.stock-node-children {
  display: grid;
  gap: 4px;
  margin: 2px 0 6px;
}
.stock-node-empty { padding: 6px 12px; font-size: 12px; }
.stock-serial-row {
  padding: 8px 12px;
  padding-left: calc(12px + var(--depth, 0) * 14px);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-2, #f8fafc);
}
.stock-serial-main {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
}
.stock-serial-no { font-weight: 700; }
.stock-serial-meta { font-size: 12px; }
.stock-serial-remark { font-size: 12px; margin-top: 4px; }

#stUsageEditModal .field > span:not(.field-hint) {
  color: #000;
  font-weight: 700;
}
.usage-pick-item input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}
.usage-pick-serial,
.usage-pick-model {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}
.usage-pick-serial {
  font-size: 16px;
  color: var(--ink);
}
.usage-pick-model {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.usage-claim-box {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.usage-claim-box > .empty {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.usage-edit-banner {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  color: var(--info);
  font-size: 13px;
  font-weight: 600;
}
.usage-result-ok {
  font-size: 18px;
  font-weight: 700;
  color: var(--ok);
  letter-spacing: -.01em;
}
.usage-result-dl {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}
.usage-result-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.usage-result-row:last-child { border-bottom: none; }
.usage-result-k {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  padding-top: 2px;
}
.usage-result-v {
  font-size: 15px;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.usage-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.usage-result-actions .btn { width: 100%; }

.pill {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--surface); color: var(--ink-2);
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.muted { background: #f1f5f9; color: var(--muted); }

.scan-box {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 14px;
  background: #f8fafc;
}
.scan-input {
  font-size: 18px !important;
  font-weight: 600;
  letter-spacing: .06em;
  padding: 14px 14px !important;
  text-transform: uppercase;
}

.claim-card { padding: 16px; }
.claim-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 16px;
  align-items: stretch;
}
.claim-compose-main { min-width: 0; }
.claim-batch-field { height: 100%; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.claim-batch-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
}
.claim-batch-input {
  flex: 1;
  min-height: 0;
  height: auto;
  resize: vertical;
  line-height: 1.55;
  font-family: var(--mono);
}
.claim-compose-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}
.claim-side-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}
.btn-block { width: 100%; justify-content: center; }
.claim-submit { margin-top: 8px; min-height: 48px; }
.claim-restock {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--warn);
  background: var(--warn-soft);
}

.scan-camera-card { width: min(480px, 100%); text-align: left; }
.scan-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 52vh;
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
}
.scan-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scan-frame {
  position: absolute;
  inset: 28% 6%;
  border: 2px solid rgba(45, 212, 191, .85);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, .35);
  pointer-events: none;
}
.scan-frame::before {
  content: "";
  position: absolute;
  left: 8%; right: 8%;
  height: 2px;
  background: rgba(45, 212, 191, .55);
  animation: scanLine 1.6s ease-in-out infinite;
}
@keyframes scanLine {
  0%, 100% { top: 12%; opacity: .35; }
  50% { top: 78%; opacity: 1; }
}
.feedback {
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14px;
  line-height: 1.5;
}
.feedback.ok { border-color: #6ee7b7; background: var(--ok-soft); color: var(--ok); }
.feedback.warn { border-color: #fdba74; background: var(--warn-soft); color: var(--warn); }
.feedback.err { border-color: #fca5a5; background: var(--danger-soft); color: var(--danger); }

.section-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 4px; background: #e2e8f0; border-radius: 10px; width: fit-content;
}
.section-tabs button {
  border: none; background: transparent; color: var(--muted);
  padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px;
}
.section-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.admin-pane { display: none; }
.admin-pane.active { display: block; animation: fadeUp .2s ease; }

.bag-meta {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 12px; font-size: 13px; color: var(--muted);
}
.bag-meta strong { color: var(--ink); }

.empty {
  text-align: center; padding: 28px 12px; color: var(--muted); font-size: 13px;
}

/* Org architecture */
.org-overview { display: grid; gap: 14px; }
.org-belong {
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border: 1px solid #e2e8f0;
}
.org-belong-label {
  font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em;
}
.org-belong-path {
  margin-top: 6px; font-size: 16px; font-weight: 650; color: var(--ink); line-height: 1.4;
}
.org-belong-meta {
  margin-top: 10px; display: flex; flex-wrap: wrap; gap: 10px 16px;
  font-size: 13px; color: var(--muted);
}
.org-belong-meta strong { color: var(--ink); font-weight: 600; }
.org-section { display: grid; gap: 10px; padding-top: 4px; }
.org-section-hd h4 { margin: 0; font-size: 14px; font-weight: 650; }
.org-section-hd p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.org-peer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.org-peer {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}
.org-peer.is-self { border-color: #93c5fd; background: #f0f7ff; }
.org-peer-main { display: flex; align-items: center; gap: 8px; }
.org-peer-name { font-weight: 600; font-size: 14px; }
.org-peer-me {
  font-size: 11px; font-weight: 700;
  color: #1d4ed8; background: #dbeafe;
  padding: 1px 6px; border-radius: 999px;
}
.org-peer-sub { display: flex; gap: 10px; font-size: 12px; color: var(--muted); }

.org-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.org-stat {
  flex: 1 1 72px; min-width: 72px;
  padding: 10px 12px; border-radius: 12px;
  background: #f8fafc; border: 1px solid #eef2f7; text-align: center;
}
.org-stat strong { display: block; font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.org-stat span { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); font-weight: 600; }

.org-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: space-between;
}
.org-toolbar-filters {
  display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 220px; min-width: 0;
}
.org-search {
  flex: 1 1 160px; min-width: 0; height: 36px;
  padding: 0 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; font-size: 13px;
}
.org-toolbar-filters select {
  height: 36px;
  min-width: 8.5em;
  width: max-content;
  max-width: 100%;
  flex: 0 1 auto;
  padding: 0 32px 0 12px;
  border-radius: 10px;
  white-space: nowrap;
}
#userRoleFilter { min-width: 9.5em; }
#userStatusFilter { min-width: 7.5em; }
#orgTypeFilter { min-width: 7.5em; }
.org-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.org-view-tabs {
  display: inline-flex; padding: 3px; border-radius: 10px;
  background: #f1f5f9; border: 1px solid #e2e8f0;
}
.org-view-tab {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 650; color: var(--muted); cursor: pointer;
}
.org-view-tab.is-active {
  background: #fff; color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}
.org-content {
  border: 1px solid #eef2f7; border-radius: 12px; background: #fff; overflow: hidden;
}
.org-footnote { margin: 0; font-size: 12px; line-height: 1.5; }

.org-hier { display: grid; }
.org-hier-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid #f1f5f9;
}
.org-hier-row:last-child { border-bottom: 0; }
.org-hier-row:hover { background: #f8fafc; }
.org-hier-main { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.org-hier-indent { flex: none; width: calc(var(--depth, 0) * 16px); }
.org-hier-text { min-width: 0; }
.org-hier-name {
  font-size: 14px; font-weight: 650; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.org-hier-meta {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  margin-top: 2px; font-size: 11px; color: var(--muted);
}
.org-hier-actions { display: flex; flex-wrap: wrap; gap: 4px; flex: none; }
@media (max-width: 640px) {
  .org-hier-row { flex-direction: column; align-items: stretch; }
  .org-hier-actions { justify-content: flex-end; }
}

.btn-xs {
  padding: 2px 7px; font-size: 11px; border-radius: 6px; min-height: 24px;
}
.org-node-actions { display: inline-flex; gap: 2px; margin-left: 4px; opacity: .85; }
.org-tree-row:hover .org-node-actions { opacity: 1; }
.org-filter-hide { display: none !important; }

.org-tree-wrap {
  overflow-x: auto; overflow-y: hidden; padding: 12px 8px 16px;
  -webkit-overflow-scrolling: touch;
}
.org-tree {
  list-style: none; margin: 0; padding: 16px 0 0;
  display: flex; justify-content: flex-start; align-items: flex-start; position: relative;
}
.org-tree-root { padding-top: 0; justify-content: flex-start; }
.org-tree-node {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding: 16px 6px 0; text-align: center;
}
.org-tree-node::before,
.org-tree-node::after {
  content: ''; position: absolute; top: 0; right: 50%;
  border-top: 1px solid #cbd5e1; width: 50%; height: 16px;
}
.org-tree-node::after { right: auto; left: 50%; border-left: 1px solid #cbd5e1; }
.org-tree-node:only-child { padding-top: 0; }
.org-tree-node:only-child::before,
.org-tree-node:only-child::after { display: none; }
.org-tree-node:first-child::before,
.org-tree-node:last-child::after { border: 0 none; }
.org-tree-node:last-child::before {
  border-right: 1px solid #cbd5e1; border-radius: 0 4px 0 0;
}
.org-tree-node:first-child::after { border-radius: 4px 0 0 0; }
.org-tree-node > .org-tree::before {
  content: ''; position: absolute; top: 0; left: 50%;
  border-left: 1px solid #cbd5e1; width: 0; height: 16px;
}
.org-tree-root > .org-tree-node { padding-top: 0; }
.org-tree-root > .org-tree-node::before,
.org-tree-root > .org-tree-node::after { display: none; }
.org-tree-row {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 10px;
  background: #f8fafc; border: 1px solid #eef2f7; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.org-tree-name { font-size: 13px; font-weight: 600; }
.org-type-tag {
  flex: none; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  background: #e2e8f0; color: #475569;
}
.org-type-company { background: #1e293b; color: #fff; }
.org-type-city { background: #dbeafe; color: #1d4ed8; }
.org-type-county { background: #e0e7ff; color: #4338ca; }
.org-type-service_station { background: #dcfce7; color: #166534; }
.org-type-team { background: #fef3c7; color: #92400e; }
.org-create { padding-top: 12px; border-top: 1px solid #eef2f7; }
.org-create-form { max-width: 420px; }


.user-overview { display: grid; gap: 14px; }
.user-list { display: grid; }
.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px; border-bottom: 1px solid #f1f5f9;
}
.user-row:last-child { border-bottom: 0; }
.user-row:hover { background: #f8fafc; }
.user-row-main { min-width: 0; flex: 1; }
.user-row-title {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 14px;
}
.user-row-title strong { font-weight: 650; color: var(--ink); }
.user-row-meta {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  margin-top: 4px; font-size: 12px; color: var(--muted);
}
.user-row-actions { display: flex; flex-wrap: wrap; gap: 4px; flex: none; }
@media (max-width: 640px) {
  .user-row { flex-direction: column; align-items: stretch; }
  .user-row-actions { justify-content: flex-end; }
}


/* Device type + model catalog */
.dtype-overview { display: grid; gap: 14px; }
.dtype-layout {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 12px;
  align-items: start;
}
.dtype-side, .dtype-main {
  border: 1px solid #eef2f7;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.dtype-side-hd, .dtype-main-hd {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.dtype-side-hd h4, .dtype-main-hd h4 {
  margin: 0; font-size: 14px; font-weight: 650;
}
.dtype-main-hd p {
  margin: 4px 0 0; font-size: 12px; color: var(--muted);
}
.dtype-type-list {
  display: grid; max-height: min(60vh, 520px); overflow: auto;
}
.dtype-type-item {
  display: block; width: 100%; text-align: left;
  border: 0; border-bottom: 1px solid #f1f5f9;
  background: #fff; padding: 12px; cursor: pointer;
}
.dtype-type-item:last-child { border-bottom: 0; }
.dtype-type-item:hover { background: #f8fafc; }
.dtype-type-item.is-active {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 #2563eb;
}
.dtype-type-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.dtype-type-code { font-size: 11px; font-weight: 700; color: #64748b; }
.dtype-type-name { margin-top: 4px; font-size: 14px; font-weight: 650; color: var(--ink); }
.dtype-type-pat { margin-top: 4px; font-size: 11px; color: var(--muted); }
.dtype-model-toolbar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 10px 12px; border-bottom: 1px solid #f1f5f9;
}
.dtype-model-list { border: 0; border-radius: 0; }
.dtype-model-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px; border-bottom: 1px solid #f1f5f9;
}
.dtype-model-row:last-child { border-bottom: 0; }
.dtype-model-row:hover { background: #f8fafc; }
.dtype-model-main { min-width: 0; flex: 1; }
.dtype-model-name { font-size: 14px; font-weight: 650; }
.dtype-model-meta {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  margin-top: 3px; font-size: 12px; color: var(--muted);
}
.dtype-model-actions { display: flex; gap: 4px; flex: none; }
@media (max-width: 800px) {
  .dtype-layout { grid-template-columns: 1fr; }
  .dtype-type-list {
    display: flex; overflow-x: auto; max-height: none;
  }
  .dtype-type-item {
    flex: 0 0 auto; min-width: 160px;
    border-bottom: 0; border-right: 1px solid #f1f5f9;
  }
}


.install-panel { width: min(480px, 100%); }
.install-checks {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  font-size: 13px;
}
.install-check-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 6px;
}
.field-check span {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--muted); font-weight: 500;
}
.field-check input { margin-top: 3px; }

/* Toast / Modal */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 999px;
  z-index: 80; max-width: 90vw; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(15,23,42,.25);
  animation: fadeUp .2s ease;
}
.modal {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}
.modal.modal-center {
  align-items: center;
  justify-content: center;
}
.modal-card {
  background: #fff; border-radius: 16px; padding: 24px;
  width: min(420px, 100%); box-shadow: var(--shadow);
  text-align: center; animation: fadeUp .22s ease;
}
.modal-card-wide {
  width: min(520px, 100%);
  text-align: left;
}
.modal-card-wide h3 { text-align: center; margin: 0 0 4px; }
.validate-body {
  max-height: min(42vh, 320px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  padding: 8px 10px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.45;
}
.validate-item {
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}
.validate-item:last-child { border-bottom: none; }
.validate-item .mono { font-size: 13px; }
.validate-actions {
  flex-wrap: wrap;
  justify-content: stretch;
}
.validate-actions .btn { flex: 1; min-width: 110px; }
.modal-icon {
  width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 12px;
  display: grid; place-items: center; font-weight: 800; font-size: 22px;
}
.modal-icon.warn { background: var(--warn-soft); color: var(--warn); }
.modal-card h3 { margin: 0 0 8px; }
.modal-text { margin: 0 0 20px; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

pre.json {
  background: #0f172a; color: #e2e8f0;
  padding: 12px; border-radius: 8px; overflow: auto;
  font-size: 12px; max-height: 240px;
}

.import-progress {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}
.import-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}
.import-progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.import-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  transition: width .25s ease;
}

/* —— Responsive: tablet —— */
@media (max-width: 1100px) {
  .core-tiles { grid-template-columns: 1fr; gap: 18px; }
  .home-secondary-grid { grid-template-columns: 1fr; }
  .claim-compose { grid-template-columns: minmax(0, 1fr) 200px; }
  .settings-shell { grid-template-columns: 220px minmax(0, 1fr); }
}

/* —— Responsive: H5 / 窄屏全站自适应 —— */
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { min-height: 180px; padding: 24px 18px; }
  .auth-points { display: none; }
  .auth-panel { padding: 24px 16px 36px; max-width: none; width: 100%; }
  .auth-panel.alone { padding: 22px 16px; border-radius: 12px; margin: 12px; width: auto; }

  .topbar {
    padding: 0 10px;
    min-height: 52px;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .brand-btn-text { display: none; }
  .brand-btn {
    padding: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    justify-content: center;
    border: 1px solid var(--line);
    background: #fff;
  }
  .brand-btn .brand-mark.sm { width: 100%; height: 100%; border-radius: 8px; }
  .main-tabs { display: none; }
  .meta-user { display: none; }
  .meta-pill { font-size: 11px; padding: 5px 8px; white-space: nowrap; }
  .topbar-right { gap: 6px; }
  .topbar-icon-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 9px;
    font-size: 14px;
  }

  .page {
    padding: 10px 10px calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px) + 16px);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .page.page-core,
  .page.page-home,
  .page.page-secondary,
  .page.page-settings { max-width: 100%; }

  .stack,
  .stack-core,
  .card,
  .field,
  #usageFormPanel,
  #usageResultPanel,
  #usageTodayCard,
  #usagePickBlock {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .page-head,
  .page-head-core { margin-bottom: 8px; }
  .page-head h2,
  .page-head-core h2 { font-size: 20px; }
  .page-head p,
  .page-head-core p { font-size: 12px; max-width: none; }

  .stack { gap: 12px; }
  .stack-core { gap: 14px; }
  .stack-sm { gap: 8px; }

  .card { padding: 12px; border-radius: 12px; }
  .card-primary { padding: 12px; border-radius: 14px; }
  .card-secondary { padding: 12px; }
  .card-hd {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
  }

  .row,
  .row-stretch {
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
  }
  .row-stretch > * {
    flex: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .field { width: 100%; max-width: 100%; }
  input, select, textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    min-height: 40px;
    padding: 8px 10px;
  }
  select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 34px;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
  }
  textarea { min-height: 0; }
  .input-with-action {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .input-with-action input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
  }
  .input-with-action .btn {
    flex: 0 0 auto;
    padding-left: 10px;
    padding-right: 10px;
  }
  .btn { min-height: 40px; }
  .btn-lg { min-height: 44px; }
  .btn-block { width: 100%; max-width: 100%; box-sizing: border-box; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-value { font-size: 22px; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .quick-actions.cols-3 { grid-template-columns: 1fr; }
  .section-tabs, .sub-tabs {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  /* 宽表只在容器内横滑，不撑破整页 */
  .table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap > table {
    min-width: 520px;
    width: max-content;
    max-width: none;
    font-size: 12px;
  }
  .table-wrap th,
  .table-wrap td { padding: 9px 8px; white-space: nowrap; }
  .table-wrap td.mono,
  .table-wrap .mono { word-break: break-all; white-space: normal; }

  /* 登记页：控件更紧凑，避免右侧被裁 */
  #usageFormPanel .pill { font-size: 11px; padding: 3px 8px; }
  #usageFormPanel input,
  #usageFormPanel select,
  #usageFormPanel textarea {
    min-height: 38px;
    padding: 7px 10px;
  }
  #usageFormPanel select { padding-right: 34px; }
  #usageFormPanel textarea { min-height: 64px; }
  #usageFormPanel .scan-input {
    font-size: 15px !important;
    padding: 8px 10px !important;
    letter-spacing: .02em;
  }
  #usageClaimMeta {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  #usageTodayList .table-wrap > table { min-width: 640px; }

  .page.page-home {
    padding: 8px 10px calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px) + 8px);
    min-height: calc(100dvh - var(--top-h));
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }
  .page.page-home .home-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .page.page-home .home-core-zone {
    flex: 1;
    min-height: 0;
    gap: 10px;
    padding-bottom: 0;
  }
  .page.page-home .home-greet { padding: 2px 2px 0; flex-shrink: 0; }
  .page.page-home .home-greet h2 { font-size: 20px; }
  .page.page-home .home-greet p { margin-top: 4px; font-size: 12px; }
  .page.page-home .core-tiles {
    flex: 1;
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
    align-content: stretch;
  }
  .page.page-home .core-tile {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    padding: 12px 14px;
    min-height: 0;
    border-radius: 14px;
    border-top-width: 3px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
  }
  .page.page-home .core-tile:hover,
  .page.page-home .core-tile:active { transform: none; }
  .page.page-home .core-tile .qa-ico {
    grid-row: 1 / span 2;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 17px;
  }
  .page.page-home .core-tile strong { font-size: 16px; line-height: 1.25; }
  .page.page-home .core-tile span {
    max-width: none;
    font-size: 12px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .claim-compose {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .claim-batch-field { height: auto; }
  .claim-batch-input {
    flex: none;
    min-height: 0;
    height: auto;
    resize: vertical;
  }
  .claim-compose-side { order: 2; padding: 12px; }
  .claim-side-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .claim-submit {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .usage-claim-box,
  .usage-pick-list,
  .usage-result-dl { max-width: 100%; }
  .usage-pick-head,
  .usage-pick-item {
    padding: 12px 10px;
    gap: 6px;
    grid-template-columns: 20px minmax(0, 1.2fr) minmax(0, 1fr);
  }
  .usage-pick-serial { font-size: 17px; }
  .usage-pick-model { font-size: 12px; }
  .usage-result-row {
    grid-template-columns: 84px minmax(0, 1fr);
    padding: 11px 12px;
  }
  .usage-result-v { font-size: 16px; }
  .usage-result-actions {
    position: sticky;
    bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px) + 8px);
    background: #fff;
    padding-top: 8px;
    z-index: 5;
  }

  .page.page-settings {
    padding: 0;
    min-height: calc(100dvh - var(--top-h) - var(--bottom-h) - env(safe-area-inset-bottom, 0px));
  }
  .settings-shell {
    grid-template-columns: 1fr;
    min-height: 0;
    border-radius: 0;
    flex: 1;
  }
  .settings-nav { padding: 12px 10px; }
  .settings-nav-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    max-height: none;
    overflow: visible;
  }
  .settings-nav-item {
    padding: 10px;
    min-height: 56px;
  }
  .settings-nav-item small { display: none; }
  .settings-nav-foot { display: none; }
  .settings-main-head { padding: 14px 12px 10px; }
  .settings-main-body { padding: 12px 10px 20px; }
  .settings-main-body .row,
  .settings-main-body .row-stretch { flex-direction: column; }

  #stSummary .bag-meta,
  .bag-meta { gap: 8px; }
  #stHistList .table-wrap table,
  #stUsedList .table-wrap table,
  #stRemainList .table-wrap table { min-width: 560px; }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    z-index: 30;
  }
  .bottom-nav button {
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    min-width: 0;
    padding: 0 2px;
  }
  .bottom-nav button span { font-size: 18px; line-height: 1; }
  .bottom-nav button.active { color: var(--accent); }

  .scan-input { font-size: 16px !important; padding: 12px !important; }

  .toast {
    bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px) + 16px);
    max-width: calc(100vw - 24px);
  }
  .modal { padding: 12px; align-items: flex-end; }
  .modal.modal-center {
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
  }
  .modal-card {
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 12px 12px;
    padding: 20px 16px;
  }
  .modal.modal-center .modal-card {
    width: min(520px, 100%);
    max-width: 100%;
    max-height: min(85dvh, 640px);
    overflow: auto;
    border-radius: 16px;
    margin: auto;
  }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .modal.modal-center .validate-actions {
    flex-direction: column;
  }

  .home-secondary-zone { margin-top: 24px; padding-top: 16px; }
  .home-secondary-grid { grid-template-columns: 1fr; gap: 12px; }
  .side-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 420px) {
  .page { padding-left: 8px; padding-right: 8px; }
  .usage-result-actions { grid-template-columns: 1fr; }
  .claim-side-actions { grid-template-columns: 1fr; }
  .claim-submit { grid-column: auto; }
}
