:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-strong: #f1f4f9;
  --text: #46566f;
  --muted: #9aa7bb;
  --line: #edf0f5;
  --primary: #44b26b;
  --primary-dark: #2f8f51;
  --primary-light: #eaf7ee;
  --shadow: 0 14px 34px rgba(42, 55, 86, 0.06);
  --meal: #f19a4b;
  --workout: #44b26b;
  --english: #4f7edb;
}

@property --rate {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 24px 18px 96px;
}

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

.eyebrow,
.date-label,
.quick-add p,
.category-name,
.summary-card span {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 6px;
  font-size: clamp(26px, 5vw, 36px);
  line-height: 1.12;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

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

.date-label {
  margin-bottom: 0;
}

.topbar > div {
  flex: 1;
  min-width: 0;
}

.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.date-nav .date-label {
  margin: 0;
  min-width: 0;
  flex: 1;
  text-align: center;
}

.date-arrow {
  width: 40px;
  padding: 0;
  background: var(--surface);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.date-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.ghost-button,
.date-nav button,
.quick-add-form button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.ghost-button {
  padding: 0 14px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}

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

.summary-card,
.quick-add,
.routine-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-card {
  min-height: 112px;
  padding: 18px;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.total-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 168px;
}

.total-copy {
  display: grid;
  gap: 10px;
}

.total-copy p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.donut-chart {
  --rate: 0deg;
  --donut-color: var(--workout);
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 108px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--donut-color) 0deg var(--rate), var(--surface-strong) var(--rate) 360deg);
}

.donut-chart::after {
  position: absolute;
  inset: 18px;
  border-radius: inherit;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(23, 32, 51, 0.04);
  content: "";
}

.donut-chart strong {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.donut-chart-large {
  width: 138px;
  --donut-color: var(--workout);
}

.donut-chart-large::after {
  inset: 24px;
}

.donut-chart-large strong {
  font-size: 34px;
}

.date-nav button {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.date-nav button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.date-nav input,
.quick-add-form input,
.quick-add-form select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
}

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

.category-pill {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.category-pill .donut-chart {
  width: 68px;
  --donut-color: var(--category-color);
}

.category-pill .donut-chart::after {
  inset: 12px;
}

.category-pill .donut-chart strong {
  color: var(--category-color);
  font-size: 16px;
}

.category-copy {
  display: grid;
  gap: 4px;
}

.category-copy span {
  font-weight: 800;
}

.category-copy small {
  color: var(--category-color);
  font-size: 13px;
  font-weight: 900;
}

.quick-add {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  align-items: end;
  padding: 18px;
  margin-bottom: 16px;
}

.quick-add p {
  margin-bottom: 0;
}

.quick-add-form {
  display: grid;
  grid-template-columns: 150px 1fr 1fr auto;
  gap: 8px;
}

.quick-add-form button {
  padding: 0 18px;
  background: var(--text);
  color: white;
}

.routine-list {
  display: grid;
  gap: 14px;
}

.routine-card {
  --category-color: var(--primary);
  overflow: hidden;
}

.routine-card[data-category="meal"] {
  --category-color: var(--meal);
}

.routine-card[data-category="workout"] {
  --category-color: var(--workout);
}

.routine-card[data-category="english"] {
  --category-color: var(--english);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 164px;
  padding: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--text);
  text-align: left;
}

.category-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--category-color);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.category-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--category-color) 12%, white);
  color: var(--category-color);
}

.category-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.day-heading {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.day-heading h3 {
  color: var(--text);
  font-size: clamp(20px, 3vw, 24px);
  line-height: 1.18;
}

.routine-note {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.routine-note[hidden] {
  display: none;
}

.card-donut {
  flex: 0 0 auto;
  width: 116px;
  --donut-color: var(--category-color);
  background: conic-gradient(var(--donut-color) 0deg var(--rate), var(--surface-strong) var(--rate) 360deg);
}

.card-donut::after {
  inset: 22px;
  background: var(--surface);
}

.card-donut strong {
  color: var(--category-color);
  font-size: 22px;
}

.card-rate {
  color: var(--category-color);
  font-size: 13px;
  font-weight: 900;
}

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

.empty-item {
  padding: 14px 8px;
  color: var(--muted);
  font-weight: 700;
}

.check-section {
  display: block;
  margin: 8px 0 3px;
  padding: 5px 7px;
  border: 1px solid color-mix(in srgb, var(--category-color) 18%, white);
  border-radius: 6px;
  background: color-mix(in srgb, var(--category-color) 9%, white);
  color: var(--category-color);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-align: left;
}

.check-section::before,
.check-section::after {
  content: none;
}

.check-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  min-height: 32px;
  padding: 4px 2px 4px 6px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.check-item:hover {
  background: #fafbfd;
}

.check-item label {
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
  justify-content: space-between;
  min-width: 0;
  gap: 8px;
  cursor: pointer;
  grid-column: 1 / -1;
}

.check-item input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.checkbox-ui {
  display: grid;
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid #d7deeb;
  border-radius: 2px;
  background: white;
}

.checkbox-ui::after {
  width: 5px;
  height: 9px;
  margin-top: -2px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  content: "";
}

.check-item input:checked + .checkbox-ui {
  border-color: var(--category-color);
  background: var(--category-color);
}

.check-item input:checked + .checkbox-ui::after {
  transform: rotate(45deg) scale(1);
}

.check-item input:checked ~ .item-copy .item-title {
  color: var(--muted);
  text-decoration: line-through;
}

.item-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.item-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.item-title {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.item-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.item-note[hidden] {
  display: none;
}

.method-link,
.delete-item {
  border-radius: 3px;
}

.method-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 20px;
  padding: 0 6px;
  background: color-mix(in srgb, var(--category-color) 12%, white);
  color: var(--category-color);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.method-link[hidden] {
  display: none;
}

.delete-item {
  width: 26px;
  min-height: 26px;
  border: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 18px;
  line-height: 1;
}

.delete-item:hover {
  background: #fee2e2;
  color: #dc2626;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 10;
  display: none;
  width: min(calc(100% - 28px), 420px);
  transform: translateX(-50%);
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.bottom-nav a {
  display: grid;
  min-height: 52px;
  place-items: center;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
}

.bottom-nav a + a {
  border-left: 1px solid var(--line);
}

@media (max-width: 820px) {
  .app-shell {
    padding: 22px 14px 92px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .ghost-button {
    width: 100%;
  }

  .summary-grid,
  .category-rates,
  .quick-add,
  .quick-add-form {
    grid-template-columns: 1fr;
  }

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

  .total-card {
    grid-column: 1 / -1;
  }

  .bottom-nav {
    display: grid;
  }
}

@media (max-width: 460px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .total-card {
    align-items: center;
  }

  .donut-chart-large {
    width: 124px;
  }

  .check-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .delete-item {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
  }
}
