/* ===========================================================
   OZON × NOON 财务中心 — 主题样式
   深色「财务终端」风格：深海军蓝底 + 青蓝点缀
   =========================================================== */

:root {
  --bg: #070c16;
  --bg-soft: #0a111f;
  --panel: #0f1829;
  --panel-2: #131f35;
  --panel-hover: #16233c;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.26);
  --text: #e8eef9;
  --text-2: #c3d0e4;
  --muted: #8ba0bd;
  --faint: #5f738f;
  --accent: #38bdf8;
  --accent-2: #22d3ee;
  --accent-deep: #0ea5e9;
  --ozon: #4d7cfe;
  --noon: #f2c94c;
  --good: #34d399;
  --bad: #fb7185;
  --warn: #fbbf24;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(2, 8, 20, 0.45);
  --sidebar-w: 228px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(56, 189, 248, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(34, 211, 238, 0.07), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #1e2c46; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.num { font-variant-numeric: tabular-nums; letter-spacing: 0.2px; }

/* ============================ 登录页 ============================ */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, rgba(19, 31, 53, 0.92), rgba(12, 20, 36, 0.95));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 38px 34px 30px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: 0.9;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.login-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0ea5e9, #22d3ee);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #06283d;
  font-size: 15px;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 18px rgba(34, 211, 238, 0.25);
}

.login-title { font-size: 17px; font-weight: 700; letter-spacing: 0.3px; }
.login-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.4px;
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(7, 12, 22, 0.7);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--text); background: var(--panel-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  width: 100%;
  height: 44px;
  border: none;
  background: linear-gradient(135deg, #0ea5e9, #22d3ee);
  color: #03202f;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  box-shadow: 0 8px 22px rgba(14, 165, 233, 0.28);
}
.btn-primary:hover { background: linear-gradient(135deg, #0ea5e9, #38e0f4); color: #03202f; }

.login-err {
  min-height: 20px;
  font-size: 12.5px;
  color: var(--bad);
  margin: 10px 0 4px;
}

.login-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--faint);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================ 应用框架 ============================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 14px 16px;
  background: linear-gradient(180deg, rgba(12, 20, 36, 0.9), rgba(7, 12, 22, 0.94));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 18px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #0ea5e9, #22d3ee);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  color: #06283d;
  letter-spacing: 0.4px;
}

.brand-name { font-size: 14.5px; font-weight: 700; letter-spacing: 0.4px; }
.brand-sub { font-size: 11px; color: var(--faint); margin-top: 2px; letter-spacing: 0.6px; }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.14s;
  user-select: none;
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.nav-item:hover { background: rgba(56, 189, 248, 0.06); color: var(--text-2); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.14), rgba(56, 189, 248, 0.03));
  border-color: rgba(56, 189, 248, 0.22);
  color: var(--text);
}
.nav-item.active svg { color: var(--accent); opacity: 1; }

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 14px 8px 4px;
  font-size: 11.5px;
  color: var(--faint);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidebar-foot .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
}
.link-btn:hover { color: var(--bad); background: rgba(251, 113, 133, 0.08); }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 26px 14px;
  background: linear-gradient(180deg, rgba(7, 12, 22, 0.94), rgba(7, 12, 22, 0.72));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.page-title { font-size: 19px; font-weight: 700; letter-spacing: 0.3px; margin: 0; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.demo-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #ffd88a;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  cursor: help;
}
.demo-badge[hidden] { display: none; }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

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

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: rgba(19, 31, 53, 0.75);
  border: 1px solid var(--line);
}
.segmented button {
  border: none;
  background: transparent;
  color: var(--muted);
  height: 30px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.13s;
  white-space: nowrap;
}
.segmented button:hover { color: var(--text-2); }
.segmented button.on {
  background: rgba(56, 189, 248, 0.16);
  color: #c9ecff;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.content { padding: 22px 26px 40px; display: flex; flex-direction: column; gap: 18px; }

.view { display: none; flex-direction: column; gap: 18px; }
.view.active { display: flex; animation: fade 0.22s ease; }

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

/* ============================ 卡片 ============================ */
.card {
  background: linear-gradient(180deg, rgba(19, 31, 53, 0.78), rgba(13, 22, 39, 0.86));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-title { font-size: 14px; font-weight: 650; letter-spacing: 0.2px; }
.card-hint { font-size: 11.5px; color: var(--faint); }

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

.kpi {
  position: relative;
  background: linear-gradient(180deg, rgba(21, 34, 58, 0.82), rgba(13, 22, 39, 0.9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  overflow: hidden;
  min-width: 0;
}
.kpi::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -40px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12), transparent 70%);
}
.kpi-label { font-size: 12px; color: var(--muted); letter-spacing: 0.5px; }
.kpi-value { font-size: 26px; font-weight: 730; margin-top: 8px; letter-spacing: 0.2px; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--text-2); margin-right: 2px; }
.kpi-foot { margin-top: 9px; display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--faint); }

