  :root {
  --bg: #f5f1eb;
  --surface: #ffffff;
  --surface-strong: #f2e9df;
  --primary: #6a8b6b;
  --primary-strong: #4f7052;
  --accent: #a47c53;
  --text: #2f2b28;
  --muted: rgba(47, 43, 40, 0.65);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --viewport-height: 100vh;
  --card-min-height-desktop: 360px;
  --card-min-height-tablet: 320px;
  --card-min-height-phone: 260px;
  --card-max-height-offset-desktop: 190px;
  --card-max-height-offset-tablet: 210px;
  --card-max-height-offset-phone: 230px;
}

@supports (height: 100svh) {
  :root {
    --viewport-height: 100svh;
  }
}

@supports (height: 100dvh) {
  :root {
    --viewport-height: 100dvh;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at 80% 0%, rgba(106, 139, 107, 0.08), transparent 30%),
    var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}

button,
input,
textarea {
  font-family: inherit;
  font-size: 1rem;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: linear-gradient(90deg, rgba(106, 139, 107, 0.95), rgba(164, 124, 83, 0.95));
  color: #fff;
  box-shadow: var(--shadow);
}

.left-actions,
.right-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.top-bar .app-title {
  text-align: center;
  line-height: 1.2;
  flex: 1;
}

.top-bar small {
  display: block;
  font-weight: 500;
  opacity: 0.9;
}

.icon-button {
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  border: none;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font-size: 0.88rem;
  line-height: 1;
}

.ui-icon {
  width: 20px;
  height: 20px;
  display: inline-block;
}

.ui-icon.small {
  width: 18px;
  height: 18px;
}

.ui-icon.small .tone-1 {
  stroke-width: 1.95;
}

.ui-icon .tone-1 {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ui-icon .tone-2 {
  fill: color-mix(in srgb, currentColor 18%, transparent);
  stroke: none;
}

.icon-button.add-cta {
  justify-content: center;
  gap: 0.45rem;
  min-width: 40px;
  padding: 0.55rem 0.85rem;
  min-height: 42px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.top-bar .icon-button.add-cta {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  border: none;
  box-shadow: var(--shadow);
  color: #fff;
}

.top-bar .icon-button.add-cta:hover {
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
}

.icon-button.add-cta .btn-label {
  display: inline;
  font-weight: inherit;
  white-space: nowrap;
}

.top-bar .icon-button {
  flex: 0 0 auto;
  width: auto;
}

.top-bar .icon-button .ui-icon {
  width: clamp(22px, 1.9vw, 28px);
  height: clamp(22px, 1.9vw, 28px);
}

.top-bar .icon-button .ui-icon .tone-1 {
  stroke-width: 2.05;
}

.top-bar .icon-button .ui-icon .tone-2 {
  display: none;
}

.top-bar .icon-button.add-cta {
  gap: 0.4rem;
}

.top-bar .icon-button.add-cta .ui-icon {
  width: clamp(16px, 1.25vw, 20px);
  height: clamp(16px, 1.25vw, 20px);
}

.modal-header .icon-button .ui-icon {
  width: 18px;
  height: 18px;
}

.section-add .ui-icon,
.item .icon-button .ui-icon,
.meal-add-inline .ui-icon {
  width: 16px;
  height: 16px;
}

.chip.nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button.add-cta:hover {
  background: rgba(255, 255, 255, 0.26);
}

.modal-header .icon-button.add-cta {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  border: none;
  box-shadow: var(--shadow);
  color: #fff;
}

.modal-header .icon-button.add-cta:hover {
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.icon-button:active {
  transform: scale(0.98);
}

.meal-modal-header-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.adjust-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.adjust-row {
  display: grid;
  grid-template-columns: 1fr 212px;
  gap: 0.6rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 14px;
  background: var(--surface-strong);
  border: 1px solid rgba(47, 43, 40, 0.08);
}

.adjust-row.is-removed {
  opacity: 0.65;
}

.adjust-stepper {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(47, 43, 40, 0.1);
  border-radius: 12px;
  padding: 0.25rem;
}

.adjust-controls {
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 0.35rem;
  align-items: center;
}

.stepper-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(47, 43, 40, 0.1);
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.stepper-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.stepper-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}

.stepper-count {
  font-weight: 800;
}

.stepper-count-input {
  width: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-weight: 800;
  color: var(--accent);
  font-size: 1rem;
  padding: 0;
}

.stepper-count-input:focus {
  outline: none;
}

.stepper-count-input::-webkit-outer-spin-button,
.stepper-count-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.stepper-count-input[type='number'] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.stepper-unit {
  font-size: 0.82rem;
  color: var(--muted);
}

.adjust-unit-select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(47, 43, 40, 0.1);
  background: color-mix(in srgb, var(--accent) 22%, white);
  color: var(--text);
  padding: 0.45rem 0.4rem;
}

.adjust-needed-inline {
  margin-left: 0.6rem;
  color: var(--primary-strong);
  opacity: 0.7;
}

.adjust-row .meta {
  margin: 0;
}

.boxed-textarea {
  background: var(--surface-strong);
  border-radius: 14px;
}

.view-switcher {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  position: sticky;
  top: 62px;
  background: linear-gradient(to bottom, rgba(245, 241, 235, 0.95), rgba(245, 241, 235, 0.75));
  z-index: 4;
  backdrop-filter: blur(6px);
}

.chip.nav {
  padding: 0.6rem 0.9rem;
}

.chip {
  padding: 0.6rem 1.2rem;
  border-radius: 30px;
  border: 1px solid rgba(47, 43, 40, 0.1);
  background: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.chip.active {
  background: linear-gradient(135deg, rgba(106, 139, 107, 0.2), rgba(164, 124, 83, 0.2));
  border-color: rgba(106, 139, 107, 0.4);
}

main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem;
}

.day-view {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  align-items: start;
  grid-auto-rows: auto;
}

.week-view {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  align-items: start;
  grid-auto-rows: auto;
}

/* Ukekalender: gjør hver dag bredere. Hvis det ikke er plass, scroll horisontalt. */
#weekView.week-view {
  grid-template-columns: repeat(7, minmax(260px, 1fr));
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}

