:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #5f6f7d;
  --paper: #fbfcfd;
  --panel: #ffffff;
  --line: #dce6ee;
  --blue: #1d6fd1;
  --cyan: #0c9ca8;
  --green: #2d8a57;
  --sun: #f5c542;
  --rose: #db6b6b;
  --shadow: 0 16px 40px rgba(20, 38, 54, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(29, 111, 209, 0.10), transparent 34%),
    linear-gradient(225deg, rgba(45, 138, 87, 0.10), transparent 36%),
    var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1420px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 22px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 16px rgba(29, 111, 209, 0.2));
}

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(76px, 1fr));
  gap: 8px;
  min-width: min(360px, 100%);
}

.scoreboard div {
  min-height: 70px;
  padding: 12px;
  border: 1px solid rgba(220, 230, 238, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(20, 38, 54, 0.08);
}

.scoreboard span {
  display: block;
  font-size: 1.45rem;
  font-weight: 850;
}

.scoreboard small {
  color: var(--muted);
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(270px, 330px) minmax(0, 1fr) minmax(270px, 330px);
  gap: 16px;
  align-items: start;
}

.panel,
.board {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.board {
  min-height: 620px;
  padding: 18px;
}

.panel-heading,
.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.meal-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

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

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 111, 209, 0.18);
}

.primary-button,
.text-button,
.quick-picks button,
.view-toggle button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 8px;
}

.primary-button {
  min-height: 46px;
  background: var(--blue);
  color: #fff;
  font-weight: 850;
}

.primary-button:hover {
  background: #155cb0;
}

.text-button {
  min-height: 36px;
  padding: 0 10px;
  background: #edf5f7;
  color: #176772;
  font-size: 0.82rem;
  font-weight: 800;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  background: #f4f8fb;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 900;
}

.form-note {
  min-height: 20px;
  margin: 0;
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 750;
}

.quick-picks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.quick-picks button {
  min-height: 42px;
  background: #f6fafc;
  color: #355364;
  font-size: 0.78rem;
  font-weight: 800;
}

.view-toggle {
  display: grid;
  grid-template-columns: repeat(3, minmax(68px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8fb;
}

.view-toggle button {
  min-height: 34px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.view-toggle .active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 10px rgba(20, 38, 54, 0.1);
}

.meal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.meal-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(12, 156, 168, 0.08), transparent 45%),
    #fff;
}

.meal-card.empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.56);
}

.meal-slot {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.meal-items {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.grocery-list li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.grocery-list input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--green);
}

.grocery-list .checked {
  color: var(--muted);
  text-decoration: line-through;
}

.source-pill {
  padding: 4px 7px;
  border-radius: 999px;
  background: #fff6d8;
  color: #6d5312;
  font-size: 0.7rem;
  font-weight: 850;
}

.empty-state {
  margin: 18px 0 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f8fbfd;
  line-height: 1.45;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
  }

  .grocery-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 640px);
    padding-top: 10px;
  }

  .topbar,
  .panel-heading,
  .board-header {
    align-items: stretch;
    flex-direction: column;
  }

  .scoreboard,
  .workspace,
  .meal-grid {
    grid-template-columns: 1fr;
  }

  .board {
    min-height: auto;
  }

  .quick-picks,
  .view-toggle {
    grid-template-columns: 1fr;
  }
}
