:root {
  --bg: #f3f6f5;
  --paper: #ffffff;
  --panel: #ffffff;
  --border: #dfe4e2;
  --text: #17201e;
  --text-2: #3e4846;
  --muted: #68716f;
  --primary: #087f6a;
  --primary-2: #056a59;
  --primary-soft: #e6f4f0;
  --green: #087f6a;
  --green-soft: #e6f4f0;
  --red: #b43b45;
  --red-soft: #fdecee;
  --amber: #a7650b;
  --amber-soft: #fff4df;
  --sidebar: #151b1a;
  --sidebar-2: #202826;
  --sidebar-muted: #99a4a1;
  --radius: 6px;
  --shadow: 0 4px 16px rgba(23, 32, 30, 0.025);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: Inter, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea {
  font-family: inherit;
  font-size: 13px;
}

button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.65; }
.hidden { display: none !important; }

/* ---------- 通用品牌 ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(8, 127, 106, 0.25);
}

.brand-mark.large {
  width: 48px;
  height: 48px;
  border-radius: 6px;
}

.brand b {
  display: block;
  font-size: 17px;
  letter-spacing: 0.04em;
}

.brand em {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: #aab4b1;
  margin-top: 2px;
}

/* ---------- 按钮 ---------- */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 5px;
  padding: 8px 14px;
  min-height: 38px;
  font-weight: 650;
  font-size: 13px;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  box-shadow: none;
}

.btn-primary:hover { background: var(--primary-2); }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  background: var(--paper);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: #f9fbfa; border-color: #b8c1be; }

.btn-block { width: 100%; }
.btn-block + .btn-block { margin-top: 10px; }

.link-btn {
  background: none;
  border: none;
  color: var(--sidebar-muted);
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
}

.link-btn.active { color: #fff; background: rgba(255, 255, 255, 0.1); }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(320px, 43%) 1fr;
  background: var(--paper);
}

.login-top {
  padding: 56px;
  background: var(--sidebar);
  color: #fff;
  display: flex;
  align-items: flex-start;
  gap: 15px;
  position: relative;
  overflow: hidden;
}

.login-top .brand-mark {
  width: 48px;
  height: 48px;
}

.brand-name {
  margin: 2px 0 3px;
  font-size: 18px;
  font-weight: 760;
  color: #fff;
}

.brand-caption {
  margin: 0;
  color: #aab4b1;
  font-size: 13px;
}

.login-top:after {
  content: "";
  position: absolute;
  left: 56px;
  right: 56px;
  bottom: 56px;
  height: 1px;
  background: #34403d;
}

.login-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-card {
  width: min(460px, 100%);
  background: transparent;
  padding: 0;
  box-shadow: none;
  animation: rise 0.42s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.login-logo { display: none; }

.login-card h1 {
  text-align: left;
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.login-subtitle {
  text-align: left;
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 34px;
}

.login-tabs {
  display: flex;
  gap: 3px;
  background: var(--bg);
  border-radius: 6px;
  padding: 3px;
  margin-bottom: 24px;
  width: max-content;
}

.login-tabs .tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
}

.login-tabs .tab.active {
  background: var(--paper);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #3e4846;
  font-size: 13px;
  font-weight: 650;
  margin: 16px 0 7px;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #cfd6d4;
  border-radius: 5px;
  padding: 0 11px;
  background: var(--paper);
  color: #7b8582;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 127, 106, 0.1);
}

.input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  min-height: 42px;
  padding: 9px 0;
  color: var(--text);
}

.input-wrap input::placeholder { color: #9ca6a3; }

.login-card .btn-block { margin-top: 24px; min-height: 45px; }

.guest-scan-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 11px 13px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #cce6df;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.guest-scan-link:hover { border-color: #9bcfc2; }
.login-foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 18px 0 0;
}

