:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-soft: #f1eee7;
  --ink: #202326;
  --muted: #6f746d;
  --line: #dfdbd1;
  --health: #2f6f73;
  --fitness: #8a5a22;
  --nutrition: #5f7d3a;
  --danger: #aa3f32;
  --shadow: 0 18px 45px rgba(32, 35, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-screen[hidden] {
  display: none;
}

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

.login-panel h1 {
  margin-bottom: 10px;
}

.login-copy {
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 22px;
}

.login-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.login-panel input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
}

.login-panel button,
.ghost-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.login-panel button {
  width: 100%;
}

.ghost-button {
  flex: 0 0 auto;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  box-shadow: var(--shadow);
}

.form-error {
  min-height: 20px;
  color: var(--danger);
  margin-top: 12px;
  line-height: 1.35;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 18px;
  border-bottom: 1px solid var(--line);
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  line-height: 1.05;
  font-weight: 760;
}

h2 {
  font-size: 1rem;
  line-height: 1.2;
}

main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px clamp(18px, 4vw, 48px) 46px;
}

.status-pill {
  flex: 0 0 auto;
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.metric-card,
.pillar,
.chart-panel,
.import-panel,
.table-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 132px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top-width: 5px;
}

.metric-card strong {
  display: block;
  font-size: clamp(1.45rem, 2.3vw, 2.2rem);
  line-height: 1;
  margin: 10px 0;
  white-space: nowrap;
}

.metric-card small,
.metric-label,
.panel-head p,
.pillar-head p,
.mini-stats span,
.note {
  color: var(--muted);
}

.metric-label {
  font-size: 0.82rem;
  font-weight: 750;
  text-transform: uppercase;
}

.accent-health {
  border-top-color: var(--health);
}

.accent-fitness {
  border-top-color: var(--fitness);
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.pillar {
  padding: 20px;
}

.pillar-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.pillar-head p,
.panel-head p {
  margin-top: 4px;
  font-size: 0.92rem;
  line-height: 1.35;
}

.pillar-mark {
  width: 12px;
  height: 48px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.nutrition .pillar-mark {
  background: var(--nutrition);
}

.fitness .pillar-mark {
  background: var(--fitness);
}

.health .pillar-mark {
  background: var(--health);
}

.clean-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 9px;
}

.clean-list li {
  position: relative;
  padding-left: 18px;
  line-height: 1.35;
}

.clean-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  position: absolute;
  left: 0;
  top: 0.55em;
}

.note {
  margin-top: 16px;
  padding: 12px;
  background: var(--surface-soft);
  border-radius: 8px;
  line-height: 1.4;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mini-stats div {
  min-height: 84px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.mini-stats b {
  display: block;
  font-size: 1.35rem;
  margin-bottom: 7px;
}

.mini-stats span {
  display: block;
  font-size: 0.84rem;
  line-height: 1.25;
}

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

.chart-panel,
.import-panel,
.table-section {
  padding: 18px;
}

.import-panel {
  margin-top: 16px;
}

.import-panel[hidden] {
  display: none;
}

.import-form {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.import-form input {
  max-width: 360px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
}

.import-form button:disabled,
.login-panel button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.import-status {
  color: var(--muted);
  line-height: 1.4;
}

.wide {
  grid-column: 1 / -1;
}

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

.chart {
  width: 100%;
  min-height: 230px;
  overflow: hidden;
}

.chart.tall {
  min-height: 300px;
}

.chart svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
}

.axis-line,
.grid-line {
  stroke: #ddd7cb;
  stroke-width: 1;
}

.line-path {
  fill: none;
  stroke: var(--health);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.area-path {
  fill: rgba(47, 111, 115, 0.12);
}

.bar {
  fill: var(--fitness);
}

.bar.alt {
  fill: var(--nutrition);
}

.dot {
  fill: var(--health);
  stroke: #fff;
  stroke-width: 2;
}

.chart text {
  fill: var(--muted);
  font-size: 12px;
}

.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 8px;
  text-align: center;
  padding: 20px;
}

.table-section {
  margin-top: 16px;
}

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

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

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

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

td {
  font-size: 0.94rem;
}

@media (max-width: 1100px) {
  .overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pillar-grid {
    grid-template-columns: 1fr;
  }
}

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

  .status-pill {
    width: 100%;
  }

  .top-actions {
    width: 100%;
    justify-content: stretch;
  }

  .top-actions > * {
    flex: 1 1 100%;
  }

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

  .panel-head {
    display: block;
  }

  .import-form {
    justify-content: stretch;
    margin-top: 14px;
  }

  .import-form input,
  .import-form button {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 520px) {
  .overview-grid {
    gap: 10px;
  }

  .metric-card {
    min-height: 118px;
  }

  .mini-stats {
    grid-template-columns: 1fr;
  }
}
