:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8fafb;
  --border: #dce2e7;
  --border-strong: #c8d1d8;
  --text: #172126;
  --text-secondary: #637078;
  --text-tertiary: #8a969d;
  --primary: #087f73;
  --primary-hover: #066b62;
  --primary-soft: #e7f5f2;
  --blue: #2d68c4;
  --blue-soft: #eaf1fb;
  --amber: #a7650a;
  --amber-soft: #fff4df;
  --red: #bb3c45;
  --red-soft: #fbeaec;
  --gray-soft: #eef1f3;
  --shadow: 0 12px 32px rgba(31, 43, 50, 0.1);
  --sidebar-width: 232px;
  --topbar-height: 78px;
}

* { box-sizing: border-box; letter-spacing: 0; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
svg { width: 18px; height: 18px; stroke-width: 1.8; flex: 0 0 auto; }
.hidden { display: none !important; }

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand img { border-radius: 8px; box-shadow: 0 3px 10px rgba(20, 44, 49, .14); }
.brand div { display: grid; min-width: 0; }
.brand strong { font-size: 15px; line-height: 1.25; }
.brand span { color: var(--text-tertiary); font-size: 11px; }

.eyebrow { margin: 0 0 3px; color: var(--primary); font-size: 12px; font-weight: 700; }
.button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--surface);
  font-weight: 650;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.button-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.button-secondary { color: var(--text); background: var(--surface); border-color: var(--border); }
