/* ============================================================
   Amazon JP 数据看板 - 深色玻璃拟态主题
   ============================================================ */

:root {
  --bg: #090d18;
  --panel: rgba(255, 255, 255, .035);
  --panel-hover: rgba(255, 255, 255, .055);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #e8edfb;
  --muted: #8d97b6;
  --dim: #5b6584;
  --blue: #5b8cff;
  --cyan: #22d3ee;
  --violet: #a78bfa;
  --green: #34d399;
  --red: #f87171;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(91, 140, 255, .16), transparent 60%),
    radial-gradient(900px 480px at 88% -6%, rgba(139, 92, 246, .14), transparent 55%),
    radial-gradient(1000px 700px at 50% 110%, rgba(34, 211, 238, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .2); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 登录页 ==================== */

#login-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: min(400px, 92vw);
  padding: 38px 34px 34px;
  border-radius: 20px;
  background: rgba(17, 23, 41, .78);
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: fadeUp .45s cubic-bezier(.2, .8, .3, 1);
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #5b8cff, #8b5cf6);
  box-shadow: 0 10px 30px rgba(91, 140, 255, .35);
}
.login-logo svg { width: 26px; height: 26px; }

.login-card h1 { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.login-sub { margin-top: 8px; font-size: 13px; color: var(--muted); }

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 26px 0 22px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
}

.login-tab {
  padding: 10px 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
}
.login-tab:hover { color: var(--text); }
.login-tab.active {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(91, 140, 255, .95), rgba(139, 92, 246, .95));
  box-shadow: 0 6px 18px rgba(91, 140, 255, .3);
}

.field { text-align: left; margin-bottom: 18px; }
.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(9, 13, 24, .8);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: var(--dim); }
.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, .18);
}

.btn-primary {
  width: 100%;
  margin-top: 4px;
  padding: 12px 0;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #5b8cff, #8b5cf6);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 2px;
  cursor: pointer;
  transition: filter .2s, transform .15s, opacity .2s;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.login-error {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 13px;
  text-align: left;
  color: #fca5a5;
  background: rgba(248, 113, 113, .08);
  border: 1px solid rgba(248, 113, 113, .28);
  animation: shake .3s;
}

.login-foot {
  margin-top: 20px;
  font-size: 12px;
  color: var(--dim);
}

/* ==================== 顶栏 ==================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 13px 28px;
  background: rgba(9, 13, 24, .72);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

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

.brand-logo {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #9db6ff;
  background: linear-gradient(135deg, rgba(91, 140, 255, .22), rgba(139, 92, 246, .22));
  border: 1px solid rgba(91, 140, 255, .35);
}
.brand-logo svg { width: 16px; height: 16px; }

.brand-title { font-size: 16px; font-weight: 700; letter-spacing: .3px; }

.top-right { display: flex; align-items: center; gap: 10px; }

.role-badge {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role-badge.admin {
  color: #a8c0ff;
  background: rgba(91, 140, 255, .13);
  border-color: rgba(91, 140, 255, .35);
}
.role-badge.agent {
  color: #7ee6f5;
  background: rgba(34, 211, 238, .1);
  border-color: rgba(34, 211, 238, .3);
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .05);
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel-hover); }
.icon-btn.spin svg { animation: spin .7s linear; }

.btn-ghost {
  padding: 8px 16px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, .05);
}
.btn-ghost:disabled { opacity: .35; cursor: not-allowed; }
.btn-ghost.sm { padding: 6px 14px; font-size: 12.5px; }

/* ==================== 布局 ==================== */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 28px 56px;
}

/* ---- 统计卡片 ---- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1080px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .stats { grid-template-columns: 1fr; } }

.stat-card {
  position: relative;
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform .2s, border-color .2s;
  animation: fadeUp .4s ease both;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 75%);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }

.stat-card.blue   { --accent: var(--blue); }
.stat-card.cyan   { --accent: var(--cyan); }
.stat-card.violet { --accent: var(--violet); }
.stat-card.green  { --accent: var(--green); }

.stat-icon {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 13px;
}
.stat-icon svg { width: 21px; height: 21px; }
.blue   .stat-icon { color: #7ea5ff; background: rgba(91, 140, 255, .14); }
.cyan   .stat-icon { color: #67e3f5; background: rgba(34, 211, 238, .12); }
.violet .stat-icon { color: #c4b0ff; background: rgba(167, 139, 250, .14); }
.green  .stat-icon { color: #6ee7b7; background: rgba(52, 211, 153, .13); }

.stat-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}
.stat-label { margin-top: 5px; font-size: 13px; color: var(--muted); }
.stat-sub { margin-top: 5px; font-size: 11.5px; color: var(--dim); }

/* ---- 标签页 ---- */

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  padding: 11px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-family: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s;
}
.tab::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 16px; right: 16px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--blue), var(--violet));
  opacity: 0;
  transform: scaleX(.4);
  transition: opacity .25s, transform .25s;
}
.tab:hover:not(.active) { color: #c3cdea; }
.tab.active { color: var(--text); font-weight: 600; }
.tab.active::after { opacity: 1; transform: scaleX(1); }

.tab-panel { animation: fadeUp .25s ease; }

/* ---- 面板 ---- */

.panel {
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}
.panel-head h2 em {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--dim);
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
}

.browse-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* 开关 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .14);
  position: relative;
  cursor: pointer;
  transition: background .2s;
  outline: none;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: left .2s;
}
.switch input:checked { background: linear-gradient(135deg, var(--blue), #8b5cf6); }
.switch input:checked::after { left: 16px; }

/* 搜索框 */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(9, 13, 24, .75);
  border: 1px solid var(--border-strong);
  transition: border-color .2s, box-shadow .2s;
}
.search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, .15);
}
.search-box svg { width: 15px; height: 15px; color: var(--dim); flex: none; }
.search-box input {
  width: 220px;
  max-width: 44vw;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--dim); }

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

