/* =========================================================
 * 跑商数据面板 - 样式（深色 / 浅色双主题）
 * ========================================================= */

:root {
  --radius-card: 10px;
  --font: "Geist", "Microsoft YaHei", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
}

/* ---------- 深色主题（默认） ---------- */
[data-theme="dark"] {
  --bg: rgb(10, 14, 20);
  --panel: rgb(15, 21, 31);
  --panel-2: rgb(17, 27, 40);
  --border: rgb(36, 49, 66);
  --border-soft: rgb(30, 40, 55);
  --header-bg: rgba(9, 14, 22, 0.84);
  --header-border: rgba(42, 54, 72, 0.9);
  --text: rgb(234, 237, 242);
  --text-dim: rgb(159, 176, 195);
  --text-faint: rgb(110, 127, 148);
  --card-buy-text: rgb(226, 239, 255);
  --card-sell-text: rgb(229, 251, 236);
  --card-buy-bg: linear-gradient(rgba(113, 176, 255, 0.13) 0%, rgba(43, 97, 161, 0.08) 100%),
    linear-gradient(rgb(23, 48, 74) 0%, rgb(17, 37, 58) 100%);
  --card-buy-border: rgb(75, 133, 196);
  --card-buy-shadow: inset 0 1px 0 rgba(186, 220, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.22);
  --card-sell-bg: linear-gradient(rgba(102, 214, 145, 0.12) 0%, rgba(43, 122, 78, 0.08) 100%),
    linear-gradient(rgb(19, 44, 32) 0%, rgb(16, 36, 27) 100%);
  --card-sell-border: rgb(63, 140, 99);
  --card-sell-shadow: inset 0 1px 0 rgba(199, 255, 220, 0.07), 0 4px 12px rgba(0, 0, 0, 0.22);
  --dot-green: rgb(52, 180, 113);
  --dot-red: rgb(244, 74, 62);
  --dash-border: rgb(42, 55, 72);
  --gold-text: rgb(244, 213, 174);
  --gold-border: rgb(111, 86, 57);
  --countdown-bg: rgba(232, 163, 61, 0.07);
  --btn-gold-bg: linear-gradient(180deg, #edb45c, #dd9634);
  --btn-gold-text: #2b1d07;
  --accent-blue: rgb(74, 134, 197);
  --filter-border: rgb(53, 89, 138);
  --filter-text: rgb(215, 232, 255);
  --filter-bg: rgba(53, 89, 138, 0.12);
  --city-name: rgb(238, 244, 251);
  --city-cell-bg: rgba(17, 27, 40, 0.9);
  --city-cell-border: var(--border);
  --npc-label-bg: rgba(17, 27, 40, 0.9);
  --npc-label-border: var(--border-soft);
  --input-bg: rgb(13, 18, 26);
  --input-border: rgb(42, 54, 72);
  --modal-bg: rgb(17, 23, 33);
  --popover-bg: rgb(17, 24, 36);
  --scroll-thumb: rgb(45, 60, 80);
  --live-green: rgb(52, 199, 123);
  --profit-up: rgb(74, 222, 128);
  --profit-down: rgb(248, 113, 113);
  --route-label: rgb(127, 176, 232);
  --mask-bg: rgba(5, 8, 12, 0.7);
  --chip-pressed-bg: rgba(74, 134, 197, 0.18);
  --chip-pressed-border: rgb(74, 134, 197);
  --ico-buy-bg: #d9a441;
  --ico-sell-bg: #3fae74;
}

/* ---------- 浅色主题 ---------- */
[data-theme="light"] {
  --bg: #f6efe3;
  --panel: #fdf8ee;
  --panel-2: #faf3e4;
  --border: #e3d5bd;
  --border-soft: #eadfc9;
  --header-bg: rgba(253, 250, 243, 0.88);
  --header-border: #e8dcc4;
  --text: #40342a;
  --text-dim: #8a7a66;
  --text-faint: #ab9c88;
  --card-buy-text: #1e3a5f;
  --card-sell-text: #1d4a30;
  --card-buy-bg: linear-gradient(#e9f2fd, #d8e8fa);
  --card-buy-border: #a9c9ec;
  --card-buy-shadow: 0 2px 6px rgba(160, 140, 100, 0.12);
  --card-sell-bg: linear-gradient(#e7f5eb, #d5ecdc);
  --card-sell-border: #a2d0b3;
  --card-sell-shadow: 0 2px 6px rgba(160, 140, 100, 0.12);
  --dot-green: #2fa36a;
  --dot-red: #e04a3a;
  --dash-border: #d9c8ab;
  --gold-text: #9a6b1f;
  --gold-border: #d9b98a;
  --countdown-bg: #fbf3de;
  --btn-gold-bg: linear-gradient(180deg, #edb45c, #dd9634);
  --btn-gold-text: #33230a;
  --accent-blue: #3f7cc0;
  --filter-border: #b9d2ee;
  --filter-text: #2f5d9e;
  --filter-bg: #e9f1fc;
  --city-name: #2f5d8a;
  --city-cell-bg: #f8ead2;
  --city-cell-border: #ecd9ba;
  --npc-label-bg: #f8ead2;
  --npc-label-border: #ecd9ba;
  --input-bg: #fffdf8;
  --input-border: #ddceb2;
  --modal-bg: #fdf9f0;
  --popover-bg: #fffdf7;
  --scroll-thumb: #d8c8ab;
  --live-green: #1f9d5b;
  --profit-up: #1f9d5b;
  --profit-down: #d94836;
  --route-label: #3f6fa3;
  --mask-bg: rgba(80, 64, 40, 0.35);
  --chip-pressed-bg: #e3eefb;
  --chip-pressed-border: #7fa9d9;
  --ico-buy-bg: #d9a441;
  --ico-sell-bg: #3fae74;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 61px;
  padding: 0 20px;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--header-border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.brand-logo { display: flex; width: 32px; height: 32px; }

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.notice-region {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.notice-tag {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: #7db4ee;
  background: rgba(61, 126, 199, 0.16);
  border: 1px solid rgba(61, 126, 199, 0.35);
  padding: 1px 8px;
  border-radius: 6px;
}

[data-theme="light"] .notice-tag { color: #2f5d9e; background: #e5eefb; border-color: #b9d2ee; }

.notice-text {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.clock {
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}

.clock strong { color: var(--text); font-weight: 600; }

/* 账号区 */
.account { position: relative; }

.account-logout { font-size: 13px; color: var(--text-dim); }

/* 未登录的「登录 / 激活」入口按钮 */
.account-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--gold-border);
  background: var(--countdown-bg);
  color: var(--gold-text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.account-login-btn:hover { filter: brightness(1.08); }

.account-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 13px;
}

.sub-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--live-green);
}

.sub-phone { font-weight: 600; }

.account-pill .caret { color: var(--text-dim); }

.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 220px;
  padding: 14px;
  border-radius: 12px;
  background: var(--popover-bg);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  z-index: 60;
}

.account-menu-phone { font-weight: 700; font-size: 14px; }

.account-menu-exp { font-size: 12px; color: var(--text-dim); margin: 6px 0 12px; }

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

.account-menu-actions button {
  flex: 1;
  padding: 6px 0;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

.account-menu-actions button:hover { border-color: var(--accent-blue); }

/* 主题按钮 */
.theme-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 13px;
  color: var(--text);
}

/* ---------- 页面主体 ---------- */
.page { padding: 18px 20px 40px; }

/* 工具条 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-left { display: flex; align-items: center; gap: 12px; }

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.pill-server {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
}

.pill-server .pill-label { color: var(--text-dim); font-size: 12px; }
.pill-server strong { font-weight: 700; }

.pill-server .caret { color: var(--text-dim); transition: transform 0.15s ease; }
.pill-server[aria-expanded="true"] .caret { transform: rotate(180deg); }
.pill-server.single .caret { display: none; }

/* 顶栏区服选择弹层：锚定在胶囊左侧展开 */
.popover.area-pop {
  left: 0;
  right: auto;
  min-width: 0;
  grid-template-columns: 1fr;
}

.pill-live {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live-green);
  box-shadow: 0 0 0 0 rgba(52, 199, 123, 0.5);
  animation: livePulse 2s infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 199, 123, 0.45); }
  70% { box-shadow: 0 0 0 6px rgba(52, 199, 123, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 199, 123, 0); }
}

/* 倒计时 */
.countdown {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--gold-border);
  background: var(--countdown-bg);
  margin: 0 auto;
}

