/* ===== 浅色主题 CSS 变量 ===== */
:root {
  color-scheme: light;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-secondary: #e2e8f0;

  --border: rgba(148, 163, 184, 0.25);
  --border-light: rgba(148, 163, 184, 0.12);

  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --primary: #3b82f6;
  --primary-light: #eff6ff;
  --primary-gradient: linear-gradient(135deg, #3b82f6, #2563eb);
  --primary-hover: #2563eb;
  --primary-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);

  --income: #16a34a;
  --income-bg: #f0fdf4;
  --expense: #ea580c;
  --expense-bg: #fff7ed;
  --balance: #7c3aed;

  --danger: #dc2626;
  --danger-hover: #b91c1c;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --nav-height: 56px;
}

/* ===== 全局重置 ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  height: 100%;
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #f0f4ff 0%, #f8fafc 30%, #f1f5f9 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶部导航 ===== */
.navbar {
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.navbar-time {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.navbar-brand .brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 3px;
}

.nav-tab {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 20px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
}

.nav-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* 移动端余额概览条 */
.mobile-balance-bar {
  display: none;
  padding: 8px 16px;
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
  align-items: center;
  font-size: 13px;
  flex-shrink: 0;
}

.mobile-balance-bar .mb-label {
  color: var(--text-muted);
  font-weight: 500;
}

.mobile-balance-bar .mb-total {
  font-weight: 700;
  color: var(--balance);
}

.mobile-balance-bar .mb-mine {
  font-weight: 600;
  color: var(--income);
}

.mobile-balance-bar .mb-other {
  font-weight: 600;
  color: var(--expense);
}

/* ===== 主布局 ===== */
.layout {
  position: relative;
  overflow: hidden;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  height: calc(100vh - var(--nav-height));
}

.tab-track {
  display: flex;
  width: 300%;
  height: 100%;
  will-change: transform;
  transition: transform 0.35s ease;
}

.tab-content {
  flex: 0 0 33.333%;
  overflow-y: auto;
}

.tab-content.active {
  /* 由轨道位置控制，无需额外样式 */
}

/* ==== 聊天 Tab 布局 ==== */
.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  height: calc(100vh - var(--nav-height) - 48px);
  min-height: 580px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.chat-header h1 {
  font-size: 16px;
  font-weight: 600;
}

.chat-actions {
  display: flex;
  gap: 8px;
}

.chat-actions button {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-actions button:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* 消息列表 */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 14px;
  word-break: break-word;
  position: relative;
  animation: messageIn 0.2s ease;
}

.message.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-bottom-left-radius: 4px;
}

.message .meta {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.7;
}

.message.user .meta {
  color: rgba(255, 255, 255, 0.75);
}

.message .time {
  display: inline-block;
  font-size: 11px;
  margin-left: 8px;
  opacity: 0.5;
}

.message.user .time {
  color: rgba(255, 255, 255, 0.65);
}

/* 消息输入区 */
.composer {
  display: flex;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-light);
  align-items: flex-end;
}

.composer textarea {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.composer button {
  border: 0;
  border-radius: var(--radius-md);
  padding: 0 20px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: var(--primary-gradient);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: var(--primary-shadow);
}

.composer button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.composer button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* 聊天侧栏 */
.chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.sidebar-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
  border: 1px solid var(--border-light);
}

.sidebar-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

/* 余额卡片组 */
.balance-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.balance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.balance-item .label {
  font-size: 13px;
  color: var(--text-secondary);
}

.balance-item .value {
  font-size: 20px;
  font-weight: 700;
}

.balance-item.total .value {
  color: var(--balance);
}

.balance-item.mine .value {
  color: var(--income);
}

.balance-item.other .value {
  color: var(--expense);
}

.receiver-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  font-size: 13px;
}

.receiver-row .label {
  color: var(--text-secondary);
}

.receiver-row .name {
  font-weight: 600;
  color: var(--primary);
}