/* Week view: tighten tasks/activities so 7 columns can breathe */
#weekView .card {
  padding: 0.9rem;
}

#weekView .card-header {
  margin-bottom: 0.35rem;
}

#weekView .card-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

#weekView .section {
  padding: 0.6rem;
  border-radius: 12px;
  margin-top: 0.45rem;
}

#weekView .section h4 {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

#weekView .item {
  padding: 0.5rem;
  border-radius: 10px;
  font-size: 0.92rem;
}

#weekView .meta {
  font-size: 0.82rem;
}

#weekView .labels {
  font-size: 0.78rem;
  gap: 0.2rem;
}

#weekView .labels .pill {
  padding: 0.15rem 0.35rem;
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

.card {
  background: var(--surface);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(47, 43, 40, 0.05);
}

/* Hold en pen tredeling per dag (Gjøremål / Aktiviteter / Middag) i begge visninger */
.day-view .card,
.week-view .card {
  display: block;
  height: auto;
  min-height: var(--card-min-height-desktop);
  max-height: none;
  overflow: visible;
}

.day-view .card > .section,
.week-view .card > .section {
  flex: initial;
}

.day-view .card > .section.activities-section,
.week-view .card > .section.activities-section {
  flex: initial;
}

.day-view .section,
.week-view .section {
  min-height: auto;
  overflow: visible;
  display: block;
}

/* Tighten activities so 4–5 items fit */
.activities-section .list {
  gap: 0.25rem;
}

.activities-section .item {
  padding: 0.5rem;
}

.activities-section .item .meta {
  font-size: 0.82rem;
}

.activities-section .labels {
  font-size: 0.8rem;
  gap: 0.2rem;
}

.day-view .list,
.week-view .list {
  min-height: auto;
}

.card.highlight {
  border: 2px solid rgba(106, 139, 107, 0.5);
  box-shadow: 0 10px 30px rgba(106, 139, 107, 0.18);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.card-header h3 {
  margin: 0;
}

.card-header .inline-date {
  margin-left: 0.3rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(106, 139, 107, 0.2), rgba(164, 124, 83, 0.2));
  color: var(--primary-strong);
  font-weight: 600;
}