.countdown-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--btn-gold-text);
  background: var(--btn-gold-bg);
  border-radius: 999px;
  padding: 3px 12px;
}

.countdown-label { font-size: 13px; color: var(--text-dim); }

.countdown-time {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: 1px;
  min-width: 64px;
  text-align: center;
}

.toolbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.filter-wrap { position: relative; }

.pill-filter {
  background: var(--filter-bg);
  border: 1px solid var(--filter-border);
  color: var(--filter-text);
  font-weight: 700;
  font-size: 12px;
  height: 36px;
}

.filter-count { font-weight: 800; }

.popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 55;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--popover-bg);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  min-width: 300px;
}

#routeFilterPop { grid-template-columns: repeat(2, 1fr); min-width: 240px; }

.chip {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.chip.pressed {
  color: var(--filter-text);
  background: var(--chip-pressed-bg);
  border-color: var(--chip-pressed-border);
}

/* 视图标签 */
.view-tabs { display: flex; align-items: center; gap: 6px; }

.view-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}

.view-tab.active {
  color: var(--gold-text);
  background: var(--panel-2);
  border-color: var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 232, 199, 0.08);
}

.view-tab.active[data-tab="price"] {
  color: var(--filter-text);
  border-color: var(--filter-border);
  background: var(--filter-bg);
}

