:root {
  --bg: #f3f6fb;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-2: #f8faff;
  --panel-3: #f1f4fa;
  --border: #dfe6f1;
  --border-soft: #e9eef6;
  --text: #16203a;
  --muted: #5f6b82;
  --muted-2: #8a96a9;
  --accent: #2563eb;
  --accent-dim: rgba(37, 99, 235, 0.1);
  --accent-2: #4f8bff;
  --ok: #0f9d6a;
  --warn: #c77700;
  --warn-dim: rgba(199, 119, 0, 0.12);
  --danger: #d64545;
  --danger-dim: rgba(214, 69, 69, 0.1);
  --info: #2563eb;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(23, 37, 84, 0.08);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

/* hidden 属性必须优先于组件自身的 display 设置，否则弹窗遮罩会一直盖在页面上 */
[hidden] {
  display: none !important;
}

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

body {
  background: radial-gradient(1000px 520px at 12% -10%, rgba(37, 99, 235, 0.1) 0%, transparent 60%),
    radial-gradient(800px 460px at 100% 0%, rgba(124, 58, 237, 0.08) 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

svg {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------------- 侧边栏 ---------------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #ffffff, #f7f9fe);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px 6px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28);
}

.brand-name {
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 14px;
}

.brand-sub {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-group {
  margin: 14px 11px 4px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: 0.16s ease;
}

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

.nav-item span {
  font-size: 13.5px;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(37, 99, 235, 0.06);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(37, 99, 235, 0.2);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.04);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(15, 157, 106, 0.5);
  animation: pulse 2s infinite;
  flex: none;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 157, 106, 0.45);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(15, 157, 106, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(15, 157, 106, 0);
  }
}

/* ---------------- 主区域 ---------------- */

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 28px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 60%, rgba(255, 255, 255, 0.72));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.heading h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.2px;
  font-weight: 650;
}

.heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  padding: 22px 28px 40px;
  width: 100%;
}

.page {
  display: none;
  animation: fade 0.25s ease;
}

.page.active {
  display: block;
}

/* 设置页：卡片按屏幕宽度自动铺满、自动分列 */
#page-settings.active {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
  align-items: start;
}

#page-settings.active > .toolbar {
  grid-column: 1 / -1;
  margin-top: 0;
}

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

/* ---------------- 通用组件 ---------------- */

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.card-head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
}

.card-body {
  padding: 16px 18px;
}

.card-body.flush {
  padding: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-3);
  color: var(--text);
  padding: 8px 13px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: #c4d3ea;
  background: #eaf0fb;
}

.btn .icon {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-color: rgba(37, 99, 235, 0.55);
  color: #ffffff;
  font-weight: 650;
}

.btn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.btn-ghost {
  background: transparent;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-buy {
  background: #f2d33c;
  border-color: #f2d33c;
  color: #211c00;
  font-weight: 650;
}

.btn-buy:hover {
  background: #ffe45a;
  border-color: #ffe45a;
}

details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 4px;
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.25);
  background: var(--danger-dim);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.18);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  color: var(--text);
  border-color: #c4d3ea;
}

.select,
.input,
.textarea {
  width: 100%;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  color: var(--text);
  outline: none;
  transition: 0.15s ease;
}

.select:focus,
.input:focus,
.textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.textarea {
  min-height: 76px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
}