.button-secondary:hover { background: var(--surface-muted); border-color: var(--border-strong); }
.button-ghost { color: var(--text-secondary); background: transparent; border-color: transparent; }
.button-ghost:hover { color: var(--text); background: rgba(255,255,255,.07); }
.button-danger-soft { color: var(--red); background: var(--red-soft); border-color: #f2cfd3; }
.button-danger-soft:hover { background: #f8dfe2; }
.button-block { width: 100%; }
.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  color: var(--text-secondary);
  background: transparent;
}
.icon-button:hover { color: var(--text); background: var(--gray-soft); }
.icon-button.bordered { border: 1px solid var(--border); background: var(--surface); }
.icon-button.bordered:hover { border-color: var(--border-strong); }
.text-button { border: 0; padding: 4px; display: inline-flex; align-items: center; gap: 5px; color: var(--primary); background: transparent; font-weight: 650; }
.text-button:hover { color: var(--primary-hover); }
.text-button svg { width: 16px; height: 16px; }

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background-color: #edf1f3;
  background-image: linear-gradient(#dfe5e8 1px, transparent 1px), linear-gradient(90deg, #dfe5e8 1px, transparent 1px);
  background-size: 32px 32px;
}
.auth-panel {
  width: min(440px, 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 34px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.brand-auth { margin-bottom: 38px; }
.brand-auth strong { font-size: 17px; }
.auth-copy h1 { margin: 0; font-size: 28px; line-height: 1.25; }
.auth-copy > p:last-child { margin: 10px 0 25px; color: var(--text-secondary); }
.auth-form { display: grid; gap: 12px; }
.auth-form > label, .form-row > label, fieldset legend { color: #354148; font-size: 13px; font-weight: 700; }
.input-with-icon { position: relative; display: flex; align-items: center; }
.input-with-icon > svg { position: absolute; left: 12px; color: var(--text-tertiary); }
.input-with-icon input { width: 100%; padding-left: 40px; padding-right: 46px; }
.input-with-icon .icon-button { position: absolute; right: 3px; }
input, select, textarea {
  min-height: 40px;
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 9px 11px;
  outline: none;
  background: var(--surface);
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8,127,115,.12); }
.form-error { min-height: 21px; margin: 0; color: var(--red); font-size: 13px; }
.auth-footer { margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 12px; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #1ba784; box-shadow: 0 0 0 3px rgba(27,167,132,.13); }
.status-dot.offline { background: var(--red); box-shadow: 0 0 0 3px rgba(187,60,69,.12); }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar-width);
  padding: 22px 16px 17px;
  display: flex;
  flex-direction: column;
  color: #eff7f6;
  background: #17292b;
  border-right: 1px solid #243a3c;
}
.sidebar .brand { padding: 0 8px 22px; }
.sidebar .brand strong { color: #fff; }
.sidebar .brand span { color: #91aaa8; }
.side-nav { display: grid; gap: 5px; }
.nav-item {
  min-height: 43px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #a9bfbd;
  background: transparent;
  text-align: left;
  font-weight: 600;
}
.nav-item:hover { color: #fff; background: #21383a; }
.nav-item.active { color: #fff; background: #0d756c; }
.nav-count { margin-left: auto; min-width: 24px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; color: #d9eae8; background: rgba(255,255,255,.1); font-size: 11px; }
.sidebar-status { margin-top: auto; padding-top: 16px; border-top: 1px solid #2a4143; }
.server-state { padding: 7px 8px 14px; display: flex; align-items: center; gap: 10px; }
.server-state div { display: grid; }
.server-state strong { font-size: 12px; }
.server-state span:last-child { color: #88a3a1; font-size: 11px; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  min-height: var(--topbar-height);
  padding: 14px clamp(20px, 3vw, 38px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
}
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.25; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.sync-time { margin-right: 3px; color: var(--text-tertiary); font-size: 12px; }
.workspace-content { width: min(1500px, 100%); margin: 0 auto; padding: 26px clamp(20px, 3vw, 38px) 44px; }
.view { display: none; }
.view.active { display: block; }

.metrics-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 14px; }
.metric-card {
  min-height: 132px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
}
.metric-icon { width: 42px; height: 42px; border-radius: 7px; display: grid; place-items: center; }
.metric-icon svg { width: 21px; height: 21px; }
.metric-card > div:last-child { display: grid; }
.metric-card span { color: var(--text-secondary); font-size: 13px; }
.metric-card strong { margin: 1px 0 2px; font-size: 27px; line-height: 1.2; }
.metric-card small { color: var(--text-tertiary); }
.metric-total .metric-icon { color: var(--blue); background: var(--blue-soft); }
.metric-active .metric-icon { color: var(--primary); background: var(--primary-soft); }
.metric-unused .metric-icon { color: var(--amber); background: var(--amber-soft); }
.metric-alert .metric-icon { color: var(--red); background: var(--red-soft); }
.metric-online .metric-icon { color: var(--primary); background: var(--primary-soft); }
.metric-expiring .metric-icon { color: var(--amber); background: var(--amber-soft); }

.dashboard-grid { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 16px; }
.panel { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.panel-header { min-height: 70px; padding: 17px 19px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border); }
.panel-header h2 { margin: 0; font-size: 16px; }
.panel-header p { margin: 2px 0 0; color: var(--text-tertiary); font-size: 12px; }
.summary-chip { border-radius: 12px; padding: 5px 9px; color: var(--primary); background: var(--primary-soft); font-size: 11px; font-weight: 700; }
.trend-chart { height: 245px; padding: 24px 20px 17px; display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 13px; }
.trend-column { height: 100%; min-width: 0; display: grid; grid-template-rows: 1fr auto; gap: 9px; align-items: end; text-align: center; }
.trend-bar-wrap { height: 100%; display: flex; align-items: end; justify-content: center; border-bottom: 1px solid var(--border); }
.trend-bar { width: min(34px, 65%); min-height: 4px; border-radius: 4px 4px 0 0; background: var(--primary); transition: height .3s ease; }
.trend-column span { color: var(--text-tertiary); font-size: 11px; white-space: nowrap; }
.trend-column strong { display: block; color: var(--text-secondary); font-size: 11px; }
.distribution-content { min-height: 245px; padding: 24px; display: flex; align-items: center; justify-content: center; gap: 30px; }
.status-ring { --active-angle: 0deg; width: 126px; height: 126px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--primary) var(--active-angle), #dfe5e8 0); position: relative; }
.status-ring::after { content: ""; position: absolute; width: 86px; height: 86px; border-radius: 50%; background: var(--surface); }
.status-ring span { position: relative; z-index: 1; font-size: 22px; font-weight: 750; }
.status-legend { min-width: 125px; display: grid; gap: 10px; }
.legend-item { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 12px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-item strong { color: var(--text); }
.recent-panel { margin-top: 16px; }

.license-toolbar { margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.search-box { position: relative; width: min(390px, 100%); }
.search-box svg { position: absolute; left: 12px; top: 11px; color: var(--text-tertiary); }
.search-box input { padding-left: 40px; padding-right: 55px; }
.search-box kbd { position: absolute; right: 9px; top: 9px; border: 1px solid var(--border); border-radius: 4px; padding: 2px 5px; color: var(--text-tertiary); background: var(--surface-muted); font-family: inherit; font-size: 10px; }
.segmented-control { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--surface); }
.segmented-control button { min-height: 38px; border: 0; border-right: 1px solid var(--border); padding: 7px 12px; color: var(--text-secondary); background: transparent; white-space: nowrap; }
.segmented-control button:last-child { border-right: 0; }
.segmented-control button:hover { color: var(--text); background: var(--surface-muted); }
.segmented-control button.active { color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.license-toolbar > .icon-button { margin-left: auto; }
.batch-bar { min-height: 52px; margin-bottom: 12px; padding: 7px 9px 7px 15px; border: 1px solid #bcded8; border-radius: 7px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #f0faf8; }
.batch-bar > div { display: flex; gap: 7px; }
.table-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { height: 42px; padding: 9px 14px; color: var(--text-secondary); background: var(--surface-muted); text-align: left; font-size: 11px; font-weight: 750; white-space: nowrap; }
td { min-height: 56px; padding: 13px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #fafcfc; }
.license-table { min-width: 1190px; }
.check-cell { width: 46px; text-align: center; }
.check-cell input { width: 16px; min-height: 16px; height: 16px; padding: 0; accent-color: var(--primary); }
.actions-cell { width: 66px; text-align: right; }
.serial-cell { display: flex; align-items: center; gap: 7px; }
.serial-code { color: #223137; font: 650 12px/1.4 "Cascadia Mono", Consolas, monospace; white-space: nowrap; }
.copy-mini { width: 27px; height: 27px; }
.copy-mini svg { width: 14px; height: 14px; }
.cell-stack { display: grid; gap: 1px; }
.cell-stack span { white-space: nowrap; }
.cell-stack small { color: var(--text-tertiary); font-size: 11px; white-space: nowrap; }
.machine-code { max-width: 170px; overflow: hidden; text-overflow: ellipsis; font: 12px "Cascadia Mono", Consolas, monospace; white-space: nowrap; }
.wechat-id { max-width: 150px; overflow: hidden; text-overflow: ellipsis; font: 12px "Cascadia Mono", Consolas, monospace; white-space: nowrap; }
.muted-value { color: var(--text-tertiary); }
.status-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 12px; padding: 4px 8px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-active { color: var(--primary); background: var(--primary-soft); }
.status-unused { color: var(--amber); background: var(--amber-soft); }
.status-expired { color: #68747a; background: var(--gray-soft); }
.status-revoked { color: var(--red); background: var(--red-soft); }
.remaining { color: var(--primary); font-weight: 700; white-space: nowrap; }
.remaining.expiring { color: var(--amber); }
.pagination { min-height: 57px; padding: 9px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; color: var(--text-secondary); font-size: 12px; }
.pagination > div { display: flex; align-items: center; gap: 11px; }
.empty-row td { height: 220px; text-align: center; }
.empty-state { display: grid; justify-items: center; gap: 7px; color: var(--text-tertiary); }
.empty-state svg { width: 30px; height: 30px; }

.audit-panel { overflow: hidden; }
.audit-panel table { min-width: 760px; }
.action-label { display: inline-flex; border-radius: 4px; padding: 3px 6px; color: var(--blue); background: var(--blue-soft); font-size: 11px; font-weight: 700; }
.audit-detail { max-width: 480px; color: var(--text-secondary); font-size: 12px; overflow-wrap: anywhere; }
.settings-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-panel { overflow: hidden; }
.config-list { margin: 0; padding: 7px 19px; }
.config-list > div { min-height: 56px; display: grid; grid-template-columns: 140px 1fr; align-items: center; border-bottom: 1px solid var(--border); }
.config-list > div:last-child { border-bottom: 0; }
.config-list dt { color: var(--text-secondary); }
.config-list dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.check-list { list-style: none; margin: 0; padding: 13px 19px; display: grid; }
.check-list li { min-height: 68px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--border); }
.check-list li:last-child { border-bottom: 0; }
.check-list svg { color: var(--primary); }
.check-list div { display: grid; }
.check-list span { color: var(--text-tertiary); font-size: 12px; }

.modal { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: hidden; border: 0; border-radius: 8px; padding: 0; color: var(--text); background: var(--surface); box-shadow: 0 24px 70px rgba(25,39,44,.25); }
.modal::backdrop { background: rgba(18,29,33,.48); backdrop-filter: blur(2px); }
.modal > form { max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal-header { min-height: 78px; padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.modal-header h2 { margin: 0; font-size: 19px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { min-height: 66px; padding: 12px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 8px; background: var(--surface-muted); }
.compact-modal { width: min(500px, calc(100vw - 32px)); }
.detail-modal { width: min(680px, calc(100vw - 32px)); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset legend { margin-bottom: 10px; }
.preset-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.preset-options label { cursor: pointer; }
.preset-options input { position: absolute; opacity: 0; pointer-events: none; }
.preset-options span { min-height: 66px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; display: grid; align-content: center; background: var(--surface); }
.preset-options span:hover { border-color: var(--border-strong); background: var(--surface-muted); }
.preset-options input:checked + span { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.preset-options strong { font-size: 13px; }
.preset-options small { color: var(--text-tertiary); }
.form-grid { margin-top: 17px; display: grid; grid-template-columns: 1fr 1.6fr; gap: 12px; }
.form-row { display: grid; gap: 7px; }
#customDuration { margin-top: 16px; }
.duration-input { display: grid; grid-template-columns: 1fr 105px; }
.duration-input input { border-radius: 6px 0 0 6px; }
.duration-input select { border-left: 0; border-radius: 0 6px 6px 0; background: var(--surface-muted); }
.serial-preview { margin-top: 17px; min-height: 52px; padding: 8px 12px; border: 1px dashed var(--border-strong); border-radius: 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-muted); }
.serial-preview span { color: var(--text-secondary); font-size: 12px; }
.serial-preview code { font: 650 12px "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; }
.generate-results { margin-top: 17px; }
.result-header { margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.generate-results textarea { height: 150px; resize: vertical; font: 12px/1.7 "Cascadia Mono", Consolas, monospace; }
.action-description { margin: 0 0 16px; color: var(--text-secondary); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: var(--border); }
.detail-field { min-height: 72px; padding: 12px; display: grid; align-content: center; background: var(--surface); }
.detail-field.wide { grid-column: 1 / -1; }
.detail-field span { color: var(--text-tertiary); font-size: 11px; }
.detail-field strong, .detail-field code { margin-top: 3px; font-size: 13px; overflow-wrap: anywhere; }
.detail-note { margin-top: 16px; }
.detail-note textarea { height: 78px; resize: vertical; }
.detail-actions { justify-content: flex-start; }
.feature-fieldset { margin-top: 18px; }
.feature-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.feature-options label { min-height: 68px; padding: 10px; border: 1px solid var(--border); border-radius: 6px; display: flex; align-items: flex-start; gap: 8px; background: var(--surface); cursor: pointer; }
.feature-options input { margin-top: 3px; accent-color: var(--primary); }
.feature-options span { display: grid; min-width: 0; }
.feature-options strong { font-size: 13px; }
.feature-options small { margin-top: 2px; color: var(--text-tertiary); font-size: 11px; }
.feature-editor { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.wechat-editor { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.wechat-editor-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: end; margin-top: 12px; }
.wechat-editor-row label { display: grid; gap: 6px; min-width: 0; }
.wechat-editor-row label span { color: var(--text-secondary); font-size: 12px; font-weight: 650; }
.wechat-editor-row input { width: 100%; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading > div { display: grid; }
.section-heading strong { font-size: 14px; }
.section-heading span { color: var(--text-tertiary); font-size: 11px; }
.feature-toggle-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
.feature-toggle { min-height: 36px; display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 12px; }
.feature-toggle input, .reset-wechat input { accent-color: var(--primary); }
.feature-expiry-row { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.feature-expiry-row label { display: grid; gap: 6px; color: var(--text-tertiary); font-size: 11px; }
.reset-wechat { margin-top: 12px; display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 12px; }
.feature-editor-actions { margin-top: 12px; display: flex; justify-content: flex-end; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 100; width: min(360px, calc(100vw - 32px)); display: grid; gap: 8px; pointer-events: none; }
.toast { min-height: 52px; padding: 11px 13px; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 6px; display: flex; align-items: center; gap: 10px; background: var(--surface); box-shadow: var(--shadow); animation: toast-in .18s ease; }
.toast.error { border-left-color: var(--red); }
.toast span { color: var(--text-secondary); font-size: 13px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.mobile-nav { display: none; }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .distribution-content { min-height: 210px; }
  .settings-layout { grid-template-columns: 1fr; }
  .license-toolbar { flex-wrap: wrap; }
  .license-toolbar .search-box { width: calc(100% - 48px); }
  .segmented-control { order: 2; max-width: 100%; overflow-x: auto; }
}

@media (max-width: 760px) {
  :root { --topbar-height: 68px; }
  body { font-size: 13px; }
  .auth-gate { padding: 16px; }
  .auth-panel { padding: 24px 20px; }
  .brand-auth { margin-bottom: 30px; }
  .auth-copy h1 { font-size: 24px; }
  .sidebar { display: none; }
  .workspace { margin-left: 0; padding-bottom: 76px; }
  .topbar { min-height: 68px; padding: 11px 14px; }
  .topbar h1 { font-size: 18px; }
  .topbar .eyebrow, .sync-time { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .open-generate { display: none; }
  .workspace-content { padding: 15px 12px 26px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 112px; padding: 14px; gap: 10px; }
  .metric-icon { width: 34px; height: 34px; }
  .metric-card strong { font-size: 23px; }
  .metric-card small { display: none; }
  .dashboard-grid { margin-top: 10px; gap: 10px; }
  .panel-header { min-height: 62px; padding: 13px 14px; }
  .trend-chart { height: 210px; padding: 20px 12px 14px; gap: 7px; }
  .distribution-content { padding: 20px 14px; gap: 20px; }
  .status-ring { width: 108px; height: 108px; }
  .status-ring::after { width: 72px; height: 72px; }
  .recent-panel { margin-top: 10px; }
  .recent-panel .table-wrap { max-width: 100%; }
  .recent-panel table { min-width: 680px; }
  .license-toolbar { gap: 8px; }
  .license-toolbar .search-box { width: calc(100% - 44px); }
  .segmented-control { width: 100%; }
  .segmented-control button { flex: 1 0 auto; }
  .batch-bar { align-items: flex-start; flex-direction: column; }
  .batch-bar > div { width: 100%; overflow-x: auto; }
  .batch-bar .button { min-height: 34px; padding: 6px 10px; }
  .pagination { padding: 9px 10px; }
  .settings-layout { gap: 10px; }
  .config-list > div { grid-template-columns: 105px 1fr; }
  .modal { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .modal > form { max-height: calc(100vh - 16px); }
  .modal-header, .modal-body, .modal-footer { padding-left: 15px; padding-right: 15px; }
  .preset-options { grid-template-columns: 1fr 1fr; }
  .feature-options, .feature-toggle-grid, .feature-expiry-row, .wechat-editor-row { grid-template-columns: 1fr; }
  .wechat-editor-row .button { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .serial-preview { align-items: flex-start; flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-field.wide { grid-column: auto; }
  .detail-actions { overflow-x: auto; }
  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    height: 66px;
    padding: 5px 8px max(5px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,.98);
  }
  .mobile-nav button { height: 52px; border: 0; display: grid; place-items: center; align-content: center; gap: 2px; color: var(--text-tertiary); background: transparent; font-size: 10px; }
  .mobile-nav button.active { color: var(--primary); }
  .mobile-nav button svg { width: 20px; height: 20px; }
  .mobile-nav .mobile-create { width: 46px; height: 46px; margin: 0 auto; border-radius: 50%; color: #fff; background: var(--primary); }
  .mobile-nav .mobile-create svg { width: 23px; height: 23px; }
  .mobile-nav .mobile-create span { display: none; }
  .toast-stack { right: 8px; bottom: 76px; width: calc(100vw - 16px); }
}

@media (max-width: 410px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 92px; align-items: center; }
  .metric-card small { display: block; }
  .distribution-content { align-items: flex-start; flex-direction: column; }
  .status-legend { width: 100%; }
}