.view-tab.active[data-tab="routes"] {
  color: #d8b4fe;
  border-color: #7c5cbf;
  background: rgba(124, 92, 191, 0.14);
}

[data-theme="light"] .view-tab.active[data-tab="routes"] { color: #6d3fb4; background: #f0e8fb; border-color: #cdb4ec; }

/* 路线模式标签 */
.mode-tabs { display: flex; align-items: center; gap: 6px; }

.mode-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
}

.mode-tab.active {
  color: var(--gold-text);
  border-color: var(--gold-border);
  background: var(--countdown-bg);
}

/* ---------- 工作区 ---------- */
.workspace { position: relative; display: flex; gap: 10px; align-items: flex-start; }

.sidebar {
  flex: none;
  width: 232px;
  min-height: 420px;
  max-height: calc(100vh - 170px);
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 14px 12px;
  transition: width 0.2s ease, padding 0.2s ease;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar.collapsed { width: 0; padding: 14px 0; border-width: 0; }

/* ---------- 左侧跑商数据预测面板 ---------- */
.pred-head {
  padding: 2px 4px 10px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 10px;
}

.pred-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 800;
  color: var(--gold-text);
}

.pred-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-faint);
}

/* 行情覆盖度：未覆盖全部城市时用金色提醒 */
.pred-coverage {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-faint);
}

.pred-coverage.partial { color: var(--gold-text); }

/* 本金单选 */
.cap-label { font-size: 11px; color: var(--text-faint); margin: 10px 4px 6px; }

.cap-group { display: flex; gap: 6px; }

.cap-chip {
  flex: 1;
  padding: 8px 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}

.cap-chip.active {
  color: var(--gold-text);
  border-color: var(--gold-border);
  background: var(--countdown-bg);
}

/* 银票显示框 */
.purse-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--gold-border);
  background: var(--countdown-bg);
}