/* ---------- 工作台布局 ---------- */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: #aab6d0;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 25px;
  border-bottom: 1px solid #303836;
}
.sidebar-brand .brand-mark { width: 36px; height: 36px; }
.sidebar-brand-text { min-width: 0; }
.sidebar-brand-text strong { display: block; font-size: 14px; color: #fff; }
.sidebar-brand-text small { display: block; color: var(--sidebar-muted); margin-top: 2px; font-size: 12px; }

.nav {
  display: grid;
  gap: 4px;
  margin-top: 22px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 13px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: var(--sidebar-2); color: #fff; }

.nav-item.active {
  background: #293431;
  color: #fff;
  box-shadow: none;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 18px 8px 0;
  border-top: 1px solid #303836;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #35413e;
  color: #dce4e1;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar.small { width: 28px; height: 28px; font-size: 11px; }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info b { display: block; color: #fff; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span { font-size: 11px; color: var(--sidebar-muted); }

.logout-btn {
  border: none;
  background: transparent;
  color: var(--sidebar-muted);
  padding: 6px;
  border-radius: 4px;
  display: inline-flex;
}

.logout-btn:hover { background: #293431; color: #fff; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 69px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
  padding: 0 34px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.topbar h2 { margin: 0; font-size: 18px; }

.topbar-right { display: flex; align-items: center; gap: 18px; }

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

.sync-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

#pageContent {
  flex: 1;
  overflow-y: auto;
  padding: 30px 34px 54px;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.22s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 卡片与面板 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.panel + .panel { margin-top: 18px; }

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
}

.panel-head.between { align-items: center; justify-content: space-between; }

.panel-head h3 { margin: 0; font-size: 16px; }
.panel-sub { color: var(--muted); font-size: 12px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.stats-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.stats-row .stat-card:first-child {
  background: var(--sidebar);
  border-color: var(--sidebar);
}

.stats-row .stat-card:first-child .stat-label,
.stats-row .stat-card:first-child .unit,
.stats-row .stat-card:first-child .slash,
.stats-row .stat-card:first-child .accent {
  color: #9ba5a2;
}

.stats-row .stat-card:first-child .stat-value {
  color: #fff;
  font-size: 34px;
}

.stats-row .stat-card:first-child .balance-value { color: #fff !important; }

.stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.stat-value .unit {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
  margin-left: 3px;
}

.stat-value .slash { color: var(--muted); font-weight: 600; margin: 0 4px; font-size: 20px; }
.stat-value .accent { color: var(--primary); }
.muted { color: var(--muted); font-weight: 400; }

.balance-value { color: var(--primary) !important; }

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
  gap: 18px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.main-col { min-width: 0; }
.side-stack { display: flex; flex-direction: column; gap: 16px; }
.side-stack .stat-card { box-shadow: var(--shadow); }

.availability-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #efc9ce;
  border-radius: 5px;
  background: var(--red-soft);
  color: var(--red);
}

.availability-alert .availability-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-weight: 700;
  line-height: 1;
}

.availability-alert strong { display: block; font-size: 14px; }
.availability-alert p { margin: 4px 0 0; color: #845057; font-size: 12px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 650;
  font-size: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: #f8faf9;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e8ecea;
  color: var(--text);
  white-space: nowrap;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:not(.empty-row):hover { background: #fbfcfc; }
.empty-row td { text-align: center; color: var(--muted); padding: 26px 0; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  padding: 3px 8px;
  background: var(--bg);
  color: #596360;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8e9895;
}

.status-success { background: var(--primary-soft); color: var(--primary); }
.status-running { background: var(--primary-soft); color: var(--primary); }
.status-waiting { background: var(--amber-soft); color: var(--amber); }
.status-error { background: var(--red-soft); color: var(--red); }
.status-success::before, .status-running::before { background: var(--primary); }
.status-waiting::before { background: var(--amber); }
.status-error::before { background: var(--red); }

.change-plus { color: var(--primary); font-weight: 700; }
.change-minus { color: var(--red); font-weight: 700; }

.text-ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }

.row-action {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 12px;
}

.row-action:hover { border-color: #b8c1be; color: var(--text); }

/* ---------- 文本域与代码 ---------- */
.code-textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid #cfd6d4;
  border-radius: 5px;
  padding: 12px;
  background: var(--paper);
  color: var(--text);
  line-height: 1.55;
  outline: none;
  font-family: Consolas, "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
}

.code-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8, 127, 106, 0.1); }
.code-textarea::placeholder { color: #9ca6a3; }

.code-block {
  margin: 0;
  padding: 15px 16px;
  background: var(--sidebar);
  color: #dbe7e3;
  border-radius: 5px;
  font-family: Consolas, "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}

.counter {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin-top: 8px;
}

.counter span { color: var(--primary); font-weight: 700; }

.panel-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.hint-line {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}

.quota-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 0;
}

/* ---------- 流水列表 ---------- */
.flow-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.flow-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px solid #e8ecea;
}

.flow-list li:last-child { border-bottom: none; }

.flow-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.flow-type .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.flow-type.recharge .dot { background: var(--primary); }
.flow-type.deduct .dot { background: var(--red); }

.flow-detail { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.flow-time { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.flow-amount { font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ---------- 信息列表 ---------- */
.info-list { margin: 0; }

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #e8ecea;
}

.info-row:last-child { border-bottom: none; }
.info-row dt { font-size: 13px; color: var(--text-2); }
.info-row dd { margin: 0; font-size: 14px; font-weight: 700; }

/* ---------- 系统配置表单 ---------- */
.settings-form { display: grid; gap: 16px; }

.settings-form label {
  display: grid;
  gap: 8px;
  color: #3e4846;
  font-size: 13px;
  font-weight: 650;
}

.settings-form input[type="number"] {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #cfd6d4;
  border-radius: 5px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.settings-form input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 127, 106, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.check-row {
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 10px !important;
  padding: 13px;
  background: var(--bg);
  border-radius: 5px;
  cursor: pointer;
}

.check-row input {
  width: 17px;
  min-height: 17px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.check-row span,
.check-row strong,
.check-row small {
  display: block;
}

.check-row strong { font-size: 13px; color: var(--text); }
.check-row small { margin-top: 4px; color: var(--muted); font-weight: 400; line-height: 1.5; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 4px;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 18, 16, 0.58);
  backdrop-filter: blur(3px);
}

.modal {
  width: 420px;
  background: #fff;
  border-radius: 7px;
  padding: 24px;
  box-shadow: 0 16px 44px rgba(17, 29, 26, 0.08);
}

.modal h3 { margin: 0 0 20px; font-size: 18px; }
.modal-sub { margin: 0 0 18px; color: var(--muted); font-size: 12px; }

.modal label {
  display: block;
  font-size: 13px;
  font-weight: 650;
  color: var(--text-2);
  margin: 12px 0 7px;
}

.modal input {
  width: 100%;
  border: 1px solid #cfd6d4;
  border-radius: 5px;
  min-height: 42px;
  padding: 9px 11px;
  outline: none;
  background: var(--paper);
}

.modal input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8, 127, 106, 0.1); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.secret-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-soft);
  border: 1px solid #c9e8df;
  border-radius: 5px;
  padding: 14px;
}

.secret-box code {
  flex: 1;
  color: var(--primary-2);
  font-size: 12px;
  word-break: break-all;
  font-family: Consolas, monospace;
  line-height: 1.6;
}

.secret-box .btn-secondary { flex-shrink: 0; padding: 7px 12px; font-size: 12px; }

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--sidebar);
  color: #fff;
  border-radius: 5px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: 0 16px 44px rgba(17, 29, 26, 0.08);
  animation: toastIn 0.2s ease;
  max-width: 380px;
}