.select {
  appearance: none;
  padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% + 1px), calc(100% - 11px) calc(50% + 1px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.filter-select {
  min-width: 180px;
}

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

.field {
  margin-bottom: 14px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hint {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 6px;
  line-height: 1.6;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.badge.ok {
  color: var(--ok);
  background: rgba(15, 157, 106, 0.1);
  border-color: rgba(15, 157, 106, 0.2);
}

.badge.warn {
  color: var(--warn);
  background: var(--warn-dim);
  border-color: rgba(255, 180, 84, 0.2);
}

.badge.muted {
  color: var(--muted);
  background: #f1f4fa;
  border-color: var(--border);
}

.badge.danger {
  color: var(--danger);
  background: var(--danger-dim);
  border-color: rgba(255, 107, 107, 0.22);
}

.badge.info {
  color: var(--info);
  background: rgba(37, 99, 235, 0.09);
  border-color: rgba(37, 99, 235, 0.2);
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.up {
  color: var(--danger);
}

.down {
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

/* ---------------- 概览 ---------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 17px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
}

.stat::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -40px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.1), transparent 70%);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.stat-value {
  margin-top: 9px;
  font-size: 24px;
  font-weight: 680;
  letter-spacing: -0.4px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 4px;
}

.stat-foot {
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--muted-2);
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.mini-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.mini-stat .label {
  margin: 0;
}

.mini-stat strong {
  font-family: var(--mono);
  font-size: 16px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.trend {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 190px;
  padding-top: 8px;
}

.trend-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}

.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 130px;
  width: 100%;
  justify-content: center;
}

.trend-bar {
  width: 11px;
  border-radius: 4px 4px 2px 2px;
  min-height: 2px;
  transition: height 0.4s ease;
}

.trend-bar.changes {
  background: linear-gradient(180deg, var(--accent-2), rgba(37, 99, 235, 0.35));
}

.trend-bar.orders {
  background: linear-gradient(180deg, rgba(255, 180, 84, 0.9), rgba(255, 180, 84, 0.25));
}

.trend-label {
  font-size: 11px;
  color: var(--muted-2);
}

.legend {
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 5px;
}

.account-status-list {
  display: flex;
  flex-direction: column;
}

.account-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.account-status-row:last-child {
  border-bottom: none;
}

.account-status-row .name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.account-status-row .meta {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 3px;
}

/* ---------------- 表格 ---------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar .search {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* 库存商品：表头与「商品」列冻结（内部滚动，横向滚动时商品列固定在左侧） */
.table-freeze-wrap {
  max-height: calc(100vh - 250px);
  min-height: 320px;
  overflow: auto;
}

.table-freeze thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.table-freeze th:first-child,
.table-freeze td:first-child {
  position: sticky;
  left: 0;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  padding-left: 12px;
  padding-right: 8px;
  z-index: 2;
  background: var(--panel);
}

.table-freeze th:nth-child(2),
.table-freeze td:nth-child(2) {
  position: sticky;
  left: 44px;
  z-index: 2;
  background: var(--panel);
  box-shadow: 2px 0 0 var(--border-soft);
}

.table-freeze thead th:first-child,
.table-freeze thead th:nth-child(2) {
  z-index: 4;
  background: #f7f9fd;
}

.table-freeze tbody tr:hover td:first-child,
.table-freeze tbody tr:hover td:nth-child(2) {
  background: #f4f7ff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  font-weight: 550;
  font-size: 11.5px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: #f7f9fd;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

tr.row-pending td {
  background: #fff6d5;
}

tr.row-pending:hover td {
  background: #ffefb7;
}

tr.row-purchased td {
  background: #e6f7ee;
}

tr.row-purchased:hover td {
  background: #d5f0e3;
}

.cell-product {
  min-width: 280px;
}

.product-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-2);
  background: linear-gradient(160deg, #e8efff, #f5f8ff);
  border: 1px solid var(--border);
  letter-spacing: 0.4px;
}

.product-title {
  font-size: 13px;
  line-height: 1.35;
}

.product-sub {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 2px;
}

/* 采购列：左侧「采购状态 + 采购按钮」，右侧「国内物流标题 + 采购单号」 */
.purchase-grid {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.purchase-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.purchase-title {
  padding: 0;
  border: 0;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  line-height: 1.2;
}

.purchase-title:hover {
  text-decoration: underline;
}

.purchase-no {
  font-size: 11.5px;
  color: var(--muted-2);
  word-break: break-all;
}

/* 改价间隔：下限 ~ 上限 两个输入框并排 */
.interval-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 商品标题下的订单信息行：订单号 · 类型 · 货号/尺码 · 店铺 */
.product-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
}

/* 日本单号 / 国际单号：订单商品单元格内联输入 */
.tracking-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--muted-2);
}

.tracking-field {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* 取消订单的取消原因 / 罚款 / 时间 */
.cancel-line {
  color: var(--danger);
  margin-top: 4px;
}

.cancel-note {
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.5;
}

/* 物流轨迹弹窗 */
.tracking-steps {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 420px;
  overflow-y: auto;
}

.tracking-steps li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12px;
  line-height: 1.5;
}

.tracking-steps li:last-child {
  border-bottom: 0;
}

.intl-input {
  width: 116px;
  height: 24px;
  padding: 3px 8px;
  font-size: 11.5px;
  background: #ffffff;
}

.intl-input:focus {
  width: 150px;
}

.product-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-thumb-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: var(--panel-3);
}

.order-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--panel-3);
}

.order-thumb.placeholder {
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted-2);
  letter-spacing: 0.4px;
}