.purse-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.purse-row + .purse-row { margin-top: 8px; }
.purse-label { font-size: 11px; color: var(--text-faint); flex: none; }
.purse-value { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.purse-value.next { color: var(--profit-up); }

/* 预计交易后（选中商品时显示）：纵向分层，避免长文本溢出 */
.pred-next-row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--accent-blue);
  background: rgba(74, 134, 197, 0.08);
}
.pred-next-row .pred-next-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.pred-next-row .purse-label {
  flex: 1;
  min-width: 0;
  white-space: normal;
  line-height: 1.35;
  font-size: 11px;
}
.pred-next-row .purse-undo { flex: none; align-self: flex-start; }
.pred-next-row .purse-value.next {
  font-size: 17px;
  white-space: nowrap;
}
/* 预计交易后卡片操作按钮区：已成交 + 撤销 */
.pred-next-row .pred-next-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pred-next-row .purse-settle {
  flex: 1;
  padding: 6px 0;
  border-radius: 8px;
  border: none;
  background: var(--btn-gold-bg);
  color: var(--btn-gold-text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}
.pred-next-row .purse-settle:hover { filter: brightness(1.08); }

.purse-input {
  width: 112px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-family: inherit;
  outline: none;
}

.purse-input:focus { border-color: var(--gold-border); }
.purse-hint { margin-top: 6px; font-size: 10px; color: var(--text-faint); }

.purse-flash { animation: purseFlash 0.8s ease; }
@keyframes purseFlash {
  0% { box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(232, 163, 61, 0); }
}

/* 任务达标提示：醒目金色高亮条 + 大图标 + 脉冲动画 */
.target-banner {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  /* 固定金色渐变：不能嵌套引用 --btn-gold-bg（gradient 内不可再取 gradient 变量），否则背景失效 */
  background: linear-gradient(180deg, #f0b85c, #dd9634);
  color: #2b1d07;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid rgba(255, 220, 140, 0.95);
  animation: targetPulse 0.9s ease infinite;
}
.target-banner-icon {
  flex: none;
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 0 4px rgba(255, 200, 80, 0.8));
  animation: trophyBob 1.1s ease-in-out infinite;
}
.target-banner-text { flex: 1; min-width: 0; text-align: left; }
.target-banner-title {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
}
.target-banner-sub {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.92;
  line-height: 1.35;
}

@keyframes trophyBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes targetPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 163, 61, 0.6); }
  50% { box-shadow: 0 0 0 7px rgba(232, 163, 61, 0); }
}

.target-gap {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}

/* 路线推算行 */
.pred-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.pred-row {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 9px 10px;
  background: var(--panel-2);
  cursor: pointer;
}

.pred-row.selected { border-color: var(--gold-border); }
.pred-row.dead { opacity: 0.55; cursor: default; }

.pred-row-head { display: flex; align-items: center; gap: 7px; }

.pred-rank {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pred-rank.top {
  color: var(--btn-gold-text);
  background: var(--btn-gold-bg);
  border-color: transparent;
}

.pred-route {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pred-total {
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--gold-text);
}

.pred-best {
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.pred-product {
  font-weight: 700;
  color: var(--route-label);
  display: flex;
  align-items: center;
}

.full-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--gold-text);
  border: 1px solid var(--gold-border);
  border-radius: 5px;
  padding: 0 4px;
  margin-left: 5px;
  line-height: 14px;
}

.pred-profit {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--profit-up);
}