.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; }
.grid-2b { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }

.chart { width: 100%; height: 300px; }
.chart.tall { height: 340px; }
.chart.short { height: 240px; }

/* ============================ 表格 ============================ */
.table-wrap { overflow: auto; max-height: 460px; border-radius: 10px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}
table.data th, table.data td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}
table.data th {
  position: sticky;
  top: 0;
  background: #0e1729;
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.4px;
  cursor: pointer;
  user-select: none;
  z-index: 2;
}
table.data th:hover { color: var(--text-2); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td:first-child { color: var(--text-2); }
table.data tbody tr:hover td { background: rgba(56, 189, 248, 0.045); }
table.data td.pos { color: var(--good); }
table.data td.neg { color: var(--bad); }

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}
.tag.ozon { color: #9db8ff; background: rgba(77, 124, 254, 0.14); border-color: rgba(77, 124, 254, 0.3); }
.tag.noon { color: #f7dd8d; background: rgba(242, 201, 76, 0.12); border-color: rgba(242, 201, 76, 0.28); }
.tag.all { color: var(--text-2); background: rgba(148, 163, 184, 0.1); border-color: var(--line-strong); }
.tag.ok { color: var(--good); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.25); }
.tag.wait { color: var(--warn); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.25); }
.tag.doing { color: var(--accent); background: rgba(56, 189, 248, 0.1); border-color: rgba(56, 189, 248, 0.25); }

.margin-bar { display: inline-flex; align-items: center; gap: 8px; }
.margin-bar .bar { width: 64px; height: 5px; border-radius: 4px; background: rgba(148, 163, 184, 0.16); overflow: hidden; }
.margin-bar .bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #0ea5e9, #34d399); }

/* ============================ 工具条 ============================ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }

.input-search {
  height: 36px;
  width: 220px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 12, 22, 0.65);
  color: var(--text);
  font-size: 12.5px;
  outline: none;
}
.input-search:focus { border-color: var(--accent); }

.fx-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.fx-card {
  background: linear-gradient(180deg, rgba(21, 34, 58, 0.82), rgba(13, 22, 39, 0.9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.fx-pair { font-size: 12px; color: var(--muted); letter-spacing: 0.5px; }
.fx-rate { font-size: 24px; font-weight: 720; margin-top: 8px; }
.fx-delta { font-size: 11.5px; margin-top: 6px; }

.converter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.converter input, .converter select {
  height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 12, 22, 0.65);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.converter input { width: 200px; }
.conv-out {
  flex: 1;
  min-width: 200px;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: #c9ecff;
  font-size: 15px;
  font-weight: 650;
}

.empty { padding: 30px; text-align: center; color: var(--faint); font-size: 13px; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  background: #13203a;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all 0.22s;
}
.toast.show { opacity: 1; transform: none; }

/* ============================ 响应式 ============================ */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-2b { grid-template-columns: minmax(0, 1fr); }
  .fx-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .brand { padding: 0 6px 0 2px; gap: 8px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 11px; }
  .brand-name { font-size: 13px; white-space: nowrap; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; gap: 4px; overflow-x: auto; }
  .nav-item { height: 34px; padding: 0 11px; white-space: nowrap; font-size: 12.5px; }
  .nav-item svg { width: 15px; height: 15px; }
  .sidebar-foot {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    gap: 8px;
    padding: 0;
    border-top: none;
    margin-left: auto;
  }
  .sidebar-foot .row:first-child { display: none; }
  .sidebar-foot .row span { font-size: 12px; }
  .topbar { padding: 14px 16px 12px; }
  .content { padding: 16px 14px 32px; }
  .page-title { font-size: 17px; }
  .kpi-value { font-size: 22px; }
  .chart { height: 260px; }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 13px 13px 11px; }
  .kpi-value { font-size: 19px; }
  .fx-cards { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 14px 14px; }
  .controls { width: 100%; }
  .segmented { flex: 1; justify-content: space-between; }
}
