:root {
  --bg: #0e0f12;
  --surface: #15171c;
  --border: #232830;
  --text: #e9eaee;
  --muted: #9aa3ad;
  --accent: #ff867a;
  --accent-hover: #e86a5e;
  --success: #6fcf97;
  --warn: #f2c94c;
  --danger: #eb5757;
  --radius: 10px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f7f8;
    --surface: #ffffff;
    --border: #e6e6ec;
    --text: #131418;
    --muted: #5b6470;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.55;
}

.mono { font-family: 'Fragment Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.status {
  font-size: 13px;
  color: var(--muted);
  font-family: 'Fragment Mono', ui-monospace, monospace;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px 80px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 900px) {
  main {
    grid-template-columns: 1fr 1fr;
  }
  #plan-section,
  #activities-section,
  #metrics-section {
    grid-column: 1 / -1;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.card h2 {
  margin: 0 0 12px 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.hidden { display: none !important; }

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

input[type=password], input[type=text] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  margin: 8px 0;
}

button {
  background: var(--accent);
  color: #1a1a1a;
  border: 0;
  padding: 9px 16px;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover { background: var(--accent-hover); }

button.link {
  background: transparent;
  color: var(--muted);
  font-weight: 400;
  padding: 6px 10px;
  text-decoration: underline;
}

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

th, td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-family: 'Fragment Mono', monospace;
  white-space: nowrap;
}

th { color: var(--muted); font-weight: 500; font-size: 12px; }

td:first-child, th:first-child { padding-left: 0; }
td:last-child, th:last-child { padding-right: 0; }

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

.kpi {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.kpi-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-value {
  font-size: 22px;
  font-weight: 600;
  margin-top: 2px;
}

.phase-bar {
  display: flex;
  gap: 4px;
  height: 32px;
  margin: 12px 0;
}

.phase-bar > div {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
}

.phase-BASE     { background: #6fcf97; }
.phase-BUILD    { background: #f2c94c; }
.phase-SPECIFIC { background: #ff867a; }
.phase-TAPER    { background: #56ccf2; }
.phase-RACE     { background: #eb5757; color: #fff; }
.phase-RECOVERY { background: #bb6bd9; color: #fff; }
.phase-OFF      { background: #828282; color: #fff; }

.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Fragment Mono', monospace;
  font-size: 12px;
}

.subtle { color: var(--muted); }

.row-hover:hover td {
  background: var(--bg);
}