.toast.success { background: var(--primary-2); }
.toast.error { background: #7d2931; }
.toast.info { background: var(--sidebar); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1100px) {
  .panel-grid, .workbench { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .stats-row.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 78px; }
  .sidebar-brand-text, .nav-item span, .sidebar-user-info, .logout-btn { display: none; }
  .nav-item { justify-content: center; }
  .sidebar-user { justify-content: center; padding: 12px 0; }
}

@media (max-width: 920px) {
  .login-page { grid-template-columns: 1fr; }
  .login-top { min-height: 116px; padding: 24px; }
  .login-top:after { display: none; }
  .login-center { padding: 38px 20px; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 20px; }
  #pageContent { padding: 22px 20px 42px; }
  .stats-row .stat-card:first-child .stat-value { font-size: 29px; }
  .stat-card { padding: 20px; }
  .stats-row.cols-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ---------- 手机端适配：侧边栏转为底部导航 ---------- */
@media (max-width: 768px) {
  .app {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: 100%;
    flex-direction: row;
    align-items: stretch;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid #303836;
  }

  .sidebar-brand { display: none; }

  .nav {
    flex: 1;
    display: flex;
    gap: 2px;
    margin-top: 0;
  }

  .nav-item {
    flex: 1;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-height: 52px;
    padding: 4px 2px;
    border-radius: 6px;
  }

  .nav-item svg { width: 20px; height: 20px; }

  .nav-item span {
    display: block;
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
  }

  .sidebar-user {
    margin: 0 0 0 2px;
    padding: 0;
    border-top: none;
    justify-content: center;
  }

  .sidebar-user .avatar,
  .sidebar-user-info { display: none; }

  .logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-height: 52px;
  }

  .main { min-height: 0; }

  .topbar { min-height: 54px; padding: 0 16px; }
  .topbar h2 { font-size: 16px; }
  .topbar-right { gap: 10px; }
  .sync-badge { display: none; }

  #pageContent {
    padding: 16px 14px calc(86px + env(safe-area-inset-bottom));
  }

  .panel { padding: 16px 14px; }
  .panel + .panel { margin-top: 14px; }
  .panel-head { flex-wrap: wrap; row-gap: 4px; }
  .panel-head.between { flex-wrap: wrap; gap: 10px; }

  .stats-row { gap: 10px; margin-bottom: 14px; }
  .stats-row.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 20px; }
  .stats-row .stat-card:first-child .stat-value { font-size: 26px; }

  .panel-grid, .workbench { gap: 14px; }

  /* iOS 聚焦输入框时防止自动放大 */
  input, select, textarea { font-size: 16px; }

  .panel-actions { flex-wrap: wrap; }
  .panel-actions .btn-primary,
  .panel-actions .btn-secondary { flex: 1; min-height: 42px; }
  .form-actions .btn-primary,
  .form-actions .btn-secondary { flex: 1; }

  .table-wrap { -webkit-overflow-scrolling: touch; }
  .text-ellipsis { max-width: 160px; }

  .modal-mask { padding: 16px; }
  .modal {
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px 16px;
  }
  .modal-actions .btn-primary,
  .modal-actions .btn-secondary { flex: 1; }

  .toast-stack {
    left: 14px;
    right: 14px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    align-items: center;
  }
  .toast { max-width: 100%; }

  .login-top { padding: 20px; min-height: 0; }
  .login-center { padding: 30px 18px 40px; }
  .login-subtitle { margin-bottom: 24px; }
}