.section {
  border-radius: 14px;
  padding: 0.75rem;
  background: linear-gradient(180deg, rgba(106, 139, 107, 0.06), rgba(164, 124, 83, 0.03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  margin-top: 0.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.4rem;
}

.section h4 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.section-add {
  padding: 0.25rem 0.45rem;
  border-radius: 10px;
  box-shadow: none;
}

.section-empty {
  padding-bottom: 0.45rem;
}

.section-empty .section-header {
  margin-bottom: 0.2rem;
}

.section-empty .list {
  display: none;
}

.section-empty-hint {
  margin: 0;
  font-size: 0.82rem;
}

.meal-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0 0.1rem;
}

.meal-empty.compact {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.1rem 0;
}

.meal-add-big {
  font-size: 1.6rem;
  line-height: 1;
  padding: 0.6rem 0.9rem;
}

.meal-add-inline {
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.item {
  padding: 0.65rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(47, 43, 40, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.task-open-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}

.task-item {
  cursor: pointer;
}

.task-title {
  font-weight: 600;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}

.task-item:hover .task-title {
  text-decoration: underline;
}

.item.has-recurrence {
  position: relative;
}

.item.has-recurrence::after {
  content: '♻️';
  position: absolute;
  top: 0.18rem;
  right: 0.2rem;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  background: rgba(106, 139, 107, 0.2);
  border: 1px solid rgba(106, 139, 107, 0.48);
  box-shadow: 0 1px 2px rgba(47, 43, 40, 0.1);
  line-height: 1;
  pointer-events: none;
}

.task-open {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}

.task-open:hover {
  text-decoration: underline;
}

.item.done {
  border-color: rgba(106, 139, 107, 0.6);
  background: linear-gradient(135deg, rgba(106, 139, 107, 0.12), rgba(255, 255, 255, 0.9));
}

.item.missed {
  border-color: rgba(208, 125, 75, 0.55);
  background: linear-gradient(135deg, rgba(208, 125, 75, 0.12), rgba(255, 255, 255, 0.9));
}

.item.missed .checkbox span {
  text-decoration: line-through;
  opacity: 0.85;
}

.assignee-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.assignee-actions .secondary {
  padding: 0.45rem 0.7rem;
  font-weight: 700;
}

.confetti-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10vh;
  left: var(--x, 50vw);
  width: var(--w, 10px);
  height: var(--h, 14px);
  background: var(--c, #6a8b6b);
  border-radius: 3px;
  opacity: 0;
  transform: translate3d(0, 0, 0) rotate(0deg);
  animation: confetti-pop 160ms ease-out forwards,
    confetti-fall var(--dur, 1400ms) cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: 0ms, var(--delay, 0ms);
}

@keyframes confetti-pop {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, -5vh, 0) rotate(0deg);
  }
  100% {
    transform: translate3d(var(--dx, 0vw), 110vh, 0) rotate(var(--rot, 720deg));
    opacity: 0.95;
  }
}

@media (prefers-reduced-motion: reduce) {
  .confetti-overlay {
    display: none;
  }
}

.labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.calendar-item {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent);
}

.labels .pill {
  padding: 0.2rem 0.45rem;
  background: rgba(106, 139, 107, 0.15);
  border-radius: 10px;
}

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