/* 最近账单列表 */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-item {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border-left: 3px solid var(--primary);
  transition: background 0.15s ease;
  cursor: pointer;
}

.recent-item.type-income {
  border-left-color: var(--income);
  background: var(--income-bg);
}

.recent-item.type-expense {
  border-left-color: var(--expense);
  background: var(--expense-bg);
}

.recent-item:hover {
  background: var(--bg-hover);
}

.recent-item.type-income:hover {
  background: #dcfce7;
}

.recent-item.type-expense:hover {
  background: #fed7aa;
}

.recent-item .top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.recent-item .category {
  font-weight: 600;
  font-size: 13px;
}

.recent-item .amount {
  font-weight: 700;
  font-size: 14px;
}

.recent-item .amount.income {
  color: var(--income);
}

.recent-item .amount.expense {
  color: var(--expense);
}

.recent-item .bottom {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.recent-item .split-line {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-light);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== 账单 Tab ===== */
.bills-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height) - 48px);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.bills-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 12px;
}

.bills-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.bills-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bills-filters select,
.bills-filters input {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
}

.bills-filters select:focus,
.bills-filters input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.bills-summary {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.bills-summary .stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bills-summary .stat .val {
  font-weight: 700;
}

.bills-list {
  padding: 12px 20px;
  flex: 1;
  overflow-y: auto;
}

.bill-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border-left: 3px solid var(--primary);
  margin-bottom: 8px;
  transition: background 0.15s ease;
}

.bill-item.type-income {
  border-left-color: var(--income);
  background: var(--income-bg);
}

.bill-item.type-expense {
  border-left-color: var(--expense);
  background: var(--expense-bg);
}

.bill-item:hover {
  background: var(--bg-hover);
}

.bill-item .bill-main {
  flex: 1;
  min-width: 0;
}

.bill-item .bill-category {
  font-weight: 600;
  font-size: 14px;
}

.bill-item .bill-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bill-item .bill-side {
  text-align: right;
}

.bill-item .bill-amount {
  font-weight: 700;
  font-size: 15px;
}

.bill-item .bill-amount.income {
  color: var(--income);
}

.bill-item .bill-amount.expense {
  color: var(--expense);
}

.bill-item .bill-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.bill-item .bill-split {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.bills-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
}

.bills-pagination button {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bills-pagination button:hover:not(:disabled) {
  background: var(--bg-hover);
}

.bills-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bills-pagination .page-info {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== 账户 Tab ===== */
.account-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.account-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  border: 1px solid var(--border-light);
}

.account-card.full-width {
  grid-column: 1 / -1;
}

.account-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.account-card .big-number {
  font-size: 36px;
  font-weight: 800;
}

.account-card .big-number.primary {
  color: var(--balance);
}

.account-card .big-number.green {
  color: var(--income);
}

.account-card .big-number.orange {
  color: var(--expense);
}

.account-card .balance-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.account-card .account-unit {
  font-size: 13px;
  color: var(--text-muted);
}

.account-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.stat-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg);
  text-align: center;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
}

.stat-card .stat-value.green {
  color: var(--income);
}

.stat-card .stat-value.orange {
  color: var(--expense);
}

.receiver-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.receiver-card .rc-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
}

.receiver-card .rc-info .rc-label {
  font-size: 12px;
  color: var(--text-muted);
}

.receiver-card .rc-info .rc-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

/* 伙伴余额条 */
.partner-bar {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.partner-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.partner-row .p-name {
  width: 60px;
  font-weight: 500;
  text-align: right;
  flex-shrink: 0;
}

.partner-row .p-bar {
  flex: 1;
  height: 10px;
  background: var(--bg-secondary);
  border-radius: 5px;
  overflow: hidden;
}

.partner-row .p-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}

.partner-row .p-fill.blue {
  background: var(--primary);
}

.partner-row .p-fill.purple {
  background: var(--balance);
}

