:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --text: #18212f;
  --muted: #667085;
  --line: #d9e0e8;
  --brand: #2463eb;
  --brand-dark: #1747ad;
  --success: #137a43;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(24, 33, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--brand);
}

button,
input,
select {
  font: inherit;
}

.upload-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.upload-panel {
  width: min(720px, 100%);
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.upload-panel h1 {
  max-width: 620px;
}

h2 {
  font-size: 1rem;
  margin-bottom: 14px;
}

.intro {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
  max-width: 650px;
}

.intro.compact {
  margin-bottom: 0;
  font-size: 1rem;
}

.upload-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.file-drop {
  min-height: 132px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  background: var(--surface-soft);
  border: 1px dashed #aab7c6;
  border-radius: 8px;
  cursor: pointer;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.file-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  background: #dff4e8;
  color: #137a43;
  border-radius: 8px;
  font-weight: 800;
}

.file-drop strong,
.file-drop small {
  display: block;
}

.file-drop small {
  color: var(--muted);
  margin-top: 5px;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  background: var(--brand);
  color: #fff;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-button {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.small {
  width: fit-content;
  min-height: 38px;
  margin-top: 12px;
}

.status-box,
.result-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.status-box.success {
  color: var(--success);
  background: #ecfdf3;
  border-color: #abefc6;
}

.status-box.error {
  color: var(--danger);
  background: #fef3f2;
  border-color: #fecdca;
}

.result-box {
  display: grid;
  gap: 10px;
}

.dashboard-body {
  padding-top: 72px;
}

.dashboard-topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar-brand {
  color: var(--text);
  font-weight: 850;
  text-decoration: none;
}

.dashboard-layout {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 30px 28px 48px;
}

.dashboard-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.dashboard-heading h1 {
  font-size: clamp(2rem, 3vw, 3rem);
  max-width: 900px;
}

.dashboard-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 700;
}

.filters-panel,
.insights-panel,
.table-card,
.chart-card,
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(24, 33, 47, 0.05);
}

.filters-panel {
  display: flex;
  align-items: end;
  gap: 18px;
  padding: 18px;
  margin-bottom: 18px;
}

.filters-panel h2 {
  align-self: center;
  margin: 0;
}

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

.filter-control {
  display: grid;
  gap: 7px;
}

.filter-control span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.filter-control select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.kpi-card {
  min-height: 130px;
  display: grid;
  align-content: space-between;
  padding: 20px;
}

.kpi-card span {
  color: var(--muted);
  font-weight: 750;
}

.kpi-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(1.8rem, 3vw, 2.55rem);
  line-height: 1.05;
}

.insights-panel {
  padding: 18px 20px;
  margin-bottom: 18px;
}

.insights-panel ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.65;
}

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

.chart-card {
  min-height: 410px;
  padding: 18px;
}

.chart {
  width: 100%;
  height: 340px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px 18px 0;
}

.section-title h2 {
  margin-bottom: 0;
}

.section-title span {
  color: var(--muted);
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
  padding: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  color: #263244;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  padding: 12px 16px;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

@media (max-width: 960px) {
  .dashboard-heading,
  .filters-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-meta {
    flex: auto;
  }

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

@media (max-width: 640px) {
  .upload-panel,
  .dashboard-layout {
    padding: 22px 16px;
  }

  .dashboard-topbar {
    padding: 0 14px;
  }

  .dashboard-topbar .secondary-button {
    max-width: 150px;
  }

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