.meal-card img {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.meal-card-title {
  margin-bottom: 0.5rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meal-footer {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.rating {
  display: flex;
  gap: 0.2rem;
}

.star,
.die {
  font-size: 1.1rem;
  color: var(--accent);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
  z-index: 50;
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.meal-db-modal {
  width: min(980px, 100%);
}

.meal-db-body {
  display: grid;
  gap: 0.85rem;
}

.meal-db-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.meal-db-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.meal-db-card {
  border: 1px solid rgba(47, 43, 40, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  padding: 0.75rem;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.06);
  display: grid;
  gap: 0.55rem;
}

.meal-db-card:hover {
  transform: translateY(-1px);
}

.meal-db-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(47, 43, 40, 0.06);
}

.meal-db-card-title {
  font-weight: 800;
  margin: 0;
}

.meal-db-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.92rem;
}

.meal-db-card-actions {
  display: flex;
  justify-content: flex-end;
}

.meal-db-card-actions .secondary {
  padding: 0.45rem 0.7rem;
  font-weight: 800;
}

.meal-db-detail-head {
  display: grid;
  gap: 0.75rem;
}

.meal-db-detail-head img {
  width: 100%;
  border-radius: 16px;
}

.meal-db-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.meal-db-badge {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(106, 139, 107, 0.12);
  border: 1px solid rgba(47, 43, 40, 0.08);
  color: var(--primary-strong);
  font-weight: 700;
  font-size: 0.9rem;
}

.meal-db-notes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

.meal-db-note {
  padding: 0.65rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(47, 43, 40, 0.06);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  position: relative;
  background: var(--surface);
  padding: 1rem 1rem 0.75rem;
  z-index: 5;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.08);
}

.modal-body {
  padding: 0 1rem 1rem;
  overflow-y: auto;
  min-height: 0;
}

.stacked {
  display: grid;
  gap: 0.75rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(47, 43, 40, 0.1);
  background: rgba(255, 255, 255, 0.9);
}

.primary,
.secondary {
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
}

.secondary {
  background: rgba(106, 139, 107, 0.12);
  color: var(--primary-strong);
}

.checkbox,
.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.switch {
  position: relative;
  padding-left: 52px;
}

.switch input {
  display: none;
}

.switch .slider {
  position: absolute;
  inset: 0;
  left: 0;
  width: 44px;
  height: 24px;
  background: rgba(106, 139, 107, 0.35);
  border-radius: 999px;
  transition: background 0.2s;
}

.switch .slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.switch input:checked + .slider {
  background: var(--primary);
}

.switch input:checked + .slider::after {
  transform: translateX(18px);
}

.weekday-pill {
  padding: 0.45rem 0.75rem;
  border-radius: 12px;
  background: rgba(106, 139, 107, 0.12);
  border: 1px solid rgba(47, 43, 40, 0.08);
  cursor: pointer;
}

.weekday-select {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.weekday-pill.active {
  background: rgba(106, 139, 107, 0.25);
  border-color: rgba(106, 139, 107, 0.6);
}

.day-calendar {
  margin-top: 0.35rem;
  padding: 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(47, 43, 40, 0.1);
  background: rgba(255, 255, 255, 0.9);
}

.day-calendar-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.day-calendar-title {
  text-align: center;
  font-weight: 700;
  text-transform: capitalize;
}

.day-calendar-weekdays,
.day-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
}

.day-calendar-weekdays {
  margin-bottom: 0.25rem;
}

.day-calendar-weekdays div {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

.day-calendar-day {
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(47, 43, 40, 0.08);
  background: rgba(106, 139, 107, 0.08);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.day-calendar-day.is-outside {
  opacity: 0.45;
}

.day-calendar-day.is-today {
  border: 2px solid #d93b3b;
}

.day-calendar-day.is-selected {
  background: rgba(106, 139, 107, 0.25);
  border-color: rgba(106, 139, 107, 0.6);
}

.day-calendar-selected {
  margin-top: 0.45rem;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}

.meal-modal img {
  width: 100%;
  border-radius: 16px;
}

.recipe-block {
  margin-top: 0.75rem;
  border-radius: 16px;
  padding: 0.85rem;
  background: linear-gradient(180deg, rgba(106, 139, 107, 0.06), rgba(164, 124, 83, 0.04));
  border: 1px solid rgba(47, 43, 40, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.recipe-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.recipe-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.recipe-section h3 {
  margin: 0.5rem 0 0.4rem;
  font-size: 1rem;
}

.recipe-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.recipe-item {
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(47, 43, 40, 0.06);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.recipe-text {
  white-space: pre-wrap;
  padding: 0.65rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(47, 43, 40, 0.06);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.meal-controls,
.meal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.meal-actions {
  margin-top: 0.5rem;
}

.shopping-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: grid;
  gap: 0.4rem;
}

.shopping-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(47, 43, 40, 0.08);
}

.shopping-item-done {
  opacity: 0.72;
}

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

.shopping-left {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem;
  align-items: start;
}

.shopping-checkbox {
  margin-top: 0.15rem;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.shopping-left-content {
  display: grid;
  gap: 0.15rem;
}

.shopping-title {
  font-weight: 700;
}

.shopping-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shopping-stepper {
  min-width: 140px;
}

.shopping-modal .modal-header .icon-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
  border-radius: 14px;
}

.shopping-modal .modal-header .icon-button .ui-icon {
  width: 24px;
  height: 24px;
}

.shopping-remove-btn {
  min-width: 40px;
  min-height: 40px;
  padding: 0.4rem;
}

.shopping-remove-btn .ui-icon {
  width: 20px;
  height: 20px;
}

.shopping-unit {
  border-radius: 12px;
  border: 1px solid rgba(47, 43, 40, 0.1);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.4rem 0.6rem;
  color: var(--text);
}

.members {
  display: grid;
  gap: 0.5rem;
}

.settings-modal {
  width: min(1120px, 100%);
  max-height: 94vh;
}

.settings-body {
  display: grid;
  gap: 0.9rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.settings-card {
  display: grid;
  gap: 0.75rem;
  padding: 1.05rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(47, 43, 40, 0.09);
}

.settings-card h3 {
  margin: 0;
}

.settings-login-steps {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.settings-inline-actions {
  justify-content: flex-start;
}

.settings-hero {
  gap: 0.8rem;
  background: linear-gradient(180deg, rgba(106, 139, 107, 0.14), rgba(255, 255, 255, 0.98));
}

.settings-hero-head {
  display: grid;
  gap: 0.3rem;
}

.settings-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.settings-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 999px;
  border: 1px solid rgba(47, 43, 40, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 0.84rem;
  padding: 0.28rem 0.65rem;
}

.settings-status-stack {
  display: grid;
  gap: 0.3rem;
}

.settings-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: 0;
  display: grid;
  gap: 0.45rem;
  border-radius: 16px;
  border: 1px solid rgba(47, 43, 40, 0.08);
  background: rgba(255, 255, 255, 0.86);
  padding: 0.55rem;
}

.settings-nav-btn {
  width: 100%;
  text-align: left;
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 0.55rem 0.65rem;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.settings-nav-btn:hover {
  background: rgba(106, 139, 107, 0.09);
}

.settings-nav-btn.active {
  background: rgba(106, 139, 107, 0.2);
  border-color: rgba(106, 139, 107, 0.3);
}

.settings-content {
  display: grid;
  gap: 0.8rem;
}

.settings-panel {
  scroll-margin-top: 1rem;
}

.settings-inline-copy {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.settings-inline-copy input {
  flex: 1;
}

.settings-accordion {
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(47, 43, 40, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.settings-accordion > summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  padding: 0.95rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(106, 139, 107, 0.08);
}

.settings-accordion > summary::-webkit-details-marker {
  display: none;
}

.settings-accordion > summary::after {
  content: '▾';
  font-size: 0.9rem;
  color: var(--muted);
}

.settings-accordion:not([open]) > summary::after {
  transform: rotate(-90deg);
}

.settings-accordion-content {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.settings-mini-grid {
  display: grid;
  gap: 0.65rem;
}

.settings-mini-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(47, 43, 40, 0.08);
  background: rgba(255, 255, 255, 0.84);
}

.settings-mini-card h4 {
  margin: 0;
  font-size: 0.98rem;
}

@media (max-width: 960px) {
  .settings-shell {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .settings-nav-btn {
    text-align: center;
    font-size: 0.86rem;
  }
}

@media (max-width: 700px) {
  .settings-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-inline-copy {
    flex-direction: column;
    align-items: stretch;
  }
}

.member-card {
  display: grid;
  gap: 0.6rem;
  padding: 0.65rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(47, 43, 40, 0.08);
}

.member-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.member-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.member-icon-picker {
  position: relative;
}

.member-icon-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  width: 100%;
  min-height: 56px;
  border-radius: 10px;
  border: 1px solid rgba(47, 43, 40, 0.14);
  background: var(--surface);
  color: var(--text);
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
}

.member-icon-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  z-index: 10;
  min-width: 320px;
  max-width: 420px;
  padding: 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(47, 43, 40, 0.12);
  background: var(--surface);
  box-shadow: var(--shadow);
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.45rem;
}

.member-icon-picker.open .member-icon-menu {
  display: grid;
}

.member-icon-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  border: 1px solid rgba(47, 43, 40, 0.12);
  border-radius: 10px;
  background: var(--surface-strong);
  min-height: 56px;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.member-icon-option.active {
  border-color: rgba(106, 139, 107, 0.7);
  box-shadow: 0 0 0 2px rgba(106, 139, 107, 0.2);
}

.member-calendars {
  display: grid;
  gap: 0.45rem;
}

.member-invite-actions {
  margin-top: 0.1rem;
}

.member-invite-status {
  min-height: 1.2rem;
}

.member-meta {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  color: var(--muted);
}

.order-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

.order-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem;
  border-radius: 10px;
  background: rgba(106, 139, 107, 0.12);
}

.drag-handle {
  border: 1px solid rgba(47, 43, 40, 0.1);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  width: 38px;
  height: 34px;
  cursor: grab;
  color: var(--text);
  font-weight: 800;
}

.order-item.dragging {
  opacity: 0.7;
  outline: 2px solid rgba(47, 43, 40, 0.12);
}

.theme-chooser {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}

.theme-card {
  padding: 0.6rem;
  border-radius: 12px;
  border: 1px solid rgba(47, 43, 40, 0.08);
  background: #fff;
  cursor: pointer;
  display: grid;
  gap: 0.35rem;
}

.theme-card.active {
  outline: 2px solid var(--primary);
}

.theme-swatches {
  display: flex;
  gap: 0.3rem;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.dice-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.dice-btn {
  padding: 0.6rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(47, 43, 40, 0.1);
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font-size: 1.1rem;
  transition: transform 0.1s, background 0.2s;
}

.dice-btn:hover {
  background: rgba(106, 139, 107, 0.15);
  transform: translateY(-2px);
}

.dice-btn:active {
  transform: scale(0.95);
}

.meal-rating-input,
.meal-notes {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(106, 139, 107, 0.05);
  border-radius: 12px;
}

.meal-notes h4,
.meal-rating-input h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.note-item {
  padding: 0.5rem;
  margin: 0.25rem 0;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  font-size: 0.9rem;
}

.image-preview {
  margin-top: 0.5rem;
}

.meal-image-source-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.meal-image-source-actions .secondary {
  padding: 0.45rem 0.7rem;
}

.image-preview img {
  max-width: 100%;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

@media (min-width: 769px) and (max-width: 1024px) {
  .day-view .card,
  .week-view .card {
    height: auto;
    min-height: var(--card-min-height-tablet);
    max-height: none;
  }

  .icon-button.add-cta {
    min-height: 44px;
  }
}

@media (max-width: 768px) {
  main {
    padding: 0.65rem;
  }

  .view-switcher {
    top: 56px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.55rem 0.65rem;
    gap: 0.4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .view-switcher::-webkit-scrollbar {
    display: none;
  }

  .chip,
  .chip.nav {
    padding: 0.5rem 0.8rem;
    font-size: 0.95rem;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.05);
    flex: 0 0 auto;
  }

  .day-view .card,
  .week-view .card {
    height: auto;
    min-height: var(--card-min-height-phone);
    max-height: none;
  }

  .top-bar {
    flex-wrap: nowrap;
    gap: 0.35rem;
    padding: 0.5rem 0.65rem;
  }

  .top-bar .app-title {
    min-width: 0;
  }

  .top-bar #familyNameLabel {
    display: block;
    font-size: 1.02rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-bar small {
    font-size: 0.85rem;
  }

  .top-bar .icon-button:not(.add-cta) {
    min-width: 32px;
    min-height: 32px;
    padding: 0.35rem 0.45rem;
    border-radius: 10px;
  }

  .top-bar .icon-button .ui-icon {
    width: 17px;
    height: 17px;
  }

  .top-bar .icon-button.add-cta {
    min-height: 36px;
    padding: 0.45rem 0.65rem;
    border-radius: 12px;
  }

  .top-bar .icon-button.add-cta .ui-icon {
    width: 16px;
    height: 16px;
  }

  .top-bar .icon-button.add-cta .btn-label {
    font-size: 1rem;
  }

  .right-actions,
  .left-actions {
    gap: 0.35rem;
  }

  .card {
    padding: 0.78rem;
    border-radius: 15px;
  }

  .card-header {
    margin-bottom: 0.35rem;
  }

  .section {
    padding: 0.58rem;
    margin-top: 0.35rem;
  }

  .section-header {
    margin-bottom: 0.22rem;
  }

  .item {
    padding: 0.52rem;
  }

  .meal-card img {
    max-height: 96px;
    border-radius: 12px;
  }

  .meal-card-title {
    margin-bottom: 0.3rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .meal-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}