.partner-row .p-value {
  width: 70px;
  font-weight: 600;
  font-size: 13px;
}

/* ===== 骨架屏 ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, #e2e8f0 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-card {
  height: 80px;
  margin-bottom: 10px;
}

.skeleton-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===== Loading spinner ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== Toast 通知 ===== */
.toast-container {
  position: fixed;
  top: calc(var(--nav-height) + 16px);
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease, toastOut 0.25s ease 2.5s forwards;
  max-width: 360px;
}

.toast.success {
  border-left: 3px solid var(--income);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.warn {
  border-left: 3px solid var(--expense);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
}

.empty-state .empty-text {
  font-size: 14px;
}

.empty-state .empty-hint {
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.7;
}

/* ===== 动画 ===== */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-100%); opacity: 0; }
}
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}
@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== 弹窗 (浅色主题) ===== */
.dialog-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 150;
  align-items: center;
  justify-content: center;
}

.dialog-overlay.open {
  display: flex;
}

.dialog {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  width: min(440px, calc(100vw - 32px));
  animation: fadeSlideIn 0.25s ease;
  border: 1px solid var(--border-light);
}

.dialog h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.dialog p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.dialog input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

.dialog input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.dialog-actions button {
  border: 0;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: var(--primary-shadow);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

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

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

/* 身份选择弹窗 */
.viewer-role-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.viewer-role-body button {
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.viewer-role-body .btn-a {
  border: 2px solid var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.viewer-role-body .btn-a:hover {
  background: var(--primary);
  color: white;
}

.viewer-role-body .btn-l {
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
}

.viewer-role-body .btn-l:hover {
  border-color: var(--text);
  color: var(--text);
}

/* ===== 通用组件 ===== */
.ghost-button {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ghost-button:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge.income {
  background: var(--income-bg);
  color: var(--income);
}

.badge.expense {
  background: var(--expense-bg);
  color: var(--expense);
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ===== 响应式：平板 ===== */
@media (max-width: 768px) {
  .navbar {
    padding: 0 16px;
  }

  .navbar-brand {
    font-size: 16px;
  }

  .nav-tab {
    padding: 6px 14px;
    font-size: 13px;
  }

  .layout {
    padding: 16px;
    overflow: hidden;
  }

  /* 废弃传送带，改用 display 切换 */
  .tab-track {
    width: 100%;
    height: auto;
    transform: none !important;
    transition: none;
  }

  .tab-content {
    display: none;
    flex: none;
    width: 100%;
  }

  .tab-content.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--nav-height) - 32px);
  }

  .chat-layout {
    grid-template-columns: 1fr;
    height: 100%;
  }

  .chat-sidebar {
    display: none;
  }

  .mobile-balance-bar {
    display: flex;
  }

  .bills-panel {
    height: 100%;
  }

  .account-container {
    grid-template-columns: 1fr;
  }

  .account-card.full-width {
    grid-column: 1;
  }

  .bills-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .bills-filters {
    width: 100%;
    flex-direction: column;
  }

  .bills-filters select,
  .bills-filters input {
    flex: 1;
    width: 100%;
  }

  .bills-summary {
    flex-wrap: wrap;
    gap: 8px;
  }

  .message {
    max-width: 88%;
  }

  .dialog {
    margin: 16px;
  }
}

/* ===== 响应式：手机 ===== */
@media (max-width: 480px) {
  .layout {
    padding: 12px;
    height: calc(100vh - var(--nav-height));
  }

  .chat-layout {
    height: 100%;
  }

  .composer {
    padding: 10px 12px;
  }

  .composer textarea {
    font-size: 16px; /* prevent iOS zoom */
  }

  .composer button {
    padding: 0 14px;
    font-size: 13px;
    min-height: 42px;
  }

  .bills-list {
    flex: 1;
  }

  .toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .toast {
    max-width: calc(100vw - 24px);
  }
}