.price {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.price-main {
  font-size: 13.5px;
  font-weight: 600;
}

.price-old {
  font-size: 11.5px;
  color: var(--muted-2);
  text-decoration: line-through;
  margin-right: 4px;
}

/* 表格里可点击修改的保护价 */
.editable-price {
  cursor: pointer;
  border-bottom: 1px dashed var(--border);
}

.editable-price:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 6px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12px;
}

.pagination .pages {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------------- 规则 ---------------- */

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.rule-card .card-head {
  align-items: flex-start;
}

.rule-card h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.rule-card .sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

.rule-form .field-row {
  grid-template-columns: 1fr 1fr;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px dashed var(--border-soft);
}

.toggle-row .toggle-label {
  font-size: 13px;
}

.toggle-row .toggle-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
  max-width: 260px;
  line-height: 1.5;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: none;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  position: absolute;
  inset: 0;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d7dfec;
  border: 1px solid var(--border);
  transition: 0.18s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8a96a9;
  transition: 0.18s ease;
}

.switch input:checked + .switch-track {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(37, 99, 235, 0.45);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
  background: var(--accent);
}

/* ---------------- 店铺卡片 ---------------- */

.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.account-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.account-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.account-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 620;
}

.account-card .adapter {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

.account-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric {
  padding: 9px 10px;
  border-radius: 9px;
  background: #f7f9fd;
  border: 1px solid var(--border-soft);
}

.metric .k {
  font-size: 10.5px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.metric .v {
  font-family: var(--mono);
  font-size: 15px;
  margin-top: 4px;
}

.account-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

.account-meta span strong {
  color: var(--text);
  font-weight: 550;
}

.account-error {
  font-size: 11.5px;
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid rgba(255, 107, 107, 0.2);
  border-radius: 8px;
  padding: 8px 10px;
  line-height: 1.5;
  word-break: break-all;
}

.account-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

/* ---------------- 抽屉 / 弹窗 ---------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(3px);
  animation: fade 0.2s ease;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(500px, 100vw);
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 60px rgba(23, 37, 84, 0.16);
  animation: slideIn 0.24s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(30px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
}

.drawer-head h2 {
  margin: 4px 0 0;
  font-size: 16px;
  line-height: 1.4;
  max-width: 380px;
}

.drawer-eyebrow {
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
}

.drawer-body {
  padding: 18px 22px 40px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.detail-item {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--panel);
}

.detail-item .k {
  font-size: 10.5px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.detail-item .v {
  font-family: var(--mono);
  font-size: 16px;
  margin-top: 5px;
}

.chart-box {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--panel);
  padding: 12px;
  margin-bottom: 18px;
}

.chart-box canvas {
  width: 100%;
  height: 180px;
  display: block;
}

.section-title {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 20px 0 10px;
}

.change-mini-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.change-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #f7f9fd;
  border: 1px solid var(--border-soft);
  font-size: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.modal-card {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px;
  animation: fade 0.2s ease;
}

.modal-card h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

/* ---------------- 日志 ---------------- */

.log-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
}

/* ---------------- Toast ---------------- */

.toast-wrap {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: 380px;
}

.toast {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow);
  font-size: 12.5px;
  line-height: 1.5;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  animation: toastIn 0.22s ease;
}

.toast.ok {
  border-color: rgba(51, 214, 159, 0.35);
}

.toast.err {
  border-color: rgba(255, 107, 107, 0.35);
}

.toast .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex: none;
  background: var(--accent);
}

.toast.err .dot {
  background: var(--danger);
}

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

/* ---------------- 空状态 / 骨架 ---------------- */

.loading {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.skeleton {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef2f8 25%, #e2e8f2 37%, #eef2f8 63%);
  background-size: 300% 100%;
  animation: shimmer 1.4s infinite;
}

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

/* ---------------- 响应式 ---------------- */

@media (max-width: 1440px) {
  .content {
    padding: 20px 24px 36px;
  }
}

@media (max-width: 1120px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .mini-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    padding: 14px 14px 10px;
  }
  .nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
  }
  .nav-item {
    flex: none;
    padding: 8px 10px;
  }
  .nav-item span {
    font-size: 12.5px;
    white-space: nowrap;
  }
  .sidebar-footer {
    display: none;
  }
  .topbar {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    padding: 16px 18px;
  }
  .topbar-actions {
    justify-content: space-between;
  }
  .filter-select {
    flex: 1;
  }
  .content {
    padding: 16px 18px 32px;
  }
  .mini-grid {
    grid-template-columns: 1fr;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .drawer {
    width: 100vw;
  }
}
