:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f5f2ea;
  color: #142018;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(18, 75, 45, 0.12), rgba(245, 242, 234, 0) 260px),
    #f5f2ea;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 14px 42px;
}

.hero {
  min-height: 162px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 2px 18px;
}

.hero h1 {
  margin: 6px 0 8px;
  font-size: clamp(2.05rem, 9vw, 4.2rem);
  line-height: 0.92;
  letter-spacing: 0;
  color: #102017;
}

.hero p {
  max-width: 31rem;
  margin: 0;
  color: #526257;
  font-size: 0.98rem;
  line-height: 1.5;
}

.eyebrow {
  display: block;
  color: #1b7a49;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.hero-actions button {
  min-width: 56px;
  min-height: 38px;
  border: 1px solid rgba(16, 32, 23, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: #102017;
  padding: 0 12px;
  font-weight: 850;
}

.hero-actions button:hover {
  background: #eef4ec;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.stat-card,
.panel,
.week-card {
  border: 1px solid rgba(16, 32, 23, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 16px 44px rgba(35, 48, 38, 0.08);
}

.stat-card {
  min-height: 150px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card.primary {
  min-height: 150px;
  background: #102017;
  color: #f7fbf5;
}

.stat-card span {
  color: inherit;
  opacity: 0.72;
  font-size: 0.82rem;
  font-weight: 720;
}

.stat-card strong {
  font-size: clamp(1.8rem, 9vw, 3.7rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.panel {
  padding: 16px;
  margin: 10px 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title span {
  font-size: 1rem;
  font-weight: 850;
}

.section-title strong {
  color: #1b7a49;
  font-size: 1.7rem;
}

.section-title small {
  color: #6c776f;
  font-size: 0.78rem;
}

.floating {
  padding: 14px 2px 2px;
  margin-bottom: 10px;
}

.field,
.range-field,
.compact-field {
  display: grid;
  gap: 8px;
}

.field span,
.range-field span,
.compact-field span {
  color: #425044;
  font-size: 0.82rem;
  font-weight: 760;
}

.range-field b {
  color: #102017;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  min-height: 42px;
  border: 1px solid rgba(16, 32, 23, 0.16);
  border-radius: 8px;
  background: #fbfaf6;
  color: #102017;
  padding: 0 12px;
  font-weight: 760;
}

input[type="range"] {
  accent-color: #1b7a49;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: start center;
  padding: 132px 16px 28px;
  background: rgba(16, 32, 23, 0.14);
  backdrop-filter: blur(1px);
}

.slot-dialog,
.name-dialog {
  width: min(100%, 444px);
  border: 1px solid rgba(16, 32, 23, 0.2);
  border-radius: 8px;
  background: #fffefa;
  box-shadow: 0 20px 52px rgba(16, 32, 23, 0.22);
  padding: 16px;
}

.dialog-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dialog-title-row h2,
.name-dialog h2 {
  margin: 0;
  color: #677080;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.dialog-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #9aa2ae;
  font-size: 1.5rem;
  font-weight: 850;
}

.slot-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
}

.picker-slot {
  position: relative;
  min-width: 0;
}

.picker-slot > button:first-child {
  width: 100%;
  min-height: 82px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1e2430;
  padding: 12px 36px 12px 14px;
  text-align: left;
  display: grid;
  align-content: center;
  gap: 5px;
}

.picker-slot > button:first-child:hover,
.picker-slot.filled > button:first-child:hover {
  background: #eef4ec;
}

.picker-slot.empty > button:first-child:hover {
  background: #eceae5;
}

.picker-slot > button:first-child:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.picker-slot strong {
  font-size: 1.08rem;
  line-height: 1;
}

.picker-slot span {
  color: #9aa2ae;
  font-size: 0.92rem;
  font-weight: 740;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-slot.filled > button:first-child {
  background: #f3f7f1;
}

.slot-trash {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  display: grid;
  place-items: center;
}

.slot-trash:hover {
  background: #fff3ef;
}

.slot-trash svg {
  width: 17px;
  height: 17px;
  fill: #9aa2ae;
}

.slot-trash:hover svg {
  fill: #e34d3c;
}

.name-dialog {
  display: grid;
  gap: 14px;
}

.name-dialog input {
  width: 100%;
  min-height: 68px;
  border: 3px solid #2f995f;
  border-radius: 999px;
  background: #fbfaf6;
  color: #1e2430;
  padding: 0 28px;
  font-size: 1.3rem;
  outline: none;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dialog-actions button {
  min-height: 56px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 850;
}

.secondary-action {
  border: 1px solid rgba(16, 32, 23, 0.14);
  background: #fbfaf6;
  color: #1e2430;
}

.primary-action {
  border: 0;
  background: #4fa36e;
  color: #fff;
}

.controls-panel {
  display: grid;
  gap: 16px;
}

.trend-panel {
  overflow: hidden;
}

.trend-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 160px;
}

.trend-chart line {
  stroke: rgba(16, 32, 23, 0.16);
  stroke-width: 1;
}

.trend-chart path {
  fill: none;
  stroke: #1b7a49;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.trend-point {
  cursor: pointer;
  outline: none;
}

.trend-point .hit-area {
  fill: transparent;
}

.trend-point .dot {
  fill: #f8c44f;
  stroke: #102017;
  stroke-width: 1.3;
}

.trend-point .lowest-dot {
  fill: #e34d3c;
  stroke-width: 1.6;
}

.trend-point .highest-dot {
  fill: #1b7a49;
  stroke-width: 1.6;
}

.trend-point text {
  opacity: 0;
  pointer-events: none;
  paint-order: stroke;
  stroke: #fffdf8;
  stroke-width: 4px;
  stroke-linejoin: round;
  font-size: 9px;
  font-weight: 850;
  transition: opacity 0.16s ease;
}

.trend-point .tooltip-label {
  fill: #102017;
}

.trend-point .tooltip-value {
  fill: #1b7a49;
}

.trend-point:hover .dot,
.trend-point:focus .dot {
  r: 5;
}

.trend-point:hover text,
.trend-point:focus text {
  opacity: 1;
}

.trend-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #526257;
  font-size: 0.82rem;
  font-weight: 760;
}

.week-list {
  display: grid;
  gap: 10px;
}

.week-card {
  padding: 14px;
}

.week-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.week-header h3 {
  margin: 4px 0 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.week-header strong {
  color: #1b7a49;
  font-size: 1.55rem;
  line-height: 1;
}

.week-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.week-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.week-metrics span {
  min-height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  border-radius: 8px;
  background: #eef4ec;
  color: #59665c;
  padding: 8px;
  font-size: 0.72rem;
  font-weight: 740;
}

.week-metrics b {
  color: #102017;
  font-size: 1rem;
}

.audit-panel {
  display: grid;
  gap: 14px;
  background: #fffdf8;
}

.audit-panel h2 {
  margin: 4px 0 6px;
  font-size: 1.15rem;
  letter-spacing: 0;
}

.audit-panel p {
  margin: 0;
  color: #526257;
  line-height: 1.5;
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.audit-grid span {
  min-height: 58px;
  border-radius: 8px;
  background: #eef4ec;
  color: #526257;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8px;
  font-size: 0.75rem;
  font-weight: 760;
}

.audit-grid b {
  display: block;
  color: #102017;
  font-size: 1.2rem;
}

@media (max-width: 470px) {
  .hero {
    min-height: 150px;
    display: grid;
  }

  .hero-actions {
    width: 100%;
    justify-content: space-between;
  }

  .hero-actions button {
    flex: 1;
  }

  .dialog-backdrop {
    padding-top: 96px;
  }

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

  .stat-card.primary {
    min-height: 142px;
  }

  .slot-picker,
  .dialog-actions,
  .week-controls,
  .week-metrics,
  .audit-grid {
    grid-template-columns: 1fr;
  }
}