.pred-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 7px 0;
  border-radius: 9px;
  border: none;
  background: var(--btn-gold-bg);
  color: var(--btn-gold-text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

/* 左侧"最优商品卡片"：与右侧路线商品卡片同款，窄容器内自适应 */
.pred-row .route-card.pred-best-card {
  width: 100% !important;   /* 覆盖 .route-card 的固定 236px，避免溢出 */
  margin-top: 7px;
  box-sizing: border-box;
  padding: 9px 10px;
}
.pred-best-card .route-card-name { font-size: 13px; }
.pred-best-card .route-card-npcs { margin: 6px 0; }
.pred-best-card .route-card-profit { font-size: 13px; }
.pred-best-card .route-card-prices .pcell b { font-size: 12px; }
/* 窄侧栏内价格行防溢出：允许两列收紧，必要时换行 */
.pred-best-card .route-card-prices {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.pred-best-card .route-card-prices .pcell {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.pred-empty-tip { font-size: 11px; color: var(--text-faint); margin-top: 7px; }

.pred-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--dash-border);
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}

.pred-empty {
  padding: 24px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}

.sidebar-toggle {
  position: absolute;
  left: 242px;
  top: 14px;
  z-index: 10;
  width: 22px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1;
  transition: left 0.2s ease;
}

.workspace.sidebar-collapsed .sidebar-toggle { left: 6px; }

/* 价格网格 */
.main-panel { flex: 1; min-width: 0; position: relative; }

.grid-scroll {
  overflow-x: auto;
  padding-bottom: 8px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.grid-inner { padding: 14px; width: max-content; min-width: 100%; }

/* 每个城市占两行（货商 / 商人），城市纵向堆叠，整体横向滚动 */
.city-block {
  display: grid;
  grid-template-columns: 44px 28px max-content;
  gap: 8px;
  align-items: start;
  padding-right: 26px;
}

.city-head {
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.city-name {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--city-name);
  background: var(--city-cell-bg);
  border: 1px solid var(--city-cell-border);
  border-radius: 12px;
  padding: 14px 0;
  width: 44px;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.city-arrows {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--city-cell-border);
  background: var(--city-cell-bg);
}

.arrow-btn {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 0;
}

.arrow-btn:disabled { opacity: 0.35; cursor: default; }
.arrow-btn:not(:disabled):hover { color: var(--text); border-color: var(--accent-blue); }

.npc-row { display: flex; gap: 8px; align-items: flex-start; }

.npc-label {
  flex: none;
  writing-mode: vertical-rl;
  text-orientation: upright;
  width: 28px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--npc-label-bg);
  border: 1px solid var(--npc-label-border);
  border-radius: 10px;
}

.cards-row { display: flex; gap: 6px; flex-wrap: nowrap; }

/* 商品卡片 */
.price-grid-card {
  flex: none;
  width: 79px;
  height: 44px;
  padding: 4px 6px;
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.price-grid-card-buy {
  background: var(--card-buy-bg);
  border: 1px solid var(--card-buy-border);
  box-shadow: var(--card-buy-shadow);
  color: var(--card-buy-text);
}

.price-grid-card-sell {
  background: var(--card-sell-bg);
  border: 1px solid var(--card-sell-border);
  box-shadow: var(--card-sell-shadow);
  color: var(--card-sell-text);
}

.price-grid-card-unreported {
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--dash-border);
  color: var(--text-faint);
  background: transparent;
}

.price-grid-card-name-row { display: flex; align-items: center; gap: 4px; min-width: 0; }

.price-grid-card-inline-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.price-grid-card-inline-dot-green { background: var(--dot-green); }
.price-grid-card-inline-dot-red { background: var(--dot-red); }

.price-grid-card-name {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-grid-card-price { font-size: 13px; font-weight: 700; line-height: 1; }

/* 售价行：外地商品的收购价（金色小字）；双价卡同时显示买价+售价 */
.price-grid-card-sellrow {
  font-size: 10px;
  font-weight: 800;
  color: var(--gold-text);
  line-height: 1;
  white-space: nowrap;
}

.price-grid-card-sellonly .price-grid-card-sellrow {
  font-size: 13px;
  font-weight: 700;
}

.price-grid-card-sellonly {
  border-style: dashed;
}

.price-grid-card-withsell .price-grid-card-price { font-size: 12px; }
.price-grid-card-withsell .price-grid-card-name { font-size: 11px; }

/* 价格更新闪烁：新数据到达时金色光晕脉冲 3 秒提醒（价格卡与路线卡通用） */
.price-flash { animation: cardFlash 1s ease-in-out 3; }

@keyframes cardFlash {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 205, 90, 0);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(255, 205, 90, 0.85), 0 0 18px rgba(255, 205, 90, 0.45);
    filter: brightness(1.25);
  }
}

/* 未登录遮罩 */
.lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mask-bg);
  backdrop-filter: blur(3px);
  border-radius: 16px;
}

.lock-card { text-align: center; }

.lock-icon { font-size: 34px; }

.lock-title { font-size: 20px; font-weight: 800; margin: 10px 0 6px; }

.lock-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; }

.btn-gold {
  padding: 10px 26px;
  border-radius: 10px;
  background: var(--btn-gold-bg);
  color: var(--btn-gold-text);
  font-size: 14px;
  font-weight: 800;
}

/* ---------- 路线视图 ---------- */
.routes-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.routes-scroll {
  overflow-x: auto;
  padding: 14px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.route-block { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.route-block:last-child { margin-bottom: 0; }

.route-head { flex: none; width: 110px; display: flex; flex-direction: column; gap: 6px; }

.route-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--route-label);
  white-space: nowrap;
  padding: 10px 10px;
  border-radius: 12px;
  background: var(--city-cell-bg);
  border: 1px solid var(--city-cell-border);
  text-align: center;
}

.route-cards { display: flex; gap: 10px; }

