:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #eef4ef;
  --ink: #17201a;
  --muted: #67716a;
  --line: #dce5df;
  --green: #1f7a4a;
  --blue: #1f64a8;
  --red: #b84242;
  --amber: #966313;
  --shadow: 0 16px 45px rgba(27, 39, 31, 0.09);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.auth-callback {
  width: min(420px, calc(100% - 32px));
  min-height: 100vh;
  display: grid;
  align-items: center;
  margin: 0 auto;
}

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

.eyebrow,
.label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 3.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.auth-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 180px;
}

.notice,
.status-strip,
.panel,
.day-card,
.shopping-row,
.recipe-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notice {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 14px 16px;
  color: #5c3b05;
  background: #fff7df;
  border-color: #efd899;
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  margin-bottom: 14px;
}

.status-strip strong {
  display: block;
  min-height: 1.35em;
  font-size: 0.95rem;
}

.secondary-button,
.primary-button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  min-height: 38px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.tabbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

.view {
  display: grid;
  gap: 14px;
}

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

.view-header h2 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: 0;
}

.view-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.panel {
  grid-column: span 6;
  padding: 16px;
}

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

.panel h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  letter-spacing: 0;
}

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

.line-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 30px;
}

.dot {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--green);
}

.line-title {
  display: block;
  font-weight: 750;
}

.line-meta {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.person-pill,
.quantity-pill,
.type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.day-card {
  min-height: 260px;
  padding: 12px;
  box-shadow: none;
}

.day-card.today {
  border-color: #9bc9ac;
  background: #fbfffb;
}

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.day-name {
  font-weight: 850;
}

.day-number {
  color: var(--muted);
  font-weight: 750;
}

.mini-stack {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
}

.mini-section strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.shopping-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.shopping-tools input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
}

.shopping-list,
.recipe-list {
  display: grid;
  gap: 8px;
}

.shopping-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 50px;
  padding: 8px 10px;
  box-shadow: none;
}

.shopping-row.done {
  color: var(--muted);
  background: #f7f8f7;
}

.shopping-row.done .item-name {
  text-decoration: line-through;
}

.shopping-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
}

.item-name {
  display: block;
  font-weight: 780;
}

.item-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, 0.4fr) auto;
  gap: 8px;
}

.item-editor input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}

.danger {
  color: white;
  background: var(--red);
  border-color: var(--red);
}

.recipe-row {
  padding: 14px;
  box-shadow: none;
}

.recipe-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.recipe-top h3 {
  margin: 0;
  font-size: 1.05rem;
}

.recipe-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.ingredient-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  .dashboard-grid,
  .week-grid {
    grid-template-columns: 1fr;
  }

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

  .day-card {
    min-height: 0;
  }
}

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

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

  .auth-controls {
    justify-content: flex-start;
    min-width: 0;
  }

  .status-strip,
  .shopping-tools,
  .shopping-row,
  .item-editor {
    grid-template-columns: 1fr;
  }

  .shopping-row {
    align-items: stretch;
  }
}