.table-wrap { overflow-x: auto; }

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table-wrap thead th {
  padding: 11px 20px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  background: rgba(255, 255, 255, .02);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.table-wrap tbody td {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .045);
  white-space: nowrap;
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr { transition: background .15s; }
.table-wrap tbody tr:hover { background: rgba(255, 255, 255, .025); }

td.mono, .mono { font-family: var(--mono); font-size: 12.5px; }
td.dim { color: var(--muted); }
td.strong { font-weight: 600; color: #dfe7ff; }

.pw-mask { color: var(--dim) !important; letter-spacing: 2px; user-select: none; }
.pw-show { font-family: var(--mono); color: #f0c674; }

.dash { color: var(--dim); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid transparent;
}
.b-blue   { color: #8fb0ff; background: rgba(91, 140, 255, .12); border-color: rgba(91, 140, 255, .3); }
.b-violet { color: #c4b0ff; background: rgba(167, 139, 250, .12); border-color: rgba(167, 139, 250, .3); }
.b-green  { color: #6ee7b7; background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .3); }

.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--dim);
  font-size: 13.5px;
}

/* ---- 分页 ---- */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 13px 20px;
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.pager-info { font-size: 12.5px; color: var(--muted); }
.pager-btns { display: flex; align-items: center; gap: 8px; }

.size-select {
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(9, 13, 24, .8);
  color: var(--muted);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.size-select:hover { border-color: var(--border-strong); color: var(--text); }

.updated {
  margin-top: 6px;
  text-align: right;
  font-size: 12px;
  color: var(--dim);
}

/* ---- 轻提示 ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 200;
  max-width: 86vw;
  padding: 11px 20px;
  border-radius: 11px;
  font-size: 13.5px;
  color: var(--text);
  background: rgba(17, 23, 41, .96);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(248, 113, 113, .45); color: #fca5a5; }
.toast.ok  { border-color: rgba(52, 211, 153, .45); color: #6ee7b7; }

/* ---- 分区标题 ---- */

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
}
.section-head:not(:first-child) { margin-top: 26px; }
.section-head h3 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--muted);
  white-space: nowrap;
}
.section-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .08), transparent);
}
.section-date {
  font-size: 12px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* ---- 今日概览卡片 ---- */

.today-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.today-card {
  position: relative;
  padding: 22px 24px;
  border-radius: var(--radius);
  border: 1px solid rgba(91, 140, 255, .22);
  background: linear-gradient(135deg, rgba(91, 140, 255, .1), rgba(255, 255, 255, .02) 58%);
  overflow: hidden;
  animation: fadeUp .4s ease both;
}
.today-card.green {
  border-color: rgba(52, 211, 153, .22);
  background: linear-gradient(135deg, rgba(52, 211, 153, .1), rgba(255, 255, 255, .02) 58%);
}
.today-card::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -40px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 140, 255, .18), transparent 65%);
  pointer-events: none;
}
.today-card.green::before {
  background: radial-gradient(circle, rgba(52, 211, 153, .16), transparent 65%);
}

.today-main { display: flex; align-items: center; gap: 16px; }
.today-text { flex: 1; min-width: 0; }
.today-label { font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.today-value {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}

.delta {
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.delta.up { color: #6ee7b7; background: rgba(52, 211, 153, .1); border: 1px solid rgba(52, 211, 153, .28); }
.delta.down { color: #fca5a5; background: rgba(248, 113, 113, .08); border: 1px solid rgba(248, 113, 113, .28); }
.delta.flat { color: var(--muted); background: rgba(255, 255, 255, .05); border: 1px solid var(--border); }

.today-sub {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, .09);
  font-size: 12.5px;
  color: var(--muted);
}

/* ---- 近7天趋势 ---- */

.trend-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  padding: 20px 24px 18px;
}

.trend-chart { min-width: 0; }
.trend-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-blue { background: var(--blue); box-shadow: 0 0 8px rgba(91, 140, 255, .6); }
.dot-green { background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, .6); }

.bars { display: flex; gap: 10px; align-items: flex-end; }
.bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.bar-value {
  height: 13px;
  line-height: 13px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.bar-value.zero { color: var(--dim); opacity: .55; }
.bar-track {
  width: 100%;
  max-width: 42px;
  height: 108px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  display: flex;
  align-items: flex-end;
}
.bar-fill {
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(180deg, #7ea5ff, rgba(91, 140, 255, .25));
  transition: height .5s cubic-bezier(.2, .8, .3, 1);
}
.bar-fill.green { background: linear-gradient(180deg, #6ee7b7, rgba(52, 211, 153, .25)); }
.bar-label {
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.bar-col.today .bar-label { color: var(--text); font-weight: 600; }
.bar-col.today .bar-fill { box-shadow: 0 0 14px rgba(91, 140, 255, .28); }
.bar-col.today .bar-fill.green { box-shadow: 0 0 14px rgba(52, 211, 153, .28); }

/* ---- 移动端 ---- */

@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .brand-title { font-size: 14.5px; }
  .container { padding: 18px 14px 46px; }
  .stat-value { font-size: 26px; }
  .panel-head { padding: 13px 14px; }
  .table-wrap thead th, .table-wrap tbody td { padding: 10px 14px; }
  .login-card { padding: 30px 22px 26px; }
  .today-grid { grid-template-columns: 1fr; }
  .today-value { font-size: 30px; }
  .trend-body { grid-template-columns: 1fr; gap: 22px; padding: 16px 14px; }
  .bars { gap: 6px; }
}