.route-card {
  flex: none;
  width: 236px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.route-card-head { display: flex; align-items: center; justify-content: space-between; }

.route-card-name { font-size: 14px; font-weight: 700; }

.route-card-profit { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.route-card-profit.up { color: var(--profit-up); }
.route-card-profit.down { color: var(--profit-down); }

.route-card-npcs {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 9px 0 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.route-card-npcs span { display: flex; align-items: center; gap: 5px; min-width: 0; }

.npc-ico {
  flex: none;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.npc-ico-buy { background: var(--ico-buy-bg); }
.npc-ico-sell { background: var(--ico-sell-bg); }

.route-card-prices { display: flex; justify-content: space-between; gap: 8px; }

.route-card-prices .pcell { font-size: 11px; color: var(--text-dim); }
.route-card-prices b { font-size: 13px; color: var(--text); margin-left: 4px; }

/* ---- 路线商品卡片：可点击选品 ---- */
.route-card {
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.route-card:not(.route-card-selected):hover {
  border-color: var(--accent-blue);
  background: var(--panel-2-hover, var(--panel-3));
  box-shadow: 0 0 0 1px rgba(74, 134, 197, 0.35);
  transform: translateY(-1px);
}
.route-card:not(.route-card-selected):active { transform: translateY(0); }

/* 已选状态：常驻高亮边框 */
.route-card-selected {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(74, 134, 197, 0.45), 0 0 12px rgba(74, 134, 197, 0.25);
}

/* hover 浮现的"选择此商品交易"提示 */
.route-card-trade-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--accent-blue);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}
.route-card:not(.route-card-selected):hover .route-card-trade-hint { opacity: 1; transform: translateY(0); }
.route-card-selected .route-card-trade-hint {
  opacity: 1;
  transform: translateY(0);
  background: var(--btn-gold-bg, #d99a2b);
  color: var(--btn-gold-text, #fff);
}

/* ---- 预计交易后卡片：选中商品时高亮闪烁 ---- */
.purse-next-flash { animation: purseNextFlash 0.5s ease 4; }
@keyframes purseNextFlash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 134, 197, 0); }
  50% { box-shadow: 0 0 0 4px rgba(74, 134, 197, 0.55); }
}

/* 撤销按钮 */
.purse-undo {
  margin-left: 8px;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 7px;
  color: var(--text-dim);
  background: var(--panel-3);
  border: 1px solid var(--border);
  cursor: pointer;
}
.purse-undo:hover { color: var(--text); border-color: var(--accent-blue); }

/* 维护提示横幅 */
.maint-banner {
  padding: 10px 20px;
  background: rgba(232, 163, 61, 0.14);
  border-bottom: 1px solid var(--gold-border);
  color: var(--gold-text);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

/* 多区模式空状态提示 */
.wb-hint {
  padding: 60px 0;
  text-align: center;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 14px;
}

/* 工作台按钮（多区模式工具条） */
.wb-btn-preview { color: var(--text-dim); font-weight: 600; }

/* 路线选择弹窗 */
.wb-pop { grid-template-columns: repeat(3, 1fr); min-width: 340px; }
.wb-pop .wb-pop-title { grid-column: 1 / -1; font-size: 13px; font-weight: 700; color: var(--text-dim); padding-bottom: 2px; }

/* 多区工作台：按区服聚合的区块 */
.wb-block {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.wb-block:last-child { margin-bottom: 0; }

.wb-head {
  flex: none;
  width: 96px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.wb-area-tag {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--city-name);
  background: var(--city-cell-bg);
  border: 1px solid var(--city-cell-border);
  border-radius: 12px;
  padding: 12px 0;
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 44px;
}

.wb-routes-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
}

.wb-head .city-arrows { justify-content: center; }

.wb-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.wb-body .route-block { margin-bottom: 0; }

/* 多区空状态（保留旧样式兼容） */
.multi-empty {
  padding: 60px 0;
  text-align: center;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.multi-empty-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
}

.multi-empty-chip .hint { font-size: 12px; color: var(--text-dim); font-weight: 400; }

.multi-empty-tip { font-size: 13px; color: var(--text-dim); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mask-bg);
  backdrop-filter: blur(4px);
}

.modal {
  width: 420px;
  max-width: calc(100vw - 32px);
  border-radius: 14px;
  background: var(--modal-bg);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; }

.modal-title { font-size: 18px; font-weight: 800; margin: 0 0 4px; }

.modal-sub { font-size: 13px; color: var(--text-dim); margin: 0 0 16px; }

.modal-close {
  font-size: 15px;
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.modal-close:hover { background: var(--panel-2); }

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  margin-bottom: 18px;
}

.seg-btn {
  flex: 1;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
}

.seg-btn.active { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); padding: 7px 0; }

.form-row { margin-bottom: 14px; }

.form-row label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }

.form-row input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.form-row input:focus { border-color: var(--accent-blue); }

/* 区服选择器（注册/激活） */
.area-tip { font-weight: 400; color: var(--text-faint, var(--text-dim)); }

.area-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 108px;
  overflow-y: auto;
  padding: 2px;
}

.area-picker .area-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  font-family: inherit;
}

.area-picker .area-chip.on {
  color: var(--filter-text, #9ecbff);
  border-color: var(--accent-blue);
  background: rgba(74, 134, 197, 0.15);
}

.area-picker .area-chip input { display: none; }

/* 区服选择触发按钮（激活表单内，点开弹出卡片） */
.area-trigger {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.area-trigger .caret { color: var(--text-dim); transition: transform 0.15s ease; }
.area-trigger[aria-expanded="true"] .caret { transform: rotate(180deg); }

/* 区服选择弹出卡片（叠在登录弹窗之上） */
.area-card-mask { z-index: 120; }

.area-card { width: 360px; }

.area-card .area-picker {
  max-height: 240px;
  margin-bottom: 6px;
}

.btn-gold-block {
  width: 100%;
  margin-top: 6px;
  padding: 12px 0;
  border-radius: 10px;
  background: var(--btn-gold-bg);
  color: var(--btn-gold-text);
  font-size: 14px;
  font-weight: 800;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--popover-bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
}

.toast.show { opacity: 1; transform: none; }
.toast-warn { border-color: var(--gold-border); color: var(--gold-text); }
.toast-ok { border-color: var(--profit-up); color: var(--profit-up); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { height: 10px; width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .notice-region { display: none; }
  .clock { display: none; }
  .countdown { margin: 0; }
}

/* ---------- 移动端适配（≤768px） ---------- */
@media (max-width: 768px) {
  .page { padding: 10px 10px 32px; }

  /* 顶栏紧凑 */
  .topbar { height: auto; min-height: 54px; padding: 8px 12px; gap: 10px; }
  .topbar-left { gap: 10px; flex: 1; min-width: 0; }
  .topbar-right { gap: 8px; }
  .brand-name { font-size: 15px; }
  .theme-btn { padding: 6px 10px; font-size: 12px; }

  /* 工具条：允许换行、紧凑 */
  .toolbar { gap: 8px; padding: 8px 10px; }
  .toolbar-left, .toolbar-right { gap: 8px; flex-wrap: wrap; margin-left: 0; }
  .pill { height: 34px; padding: 0 10px; font-size: 12px; }
  .pill-filter { height: 32px; font-size: 11px; }
  .countdown { padding: 4px 10px; }
  .countdown-time { font-size: 18px; min-width: 52px; }
  .mode-tab { height: 32px; padding: 0 10px; font-size: 11px; }
  .view-tab { height: 32px; padding: 0 10px; }

  /* 工作区纵向堆叠：预测面板在上、主体在下（stretch 防止子元素按内容撑宽页面） */
  .workspace { flex-direction: column; align-items: stretch; }
  .main-panel { width: 100%; min-width: 0; }
  .grid-scroll, .routes-scroll { max-width: 100%; }
  .sidebar { width: 100%; min-height: 0; max-height: 420px; overflow-y: auto; }
  .sidebar.collapsed { width: 100%; min-height: 0; max-height: 0; padding: 0 12px; border-width: 0; }
  .sidebar-toggle { display: none; }

  /* 路线块改纵向：路线名一行，卡片两列换行 */
  .route-block { flex-direction: column; }
  .route-head { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; }
  .route-name { flex: 1; text-align: left; padding: 8px 10px; }
  .route-cards { flex-wrap: wrap; }
  .route-card { width: calc(50% - 5px); min-width: 150px; }
  .routes-scroll, .grid-scroll { padding: 10px; }
  .city-block { padding-right: 10px; }

  /* 弹窗紧凑 */
  .modal { padding: 16px; }
  .purse-input { width: 96px; }
}
