@import url("https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700&family=Noto+Serif+SC:wght@500;700&display=swap");

:root {
  color-scheme: light;
  --bg-1: #f4f2ea;
  --bg-2: #dce8f2;
  --bg-3: #ffe4d1;
  --card: rgba(255, 255, 255, 0.88);
  --text: #1f2a32;
  --muted: #5c6b76;
  --accent: #0f766e;
  --accent-dark: #0b3d3a;
  --accent-warm: #ff8f5f;
  --danger: #c84b31;
  --shadow: 0 18px 45px rgba(9, 22, 34, 0.12);
  --border: rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 20%, var(--bg-3), transparent 45%),
    radial-gradient(circle at 80% 0%, #cfe6ff, transparent 45%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(120deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 60%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.page-shell {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  margin: 0 auto;
  padding: 32px 24px 64px;
  animation: fadeIn 0.6s ease both;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 28px 32px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(243, 248, 246, 0.85));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
}

.hero h1 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 32px;
  margin: 8px 0 10px;
}

.hero-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-size: 12px;
  color: var(--accent-dark);
}

.hero-sub {
  margin: 0;
  color: var(--muted);
}

.hero-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pill {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent-dark);
  font-size: 13px;
}

.top-row {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.top-row > * {
  height: 100%;
}

.hero-card {
  height: 100%;
}

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

.card {
  background: var(--card);
  padding: 22px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  animation: fadeUp 0.5s ease both;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.card-desc {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.label {
  font-size: 14px;
  color: var(--muted);
}

textarea,
input[type="date"],
input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.7);
}

input[type="file"] {
  max-width: 240px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--accent), #1aa39a);
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 25px rgba(15, 118, 110, 0.25);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(15, 118, 110, 0.3);
}

.btn.ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid rgba(15, 118, 110, 0.3);
  box-shadow: none;
}

.status {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.overview-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.curve-card {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(231, 247, 245, 0.85));
  border: 1px solid rgba(15, 118, 110, 0.18);
  box-shadow: var(--shadow);
}

.curve-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  background: rgba(15, 118, 110, 0.08);
  cursor: pointer;
  font-size: 14px;
  color: var(--accent-dark);
}

.curve-arrow {
  font-size: 14px;
}

.curve-body {
  display: none;
  margin-top: 12px;
}

.curve-body.open {
  display: block;
}

.curve-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}

.curve-title {
  font-size: 16px;
  font-weight: 600;
}

.curve-sub {
  font-size: 12px;
  color: var(--muted);
}

.curve-metric {
  text-align: right;
}

.curve-label {
  font-size: 12px;
  color: var(--muted);
}

.curve-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 6px;
}

.curve-select {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  font-size: 12px;
}

.curve-contrib {
  margin-bottom: 10px;
}

.contrib-title {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.contrib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.contrib-item {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.contrib-item.cash {
  background: rgba(15, 23, 42, 0.08);
}

.curve-chart {
  width: 100%;
  height: 180px;
}

.curve-footer {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.nav-card {
  margin-top: 0;
}

.main-layout {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-card {
  position: sticky;
  top: 20px;
}

.content-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.nav-tab {
  border: 1px solid rgba(15, 118, 110, 0.2);
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  text-align: left;
  width: 100%;
}

.nav-tab:hover {
  transform: translateY(-1px);
  background: rgba(15, 118, 110, 0.16);
}

.nav-tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.page-panel {
  display: none;
}

.page-panel.active {
  display: block;
}

.batch-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}

.meta-line {
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.08);
}

.overview-card {
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.85));
  border: 1px solid rgba(15, 118, 110, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: auto;
}

.overview-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.12);
}

.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.overview-header h3 {
  margin: 0;
  font-size: 16px;
}

.overview-sub {
  font-size: 12px;
  color: var(--muted);
}

.batch-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
}

.batch-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.batch-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.08);
  cursor: pointer;
  border: 1px solid transparent;
  transition: border 0.2s ease, transform 0.2s ease;
}

.batch-item.active {
  border-color: rgba(15, 118, 110, 0.6);
  transform: translateX(4px);
}

.panel-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.summary-table {
  margin-bottom: 16px;
  overflow-x: auto;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 720px;
}

.overview-mini-table {
  min-width: 980px;
}

.mini-table th,
.mini-table td {
  padding: 6px 6px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  text-align: right;
  white-space: nowrap;
}

.mini-table th:first-child,
.mini-table td:first-child {
  text-align: left;
}

.mini-table thead th {
  font-weight: 600;
  color: var(--accent-dark);
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.delta.up {
  color: #d14d4d;
}

.delta.down {
  color: #1d7a53;
}

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

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

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

.overview-table {
  min-width: 1400px;
  font-size: 12px;
}

.overview-table th,
.overview-table td {
  padding: 8px 6px;
}

.overview-table th {
  text-align: center;
}

.overview-table th:first-child,
.overview-table td:first-child,
.overview-table th:nth-child(2),
.overview-table td:nth-child(2) {
  text-align: left;
}

.overview-table-wrap {
  overflow-x: auto;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 4px;
}

.table th,
.table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  text-align: right;
  white-space: nowrap;
}

.table th:first-child,
.table td:first-child,
.table th:nth-child(2),
.table td:nth-child(2),
.table th:nth-child(3),
.table td:nth-child(3) {
  text-align: left;
}

.table th {
  position: sticky;
  top: 0;
  background: rgba(245, 240, 230, 0.95);
  z-index: 1;
}

.table tr:nth-child(even) {
  background: rgba(15, 118, 110, 0.04);
}

.profit {
  font-weight: 600;
}

.profit.positive {
  color: #d14d4d;
}

.profit.negative {
  color: #1d7a53;
}

@media (max-width: 960px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-row {
    grid-template-columns: 1fr;
  }

  .batch-layout {
    grid-template-columns: 1fr;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .nav-card {
    position: static;
  }

  .nav-tabs {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .nav-tab {
    width: auto;
  }
}

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

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
