:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #637069;
  --paper: #f7f4ef;
  --surface: #ffffff;
  --line: #d9ded6;
  --forest: #234c39;
  --mint: #dbeee5;
  --sky: #dcecf8;
  --gold: #f3c45b;
  --coral: #f27d65;
  --shadow: 0 20px 60px rgba(35, 76, 57, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(219, 238, 229, 0.9), rgba(247, 244, 239, 0.8) 48%, rgba(220, 236, 248, 0.85)),
    var(--paper);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.topbar,
.section-title,
.dashboard,
.workspace,
.history-layout,
.manual-log {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--forest);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 1.3rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.today-card,
.metric,
.panel {
  border: 1px solid rgba(35, 76, 57, 0.14);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.today-card {
  min-width: 160px;
  padding: 14px 16px;
  border-radius: 8px;
}

.today-card span,
.metric span,
label span,
legend {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.today-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
}

.dashboard {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric {
  min-height: 92px;
  padding: 18px;
  border-radius: 8px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.22rem, 2.4vw, 1.9rem);
  line-height: 1.05;
}

.workspace {
  grid-template-columns: minmax(300px, 0.82fr) minmax(360px, 1.18fr);
  align-items: start;
  margin-bottom: 16px;
}

.panel {
  border-radius: 8px;
  padding: 20px;
}

.section-title {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 18px;
}

.control-grid {
  display: grid;
  gap: 18px;
}

label,
fieldset {
  display: grid;
  gap: 8px;
  min-width: 0;
}

fieldset {
  padding: 0;
  border: 0;
  margin: 0;
}

select,
input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

select:focus,
input:focus,
button:focus-visible {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(35, 76, 57, 0.16);
  outline: none;
}

.segmented,
.chip-grid {
  display: grid;
  gap: 8px;
}

.segmented {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.segmented button,
.chip-grid button,
.ghost-action,
.primary-action,
.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.segmented button:hover,
.chip-grid button:hover,
.ghost-action:hover,
.primary-action:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.segmented button.active,
.chip-grid button.active {
  border-color: var(--forest);
  background: var(--forest);
  color: #fff;
}

.range-row {
  grid-template-columns: 84px 1fr auto;
  align-items: center;
}

input[type="range"] {
  min-height: auto;
  accent-color: var(--forest);
}

.range-row strong {
  min-width: 68px;
  text-align: right;
}

.icon-button {
  width: 56px;
  min-width: 56px;
  padding: 0;
  font-size: 0.82rem;
}

.primary-action {
  min-width: 110px;
  padding: 0 16px;
  border-color: var(--forest);
  background: var(--forest);
  color: #fff;
}

.ghost-action {
  min-width: 88px;
  padding: 0 14px;
}

.timeline {
  display: grid;
  gap: 12px;
}

.block {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.block-time {
  align-self: start;
  border-radius: 8px;
  background: var(--mint);
  color: var(--forest);
  padding: 8px;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 900;
}

.block h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
}

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

.move-list li {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e5e9e2;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  line-height: 1.35;
}

.move-list strong {
  color: var(--ink);
}

.move-visual {
  display: grid;
  place-items: center;
  width: 86px;
  aspect-ratio: 4 / 3;
  border: 1px solid #dfe8df;
  border-radius: 8px;
  background: linear-gradient(135deg, #f6fbf8, #e6f2eb);
  color: var(--forest);
  overflow: hidden;
}

.move-visual svg {
  display: block;
  width: 100%;
  height: 100%;
}

.v-body,
.v-accent,
.v-ground,
.v-prop-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v-body {
  stroke: currentColor;
  stroke-width: 5;
}

.v-accent {
  stroke: var(--coral);
  stroke-width: 4;
}

.v-ground,
.v-prop-line {
  stroke: #9eaaa2;
  stroke-width: 3;
}

.v-head,
.v-accent-fill,
.v-prop {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v-head {
  fill: var(--gold);
  stroke: currentColor;
  stroke-width: 3;
}

.v-accent-fill {
  fill: var(--coral);
}

.v-prop {
  fill: var(--mint);
  stroke: currentColor;
  stroke-width: 3;
}

.move-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.move-copy span {
  color: var(--muted);
  font-size: 0.84rem;
}

.tag {
  display: inline-flex;
  min-width: 62px;
  justify-content: center;
  white-space: nowrap;
  border-radius: 999px;
  background: var(--sky);
  color: #27506d;
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 900;
}

.tracker-panel {
  margin-bottom: 8px;
}

.manual-log {
  grid-template-columns: minmax(220px, 1fr) 120px 140px auto;
  align-items: end;
  margin-bottom: 18px;
}

.history-layout {
  grid-template-columns: 0.85fr 1.15fr;
}

.week-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.bar-day {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 8px;
  min-width: 0;
  height: 160px;
  text-align: center;
}

.bar-track {
  display: flex;
  align-items: end;
  min-height: 100px;
  border-radius: 8px;
  background: #eef2ed;
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  min-height: 4px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--gold), var(--coral));
}

.bar-day strong {
  font-size: 0.78rem;
}

.bar-day span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.history-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.history-list h3 {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.history-list p {
  color: var(--muted);
  font-size: 0.84rem;
}

.delete-entry {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 900;
}

.empty-state {
  padding: 28px 16px;
  border: 1px dashed #b9c5bc;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 880px) {
  .dashboard,
  .workspace,
  .history-layout,
  .manual-log {
    grid-template-columns: 1fr;
  }

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

  .manual-log {
    align-items: stretch;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .section-title,
  .dashboard {
    grid-template-columns: 1fr;
  }

  .today-card {
    min-width: 0;
  }

  .panel,
  .metric {
    padding: 16px;
  }

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

  .block-time {
    justify-self: start;
  }

  .move-list li {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
  }

  .move-visual {
    width: 76px;
  }

  .tag {
    grid-column: 2;
    justify-self: start;
  }

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

  .range-row strong {
    text-align: left;
  }
}
