/* 移动端优先，桌面端通过 min-width 媒体查询增强 */
:root {
  --bg-app: #1a1a2e;
  --bg-panel: #16213e;
  --bg-surface: #0f3460;
  --bg-hover: rgba(255,255,255,.06);
  --border: rgba(255,255,255,.1);
  --text: #e8eaf0;
  --text-muted: #94a3b8;
  --primary: #4f8cff;
  --primary-dark: #3b6fd4;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --header-h: 52px;
  --toolbar-h: 44px;
  --status-h: auto;
  --sidebar-w: min(88vw, 320px);
  --radius: 10px;
  --font: "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  --touch-min: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-app);
  overflow: hidden;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; }
input, select, textarea {
  font-size: 16px; /* 避免 iOS 聚焦时自动放大 */
}
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.boot-splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: var(--bg-app); color: var(--text);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}
.boot-spinner {
  width: 32px; height: 32px; border: 3px solid #333;
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-title { font-size: 20px; font-weight: 700; }
.boot-hint { font-size: 13px; color: var(--text-muted); text-align: center; padding: 0 24px; }

.app-root {
  display: flex; flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* ---------- 顶栏（移动端紧凑） ---------- */
.app-header {
  min-height: var(--header-h); flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  padding-top: max(6px, var(--safe-top));
  background: #12122a; border-bottom: 1px solid var(--border);
}
.app-header-main {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; flex: 1; overflow: hidden;
}
.app-logo {
  font-weight: 700; color: #fff; white-space: nowrap;
  font-size: 15px; flex-shrink: 0;
}
.app-header-actions {
  display: none; /* 移动端放入底部操作面板 */
  flex-wrap: wrap; gap: 6px;
}
.app-header-user {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}

.btn-icon {
  width: var(--touch-min); height: var(--touch-min);
  min-width: var(--touch-min); min-height: var(--touch-min);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: rgba(255,255,255,.06); color: var(--text);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 0;
}
.btn-icon:active { background: rgba(255,255,255,.12); }

/* ---------- 侧边栏抽屉 ---------- */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.45);
  opacity: 0; transition: opacity .2s ease;
}
.app-root.sidebar-open .sidebar-backdrop {
  display: block; opacity: 1;
}

.app-body { display: flex; flex: 1; min-height: 0; position: relative; }

.app-sidebar {
  position: fixed; z-index: 210;
  top: calc(var(--header-h) + var(--safe-top));
  left: 0; bottom: 0;
  width: var(--sidebar-w);
  max-width: 100%;
  display: flex; flex-direction: column;
  background: #12122a; border-right: 1px solid var(--border);
  transform: translateX(-105%);
  transition: transform .25s ease;
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
  padding-bottom: var(--safe-bottom);
}
.app-root.sidebar-open .app-sidebar { transform: translateX(0); }

.sidebar-search { padding: 10px; }
.sidebar-search input {
  width: 100%; height: var(--touch-min); border: 1px solid var(--border);
  border-radius: var(--radius); background: rgba(0,0,0,.2);
  color: var(--text); padding: 0 12px;
}
.sidebar-tree { flex: 1; overflow: auto; padding: 4px 0; -webkit-overflow-scrolling: touch; }
.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }

.tree-node { user-select: none; }
.tree-row {
  display: flex; align-items: center; gap: 8px;
  min-height: var(--touch-min); padding: 8px 12px;
  cursor: pointer; border-radius: 6px; margin: 2px 6px;
}
.tree-row:hover { background: var(--bg-hover); }
.tree-row.active { background: rgba(79,140,255,.18); color: #fff; }
.tree-toggle { width: 16px; text-align: center; color: var(--text-muted); font-size: 11px; flex-shrink: 0; }
.tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-children { padding-left: 10px; }

/* ---------- 主内容区 ---------- */
.app-main {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0; width: 100%;
  background: #fff; color: #333;
}
.app-toolbar {
  min-height: var(--toolbar-h); flex-shrink: 0;
  display: flex; align-items: stretch; gap: 0;
  background: #f5f7fb; border-bottom: 1px solid #e2e8f0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.app-toolbar::-webkit-scrollbar { display: none; }
.toolbar-tab {
  border: none; background: none;
  min-height: var(--toolbar-h); padding: 0 14px;
  cursor: pointer; color: #64748b; font-weight: 500;
  white-space: nowrap; flex-shrink: 0;
  border-bottom: 2px solid transparent;
  scroll-snap-align: start;
  font-size: 13px;
}
.toolbar-tab:hover { color: #334155; background: rgba(0,0,0,.03); }
.toolbar-tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); background: #fff; }

.app-view-host { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.view-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.view-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border-bottom: 1px solid #e2e8f0; background: #fafbfc;
}
.view-toolbar .btn { flex-shrink: 0; }
.view-toolbar input[type="search"] {
  flex: 1; min-width: 120px; height: 36px;
  border: 1px solid #cbd5e1; border-radius: 8px; padding: 0 10px;
}
.view-content { flex: 1; overflow: auto; padding: 0; -webkit-overflow-scrolling: touch; }

.table-scroll {
  width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.table-scroll .data-table { min-width: 560px; }

.app-statusbar {
  flex-shrink: 0;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  padding: 8px 12px;
  padding-bottom: max(8px, var(--safe-bottom));
  font-size: 11px; color: var(--text-muted);
  background: #12122a; border-top: 1px solid var(--border);
  min-height: 36px;
}
.app-statusbar > span.status-brand { margin-left: auto; }
.status-user { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-counts { display: none; }
.status-brand { color: #64748b; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: var(--touch-min); padding: 0 14px;
  border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; font-size: 13px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 12px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-default { background: rgba(255,255,255,.08); color: var(--text); border-color: var(--border); }
.app-main .btn-default,
.modal .btn-default {
  background: #f8fafc; color: #334155; border-color: #cbd5e1;
}
.btn-default:hover:not(:disabled) { background: rgba(255,255,255,.12); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; border-color: #d97706; }
.btn-warning:hover:not(:disabled) { background: #d97706; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }

.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th, .data-table td {
  padding: 10px 12px; border-bottom: 1px solid #e2e8f0; text-align: left;
}
.data-table th { background: #f8fafc; font-weight: 600; position: sticky; top: 0; z-index: 1; }
.data-table tr:hover td { background: #f1f5f9; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table input.mat-edit { min-height: 36px; font-size: 14px; }

.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: #94a3b8; padding: 32px 20px; text-align: center;
}
.login-panel {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
  padding: 16px;
}
.login-card {
  width: min(400px, 100%); background: #fff; border-radius: 14px;
  padding: 24px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.08); text-align: center;
}
.login-card h2 { margin: 0 0 8px; color: #0f172a; font-size: 20px; }
.login-card p { margin: 0 0 20px; color: #64748b; font-size: 14px; }

/* ---------- 弹窗（移动端接近全屏） ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
.modal {
  background: #fff; color: #333;
  border-radius: 16px 16px 0 0;
  width: 100%; max-height: min(92vh, 92dvh);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 -8px 40px rgba(0,0,0,.2);
}
.modal-lg { max-height: min(96vh, 96dvh); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid #e2e8f0; font-weight: 600;
  font-size: 16px; flex-shrink: 0;
}
.modal-body { padding: 16px 18px; overflow: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.modal-footer {
  display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px;
  padding: 12px 18px; padding-bottom: max(12px, var(--safe-bottom));
  border-top: 1px solid #e2e8f0; flex-shrink: 0;
}
.modal-footer .btn { flex: 1; min-width: 120px; }
.modal-close {
  width: 40px; height: 40px;
  border: none; background: #f1f5f9; border-radius: 50%;
  font-size: 22px; cursor: pointer; color: #64748b;
  display: flex; align-items: center; justify-content: center;
}

.form-field { margin-bottom: 14px; }
.form-field label { display: block; margin-bottom: 6px; font-size: 13px; color: #64748b; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 8px;
  padding: 10px 12px; min-height: var(--touch-min);
}
.form-field textarea { min-height: 100px; resize: vertical; min-height: auto; padding-top: 10px; }
.form-msg { font-size: 13px; color: var(--danger); margin-top: 8px; }
.form-tabs {
  display: flex; gap: 6px; margin-bottom: 16px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.form-tab {
  border: none; background: #f1f5f9; padding: 10px 14px;
  border-radius: 8px; cursor: pointer; white-space: nowrap; flex-shrink: 0;
  min-height: 40px;
}
.form-tab.active { background: var(--primary); color: #fff; }

/* ---------- 登录弹窗（对齐 C++ AuthModal + AuthViewWidget embedded） ---------- */
.auth-modal-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(15, 23, 42, 0.32);
  display: flex; align-items: center; justify-content: center;
  padding: max(16px, var(--safe-top)) 16px max(16px, var(--safe-bottom));
}
.auth-modal-panel {
  position: relative;
  width: min(400px, 100%);
  max-height: min(92vh, 720px);
  overflow: auto;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  padding: 24px 24px 22px;
  -webkit-overflow-scrolling: touch;
}
.auth-modal-close {
  position: absolute; top: 18px; right: 18px;
  width: 28px; height: 28px;
  border: none; border-radius: 6px;
  background: #ffffff; color: #b0b8c4;
  font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.auth-modal-close:hover { background: #f4f6f9; color: #6b7280; }
.auth-modal-hint {
  margin: 0 36px 14px 0;
  padding: 7px 10px;
  background: #e8f0fe;
  border-radius: 7px;
  font-size: 12px;
  color: #2b6de5;
  line-height: 1.45;
}
.auth-view.embedded { color: #1a1a1a; }
.auth-tabs {
  display: flex; gap: 4px;
  margin: 0 0 20px;
  padding: 3px;
  background: #f4f6f9;
  border-radius: 9px;
}
.auth-tab {
  flex: 1;
  border: none; border-radius: 7px;
  background: transparent;
  color: #7a8494;
  font-size: 13px; font-weight: 500;
  padding: 8px 0;
  min-height: 36px;
  cursor: pointer;
}
.auth-tab.active {
  background: #ffffff;
  color: #1a1a1a;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
.auth-mode-title {
  margin: 0 0 16px;
  font-size: 14px; font-weight: 600;
  color: #1a1a1a;
}
.auth-field { margin-bottom: 14px; }
.auth-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #5c6678;
}
.auth-input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #e5e8ef;
  border-radius: 8px;
  background: #ffffff;
  color: #1a1a1a;
  font-size: 16px;
}
.auth-input:focus {
  outline: none;
  border-color: #2b6de5;
  box-shadow: 0 0 0 3px rgba(43, 109, 229, 0.12);
}
.auth-sms-row {
  display: flex;
  align-items: stretch;
  border: 1px solid #e5e8ef;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}
.auth-sms-row .auth-input {
  border: none;
  border-radius: 0;
  flex: 1;
  min-width: 0;
}
.auth-sms-row .auth-input:focus { box-shadow: none; }
.auth-sms-btn {
  flex-shrink: 0;
  min-width: 92px;
  padding: 0 12px;
  border: none;
  border-left: 1px solid #eef1f6;
  background: #fafbfc;
  color: #2b6de5;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.auth-sms-btn:disabled { color: #999999; }
.auth-optional-sep {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 0 12px;
  color: #e8e8e8;
  font-size: 11px;
}
.auth-optional-sep::before,
.auth-optional-sep::after {
  content: ""; flex: 1; height: 1px; background: #e8e8e8;
}
.auth-optional-sep span { color: #999999; white-space: nowrap; }
.auth-terms {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 6px 0 14px;
  font-size: 12px; color: #6b7280;
  cursor: pointer;
}
.auth-terms input { margin-top: 2px; flex-shrink: 0; }
.auth-terms-link {
  border: none; background: transparent;
  color: #2b6de5; font-size: 12px;
  text-decoration: underline; padding: 0; cursor: pointer;
}
.auth-msg {
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
}
.auth-msg-error {
  background: #fff1f0;
  border: 1px solid #ffccc7;
  color: #cf1322;
}
.auth-msg-success {
  background: #f6ffed;
  border: 1px solid #b7eb8f;
  color: #389e0d;
}
.auth-submit {
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  border: none;
  border-radius: 8px;
  background: #2b6de5;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.auth-submit:hover:enabled { background: #1a5cd4; }
.auth-submit:disabled { background: #a0c4f5; cursor: not-allowed; }
.auth-footer { margin-top: 12px; text-align: center; }
.auth-link {
  border: none; background: transparent;
  color: #2b6de5; font-size: 12px;
  text-decoration: underline; cursor: pointer; padding: 0;
}
.auth-hint { font-size: 11px; color: #999999; margin: 0; }
.auth-account-item {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
  cursor: pointer;
}

.wallet-badge {
  font-size: 11px; color: #cbd5e1; padding: 4px 8px;
  background: rgba(255,255,255,.06); border-radius: 6px;
  display: none; /* 移动端顶栏太挤，余额在用户菜单里可看 */
}
.wallet-badge strong { color: #86efac; }

.status-pending { color: #f59e0b; font-size: 11px; font-weight: 600; }
.status-link {
  font-size: 11px; color: #94a3b8 !important;
  min-height: 32px; padding: 0 8px !important;
}

.detail-form .form-field input { width: 100%; max-width: none; }

/* ---------- 移动端快捷操作面板 ---------- */
.mobile-actions-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 180;
  background: rgba(0,0,0,.4);
}
.app-root.actions-open .mobile-actions-backdrop { display: block; }

.mobile-actions-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 190;
  background: #fff; color: #333;
  border-radius: 16px 16px 0 0;
  padding: 12px 16px max(16px, var(--safe-bottom));
  transform: translateY(105%);
  transition: transform .25s ease;
  box-shadow: 0 -8px 32px rgba(0,0,0,.15);
  max-height: 70vh; overflow: auto;
}
.app-root.actions-open .mobile-actions-sheet { transform: translateY(0); }
.mobile-actions-title {
  font-weight: 600; font-size: 15px; margin-bottom: 12px; color: #0f172a;
}
.mobile-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.mobile-action-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-height: 72px; padding: 10px 6px;
  border: 1px solid #e2e8f0; border-radius: 12px;
  background: #f8fafc; color: #334155;
  cursor: pointer; font-size: 12px; text-align: center;
}
.mobile-action-btn:active { background: #eef2ff; border-color: var(--primary); }
.mobile-action-btn .icon { font-size: 20px; line-height: 1; }

/* ---------- 任务坞 ---------- */
.task-dock {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(48px + var(--safe-bottom));
  z-index: 50;
  display: flex; flex-direction: column-reverse; gap: 8px;
  max-width: none; pointer-events: none;
}
.task-card {
  pointer-events: auto; background: #fff; color: #333; border-radius: 10px;
  padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  border-left: 3px solid var(--primary); font-size: 13px;
}
.task-card.done { border-left-color: var(--success); }
.task-card.error { border-left-color: var(--danger); }

.pagination {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px; border-top: 1px solid #e2e8f0; background: #fafbfc; font-size: 12px;
}
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: #e2e8f0; font-size: 11px;
}
.chip.on { background: #dcfce7; color: #166534; }
.chip.off { background: #fee2e2; color: #991b1b; }
.btn-link {
  border: none; background: none; color: #2563eb; cursor: pointer; font-size: inherit;
  text-decoration: underline; padding: 0;
}

.hub-tabs {
  display: flex; gap: 6px; padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
}
.hub-tab {
  border: none; background: #f1f5f9; padding: 8px 14px;
  border-radius: 8px; cursor: pointer; white-space: nowrap; flex-shrink: 0;
  min-height: 40px;
}
.hub-tab.active { background: #dbeafe; color: #1d4ed8; font-weight: 600; }

.split-layout { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.split-list {
  width: 100%; max-height: 40vh; border-right: none;
  border-bottom: 1px solid #e2e8f0; overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.split-list-header {
  display: flex; gap: 8px; padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9; background: #fafbfc;
  position: sticky; top: 0; z-index: 1;
}
.report-filter label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: #64748b;
}
.report-filter input[type="date"] {
  height: 32px; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0 8px;
}
.detail-form select[multiple] { width: 100%; min-height: 72px; }
.tree-node-sub .tree-row { padding-left: 22px; font-size: 12px; }
.tree-node-sub .tree-label { color: #475569; }
.mat-sync-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 600;
}
.mat-sync-new { background: #dbeafe; color: #1d4ed8; }
.mat-sync-modified { background: #fef3c7; color: #b45309; }
.mat-sync-deleted { background: #fee2e2; color: #b91c1c; }
.data-table .mat-check { width: 16px; height: 16px; }
.split-detail { flex: 1; overflow: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
.list-item {
  padding: 12px 14px; border-bottom: 1px solid #f1f5f9; cursor: pointer;
  min-height: var(--touch-min); display: flex; align-items: center;
}
.list-item:hover { background: #f8fafc; }
.list-item.active { background: #eff6ff; border-left: 3px solid var(--primary); }

.user-dropdown {
  position: fixed; right: 12px;
  top: calc(var(--header-h) + var(--safe-top) + 4px);
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15);
  z-index: 300; min-width: 180px; padding: 6px;
  max-width: calc(100vw - 24px);
}
.user-dropdown .btn { justify-content: flex-start; margin: 4px 0; width: 100%; color: #334155; }

#btn-user-menu {
  max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- 平板 / 桌面增强 ---------- */
@media (min-width: 768px) {
  :root {
    --header-h: 48px;
    --toolbar-h: 40px;
    --sidebar-w: 260px;
  }

  body { font-size: 13px; }

  .app-header { padding: 0 12px; gap: 12px; }
  .btn-menu, .btn-more { display: none; }
  .sidebar-backdrop { display: none !important; }

  .app-sidebar {
    position: relative; z-index: auto;
    top: auto; transform: none !important;
    box-shadow: none; flex-shrink: 0;
    width: var(--sidebar-w);
  }
  .app-root.sidebar-open .app-sidebar { transform: none; }

  .app-header-actions { display: flex; }
  .wallet-badge { display: inline-block; }

  .modal-backdrop { align-items: center; padding: 16px; }
  .modal {
    border-radius: 10px;
    width: min(720px, 100%);
    max-height: min(90vh, 800px);
  }
  .modal-lg { width: min(920px, 100%); }
  .modal-footer .btn { flex: none; min-width: auto; }

  .split-layout { flex-direction: row; }
  .split-list {
    width: 280px; max-height: none;
    border-bottom: none; border-right: 1px solid #e2e8f0;
  }

  .task-dock {
    left: auto; right: 16px; width: auto; max-width: 320px;
    bottom: calc(36px + var(--safe-bottom));
  }

  .mobile-actions-backdrop,
  .mobile-actions-sheet { display: none !important; }

  #btn-user-menu { max-width: none; }

  .status-counts { display: inline; }
  .status-user { max-width: none; }
}

@media (min-width: 1024px) {
  .app-header-actions .btn .label { display: inline; }
  .table-scroll .data-table { min-width: 100%; }
}

@media (max-width: 767px) {
  .app-header-actions .btn .label { display: inline; }
  .view-toolbar > span { width: 100%; order: 99; font-size: 11px; }
  .hub-tabs .btn { flex-shrink: 0; }
}

.ao-settings { margin-top: 16px; padding-top: 12px; border-top: 1px solid #e2e8f0; }
.ao-settings-table { font-size: 13px; }
.ao-settings-table td:last-child { width: 88px; white-space: nowrap; }

.ao-schedule-grid-wrap { max-height: 320px; overflow: auto; margin-top: 8px; }
.ao-schedule-grid { border-collapse: collapse; font-size: 10px; user-select: none; }
.ao-schedule-grid th, .ao-schedule-grid td { border: 1px solid #e2e8f0; padding: 0; text-align: center; }
.ao-schedule-grid .ao-sched-day { padding: 2px 6px; font-weight: 600; background: #f8fafc; position: sticky; left: 0; }
.ao-sched-cell { width: 14px; height: 14px; background: #f1f5f9; cursor: pointer; }
.ao-sched-cell.on { background: #22c55e; }
.ao-sched-cell:hover { outline: 1px solid #94a3b8; }
