:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --surface-2: #eef2e8;
  --text: #17211b;
  --muted: #68736b;
  --line: #dbe2d7;
  --accent: #0f766e;
  --accent-2: #155e75;
  --warning: #b45309;
  --danger: #be123c;
  --good: #15803d;
  --shadow: 0 12px 30px rgba(23, 33, 27, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, .12), transparent 260px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  background: var(--surface);
  color: var(--text);
  padding: 0 13px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  color: var(--text);
  padding: 0 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 52px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
}

h3 {
  margin-bottom: 0;
  font-size: 17px;
}

.app-shell {
  width: min(1320px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

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

.runtime {
  display: flex;
  align-items: center;
  gap: 8px;
}

.runtime span,
.pill,
.section-head span {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 34px;
  padding: 0 11px;
  background: rgba(255, 255, 255, .74);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

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

.metric,
.side-panel,
.main-panel,
.auth-card,
.module-nav {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 5px;
  min-height: 118px;
  padding: 15px;
}

.metric span,
.metric small {
  color: var(--muted);
  line-height: 1.35;
}

.metric strong {
  font-size: 28px;
  line-height: 1;
}

.metric.urgent {
  border-color: rgba(190, 18, 60, .25);
  background: #fff7f7;
}

.metric.urgent strong {
  color: var(--danger);
}

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

.side-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
  box-shadow: none;
}

.auth-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  box-shadow: none;
}

.main-panel {
  padding: 16px;
}

.panel-title,
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.ghost {
  background: transparent;
}

.full {
  width: 100%;
}

.help {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.module-nav {
  display: grid;
  overflow: hidden;
  box-shadow: none;
}

.module-tab {
  justify-content: flex-start;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
  font-weight: 850;
}

.module-tab:last-child {
  border-bottom: 0;
}

.module-tab.active {
  background: var(--surface-2);
  color: var(--accent);
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.wide {
  grid-column: span 2;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 14px;
  margin-top: 16px;
}

.records,
.coach-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.record,
.coach-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.record-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.record-title {
  display: grid;
  gap: 3px;
}

.record-title strong {
  font-size: 16px;
}

.record-title small,
.record-meta,
.coach-item p {
  color: var(--muted);
  line-height: 1.45;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}

.tag {
  display: inline-flex;
  border-radius: 999px;
  background: var(--surface-2);
  padding: 5px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.amount {
  font-size: 17px;
  font-weight: 900;
  white-space: nowrap;
}

.danger {
  color: var(--danger);
}

.good {
  color: var(--good);
}

.warn {
  color: var(--warning);
}

.delete-button {
  min-height: 32px;
  padding: 0 9px;
  color: var(--danger);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  color: var(--muted);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

@media (max-width: 1060px) {
  .summary-grid,
  .workspace,
  .split {
    grid-template-columns: 1fr 1fr;
  }

  .side-panel,
  .main-panel,
  .split {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar,
  .panel-title,
  .section-head,
  .record-top {
    flex-direction: column;
  }

  .summary-grid,
  .workspace,
  .entry-form,
  .split {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

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