:root {
  color-scheme: light;
  --bg: #eef2f3;
  --ink: #172026;
  --muted: #64727d;
  --panel: #ffffff;
  --line: #dbe3e7;
  --accent: #0f8b8d;
  --accent-2: #ec9a29;
  --accent-3: #6b7f3a;
  --danger: #c25746;
  --shadow: 0 18px 45px rgba(23, 32, 38, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app {
  min-height: 100vh;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  background: #172026;
  color: #f8fbfb;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-2);
  color: #172026;
  font-size: 24px;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.empty-state h3,
.empty-state p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  margin-top: 4px;
  color: #aebdc4;
  font-size: 13px;
}

.upload-box {
  display: grid;
  gap: 8px;
  min-height: 168px;
  padding: 22px;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
  cursor: pointer;
}

.upload-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  font-size: 28px;
  line-height: 1;
}

.upload-box small,
.file-meta,
.control-group label {
  color: #aebdc4;
  font-size: 13px;
}

.control-group {
  display: grid;
  gap: 8px;
}

.control-group input,
.control-group select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.control-group select option {
  color: var(--ink);
}

.file-meta {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  line-height: 1.6;
}

.support-list {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #aebdc4;
  font-size: 13px;
}

.support-list strong {
  color: #ffffff;
  font-size: 14px;
}

.dashboard {
  min-width: 0;
  padding: 30px;
}

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

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(24px, 3vw, 34px);
}

.secondary-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 4px 18px rgba(23, 32, 38, 0.05);
  cursor: pointer;
}

.secondary-button:disabled {
  color: #96a2aa;
  cursor: not-allowed;
}

.empty-state {
  display: grid;
  min-height: 62vh;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
}

.empty-state div {
  max-width: 520px;
  padding: 28px;
}

.empty-state h3 {
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.08;
}

.empty-state p {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.7;
}

.content {
  display: grid;
  gap: 18px;
}

.notice {
  border: 1px solid #cce4e4;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f1fbfa;
  color: #275d5f;
  font-size: 14px;
  line-height: 1.6;
}

.hidden {
  display: none;
}

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

.kpi,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.kpi {
  padding: 18px;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1;
}

.kpi small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

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

.panel-head h3 {
  font-size: 17px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

canvas {
  width: 100%;
  max-width: 100%;
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.raw-term {
  display: block;
  margin-top: 3px;
  color: #8a98a1;
  font-size: 11px;
  font-weight: 500;
}

.bar-label .raw-term {
  display: inline;
  margin-top: 0;
  margin-left: 6px;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f2;
}

.bar-fill {
  width: var(--value);
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.table-wrap {
  overflow: auto;
}

.table-panel {
  padding-bottom: 8px;
}

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

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

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

th {
  color: var(--muted);
  font-weight: 700;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
}

.type-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8faf9;
}

.type-card span {
  color: var(--muted);
  font-size: 13px;
}

.type-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .file-meta {
    margin-top: 0;
  }

  .kpi-grid,
  .chart-grid,
  .type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .sidebar,
  .dashboard {
    padding: 20px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .secondary-button {
    width: 100%;
  }

  .kpi-grid,
  .chart-grid,
  .type-grid {
    grid-template-columns: 1fr;
  }
}
