/* En god plan. Designed for an iPad in landscape on a kitchen island:
   large type, large touch targets, calm colours, nothing that looks like an alarm. */

:root {
  --paper: #f5f0e6;
  --card: #fffdf8;
  --ink: #2a2925;
  --soft: #5f5b53; /* dark enough to read on every category colour (5:1 or better) */
  --line: #ddd5c5;
  --today: #fff7df;
  --today-line: #d9b860;
  --done: #2f6b4f;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  /* The fixed palette that categories pick their colour from (decision S3). */
  --bla: #3f6c8f;      --bla-bg: #e4edf3;
  --oker: #a8782a;     --oker-bg: #f5ead3;
  --gronn: #4f7d4a;    --gronn-bg: #e6efe2;
  --plomme: #7a5a8c;   --plomme-bg: #eee6f2;
  --petrol: #2f7f80;   --petrol-bg: #e0efef;
  --rust: #a65f3c;     --rust-bg: #f4e5dc;
  --rosa: #a85a7c;     --rosa-bg: #f5e4ec;
  --gra: #6b7076;      --gra-bg: #e9eaeb;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* Quick repeated taps must not zoom the page. */
html { touch-action: manipulation; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
/* A pressed button darkens a little, so that it is clear the tap registered. */
button:active { filter: brightness(.92); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
.soft { color: var(--soft); }
.empty { color: var(--soft); font-style: italic; }

/* Top bar and navigation */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); background: #efe9dc;
}

#nav { display: flex; gap: 6px; flex-wrap: wrap; }
#nav button {
  min-height: 44px; padding: 8px 14px; border: 1px solid transparent; border-radius: 10px;
  background: none; color: var(--soft); font-size: 1rem;
}
#nav button[aria-current="page"] { background: var(--card); border-color: var(--line); color: var(--ink); font-weight: 600; }

#main { flex: 1; min-height: 0; overflow: auto; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.warning { background: #f4e5dc; border: 1px solid #d9b39c; border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; }

/* Things */
.thing {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line);
  border-radius: 9px; padding: 7px 10px; margin: 5px 0;
}
/* The circle is drawn small where space is tight, but the area that takes the tap is always finger-sized. */
.thing .check::after { content: ""; position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; transform: translate(-50%, -50%); }
.thing .check {
  position: relative;
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #8f8778;
  background: #fff; color: #fff; padding: 0; line-height: 1; font-size: 18px;
}
.thing.done .check { background: var(--done); border-color: var(--done); }
.thing.done .title { color: var(--soft); }
.thing.dropped .title { color: var(--soft); text-decoration: line-through; }
.thing .title {
  flex: 1 1 8em; min-width: 0; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto;
  background: none; border: 0; padding: 4px 0; text-align: left; font-size: inherit;
}
.thing .note { color: var(--soft); font-size: .85em; white-space: nowrap; }
.thing .title small { display: block; color: var(--soft); font-size: .85em; }
span.title { padding: 4px 0; }
.thing { flex-wrap: wrap; }

.thing .time { font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 6px; }
.farge-bla { border-left-color: var(--bla); background: var(--bla-bg); }
.farge-oker { border-left-color: var(--oker); background: var(--oker-bg); }
.farge-gronn { border-left-color: var(--gronn); background: var(--gronn-bg); }
.farge-plomme { border-left-color: var(--plomme); background: var(--plomme-bg); }
.farge-petrol { border-left-color: var(--petrol); background: var(--petrol-bg); }
.farge-rust { border-left-color: var(--rust); background: var(--rust-bg); }
.farge-rosa { border-left-color: var(--rosa); background: var(--rosa-bg); }
.farge-gra { border-left-color: var(--gra); background: var(--gra-bg); }

.blockhead { font: 600 .8rem/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); margin: 10px 0 2px; }
.dinner { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; margin-top: 8px; font-size: inherit; }
.dinner small, .away small { display: block; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.away { background: #ece6d8; border-radius: 8px; padding: 5px 9px; margin: 6px 0; color: #55514a; }
.away button { display: block; width: 100%; background: none; border: 0; padding: 9px 0; text-align: left; font-size: inherit; color: inherit; }

/* I dag */
.today-screen { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, .85fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.today-card { background: var(--today); border: 1px solid var(--today-line); border-radius: 16px; padding: 18px 22px; }
.today-card .eyebrow { font-size: 1.2rem; color: var(--soft); }
.today-card h1 { font-size: 1.75rem; line-height: 1.1; margin-bottom: 8px; white-space: nowrap; }
.today-card .thing { font-size: 1.5rem; padding: 10px 14px; gap: 14px; border-left-width: 9px; }
.today-card .thing .check { width: 40px; height: 40px; font-size: 24px; }
.today-card .thing .grip, .today-card .thing .grip-space { flex: none; width: 28px; margin: 0 -6px 0 -8px; }
.today-card .thing .grip { height: 40px; font-size: 1.2rem; opacity: .55; }
.today-card .blockhead { font-size: .9rem; margin-top: 14px; }
.today-card .dinner { font-size: 1.5rem; padding: 10px 14px; margin: 8px 0 4px; }
.today-card .away { font-size: 1.15rem; }

.coming h2 { font-size: 1.25rem; margin-bottom: 6px; }
.next-days { background: #faf6ec; border: 1px solid var(--line); border-radius: 10px; padding: 2px 12px; }
.next-day {
  display: flex; flex-direction: column; gap: 1px; width: 100%; padding: 8px 0 9px; background: none; border: 0;
  border-top: 1px solid var(--line); text-align: left; font-size: .97rem; line-height: 1.3; color: var(--soft);
}
.next-day:first-child { border-top: 0; }
.next-day b { font: 600 .8rem/1.4 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.next-day .fixed { color: var(--ink); }
.next-day i { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
.next-day .done { text-decoration: line-through; }
.remember .panel .thing .title { padding: 6px 0; }
.remember .thing .note { display: block; white-space: normal; }
.remember .thing .quiet { width: 36px; height: 36px; margin: 0 -4px 0 0; }
.remember .thing .grip { height: 32px; }
.remember .thing .note { font-size: .8em; line-height: 1.2; }

.button { min-height: 44px; padding: 8px 16px; background: #fff; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; white-space: nowrap; }
.button.small { min-height: 44px; min-width: 44px; padding: 6px 12px; font-size: .9rem; }
.button.primary { background: var(--done); border-color: var(--done); color: #fff; font-weight: 600; }
/* The button that carries out something that cannot be undone: dark, not the green of "Lagre". */
.button.final { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.button.icon-only { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; padding: 8px; }
.button.with-icon { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; }
.head-buttons { display: flex; gap: 8px; flex: none; }

.screen-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.screen-head h1 { font-size: 1.8rem; margin-right: auto; }

/* Something just saved: a ring that fades, so it is clear where it landed. */
.arrived { animation: arrived-ring 1.8s ease-out; }
@keyframes arrived-ring { from { outline: 3px solid #d9a521; outline-offset: 2px; } to { outline: 3px solid transparent; outline-offset: 2px; } }

.later-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 6px 8px; border-top: 1px solid var(--line); align-items: start; }
.later-row .thing { margin: 5px 0; padding: 2px 8px; font-size: .97rem; }
.later-row .thing .title { padding: 9px 0; }
.later-row .thing .check { width: 26px; height: 26px; font-size: 15px; }
.later-row .away { margin: 5px 0; }
.field .later-date { display: block; margin-top: 8px; }
.field .later-date[hidden] { display: none; }
.next-line { margin: -4px 0 12px; }

.day-name b { font-family: var(--serif); font-size: 1.15rem; display: block; }
.day-name span { color: var(--soft); font-size: .88rem; }

.panel .thing .title { padding: 9px 0; }

/* Drag and drop */
.drag-floating { opacity: .95 !important; box-shadow: 0 8px 24px #0004; transform: rotate(-1.5deg); pointer-events: none; z-index: 1000; }
.drag-chosen { box-shadow: 0 0 0 3px #e6cf8e; }
[data-drag-kind] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* While something is dragged, the places it can be dropped are outlined, and the one under the finger is filled. */
body[data-dragging="thing"] [data-drop="thing"], body[data-dragging="dinner"] [data-drop="dinner"] { outline: 2px dashed #b79a45; outline-offset: -2px; }
[data-drop].drop-hover { outline-style: solid !important; outline-width: 3px !important; background-color: #f6e7b4 !important; }
.grip { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; color: var(--soft); font-size: 1.3rem; cursor: grab; touch-action: none; }
.rows .row.drag-chosen { background: var(--today); box-shadow: none; }
.thing .grip { width: 30px; height: 40px; margin: 0 -4px 0 -6px; font-size: 1.15rem; }

/* Undo: offered for a few seconds at the bottom of the screen after something is removed */
#undo { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 14px; max-width: min(640px, 92vw);
  background: var(--ink); color: #fff; border-radius: 14px; padding: 8px 8px 8px 18px; box-shadow: 0 8px 28px #0005; font-size: 1.05rem; }
#undo[hidden] { display: none; }
#undo span { flex: 1; min-width: 0; overflow-wrap: break-word; }
#undo .button { color: var(--ink); font-weight: 600; min-width: 96px; }

/* Lists to pull from */
.panel { background: #efe9dc; border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
aside > .panel:first-child { margin-top: 0; }
.panel h3 { font-size: 1.15rem; margin-bottom: 4px; }

.panel p { margin: 6px 0 0; }
.panel .thing { font-size: .97rem; padding: 2px 8px; flex-wrap: nowrap; }
.panel .thing .title { flex: 1 1 0; }

.panel .thing .check { width: 28px; height: 28px; font-size: 16px; }
.quick-add { display: flex; gap: 6px; margin-top: 8px; }
.quick-add input { flex: 1; min-width: 0; font: inherit; padding: 6px 10px; border: 1px solid #c9bfa9; border-radius: 9px; background: #fff; min-height: 44px; }

/* Gjentakende */
.recurring { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.recurring h2 { font-size: 1.35rem; margin-right: auto; }
.recurring p { margin: 0 0 8px; }
table.repeating { border-collapse: collapse; width: 100%; }
table.repeating th { font: 600 .8rem/1.2 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); text-align: left; padding: 4px 6px; }
table.repeating td { border-top: 1px solid var(--line); padding: 4px 6px; vertical-align: middle; }
/* :where keeps this weaker than the category colour classes, so the colour bar shows. */
:where(.link) { border: 0; border-left: 6px solid var(--line); }
.link { border-radius: 4px; padding: 8px 10px; min-height: 40px; text-align: left; font-size: 1rem; }
.link, .link[class*="farge-"] { background: none; }
.meter { height: 7px; width: 96px; background: #e6dfd0; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.meter i { display: block; height: 100%; background: #c9a24d; }
.chips.every { align-items: center; }
.every-word { margin-right: 2px; }
.field input[type=number], .field input[type=date] { font: inherit; padding: 9px 11px; border: 1px solid #c9bfa9; border-radius: 9px; background: #fff; min-height: 44px; }
.field input[type=number] { width: 78px; }

/* Middager */

/* The note about what is being chosen sits in the heading row, so that the days below do not jump when it comes and goes. */

.day-buttons.three { grid-template-columns: repeat(3, 1fr); }
.day-buttons.decided .button { background: var(--today); border-color: var(--today-line); }

/* Handleliste */
.shopping { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.shopping h2 { font-size: 1.35rem; margin-right: auto; }
/* The list stays in view while the long page of common groceries scrolls. */
.shopping > section:first-child { position: sticky; top: 0; max-height: calc(100dvh - 110px); overflow: auto; }
.shopping .screen-head { margin-bottom: 6px; }
.shopping .quick-add { margin: 0 0 8px; }
.shop-item { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 4px 6px 4px 10px; margin: 4px 0; font-size: 1.1rem; }
.shop-item .name { flex: 1; }
/* A quiet control at the end of a row, with no box: a bin (take away) or "×" (drop). */
.quiet { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; background: none; border: 0; border-radius: 10px; color: var(--soft); font-size: 1.6rem; line-height: 1; }
.quiet:active { background: #0001; }
.pic { display: inline-flex; align-items: center; justify-content: center; width: 1.5em; height: 1.5em; font-size: 1.25em; line-height: 1; flex: none; }
.pic img { width: 100%; height: 100%; display: block; }
.pic.placeholder { border-radius: 50%; background: #e9e2d2; color: #8a8375; font: 600 .8em var(--serif); width: 1.9em; height: 1.9em; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.tile { overflow-wrap: anywhere; display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 7px 3px 6px; font-size: .82rem; line-height: 1.15; min-height: 76px; }
/* A picture and a placeholder take up the same height, so the names line up across a row. */
.tile .pic { font-size: 2rem; width: 3rem; height: 3rem; }
.tile .pic.placeholder { font-size: 1.05rem; width: 2rem; height: 2rem; margin: .5rem 0; }
.tile.on { background: #e3efe6; border-color: var(--done); box-shadow: inset 0 0 0 1px var(--done); }
.tile.new { border-style: dashed; color: var(--soft); }
.editing .tile:not(.new) { border-style: dashed; border-color: #b79a45; }
.button.active { background: #e6cf8e; border-color: var(--today-line); }
.chips.pictures { max-height: 250px; overflow: auto; gap: 4px; padding: 4px; }
.chips.pictures .chip span { border-left-width: 1px; padding: 6px 9px; font-size: 1.5rem; min-height: 0; line-height: 1.2; }
.chips.pictures .chip img { width: 1.2em; height: 1.2em; display: block; }
.chips.pictures .chip.no-picture span { font-size: 1rem; padding: 11px 12px; }

/* Innstillinger */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; align-items: start; }
.notice { background: #e3efe6; border: 1px solid #b9d3c2; border-radius: 10px; padding: 10px 14px; margin: 10px 0 0; }
.rows .row { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line); padding: 3px 0; }
.rows .row .name { flex: 1; min-width: 0; background: none; border: 0; padding: 8px 0; text-align: left; font-size: 1rem; min-height: 44px; display: flex; align-items: center; }
.rows .row { gap: 10px; }
.button:disabled { opacity: .35; cursor: default; }
.settings h1 { font-size: 1.8rem; }
.settings section { margin-top: 22px; }
.settings h2 { font-size: 1.25rem; }
.settings p { margin: 6px 0; }
.categories { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
:where(.category) { border: 1px solid var(--line); border-left: 8px solid var(--line); }
.category { min-height: 44px; padding: 8px 16px; border-radius: 10px; font-size: 1rem; }

/* Dialogs */
dialog { border: 0; border-radius: 16px; padding: 20px 22px; width: min(560px, 94vw); max-height: 92vh; background: #fff; color: var(--ink); box-shadow: 0 12px 44px #0005; }
dialog::backdrop { background: #2a292555; }
dialog h2 { font-size: 1.4rem; margin-bottom: 12px; }
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: .82rem; letter-spacing: .07em; text-transform: uppercase; color: var(--soft); margin-bottom: 4px; }
.field small { color: var(--soft); margin-left: 8px; }
.field input[type=text], .field select, .field input[type=time] { font: inherit; padding: 9px 11px; border: 1px solid #c9bfa9; border-radius: 9px; background: #fff; min-height: 44px; }
.field input[type=text], .field select { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: block; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 9px; background: var(--card); }
.chip.farge-bla span { border-left-color: var(--bla); background: var(--bla-bg); }
.chip.farge-oker span { border-left-color: var(--oker); background: var(--oker-bg); }
.chip.farge-gronn span { border-left-color: var(--gronn); background: var(--gronn-bg); }
.chip.farge-plomme span { border-left-color: var(--plomme); background: var(--plomme-bg); }
.chip.farge-petrol span { border-left-color: var(--petrol); background: var(--petrol-bg); }
.chip.farge-rust span { border-left-color: var(--rust); background: var(--rust-bg); }
.chip.farge-rosa span { border-left-color: var(--rosa); background: var(--rosa-bg); }
.chip.farge-gra span { border-left-color: var(--gra); background: var(--gra-bg); }
.chip input:checked + span { box-shadow: 0 0 0 3px var(--ink); font-weight: 600; }
.chip input:focus-visible + span { outline: 3px solid var(--bla); outline-offset: 3px; }
/* The time belongs to appointments, the block to everything else. */
form:has(input[name=kind][value=gjoremal]:checked) .only-avtale { display: none; }
form:has(input[name=kind][value=avtale]:checked) .only-gjoremal { display: none; }
.form-error { background: #f4e5dc; border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; }
.dialog-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.dialog-buttons .spacer { flex: 1; }
.day-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0; }
.day-buttons .button { text-align: left; }

@media (max-width: 900px) {
  .recurring, .shopping, .settings-grid { grid-template-columns: 1fr; }
  .shopping > section:first-child { position: static; max-height: none; }
}
@media (max-width: 760px) {
  
  
  .today-screen { grid-template-columns: 1fr; }
  .today-card h1 { font-size: 2rem; }
  .today-card .thing, .today-card .dinner { font-size: 1.2rem; }
}

/* ---------- One rule for every screen: the plan on the left, what can be done with what is chosen on the right ---------- */

#nav { flex: 1; }
#nav button { min-height: 52px; padding: 10px 20px; font-size: 1.1rem; }
#nav button.aside { margin-left: auto; }

/* Tabs: a row of buttons where one is chosen. Used for the weeks, the kinds of things to add, and the parts of "Oppsett". */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { min-height: 48px; padding: 8px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 1rem; }
.tabs button[aria-current] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.setup-tabs { margin-bottom: 14px; }

/* "Uka" */
.week-screen { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 18px; align-items: start; }
.week-left .screen-head { margin-bottom: 8px; }
.week-left .screen-head .tabs { margin-right: auto; }
.week-row { border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin: 5px 0; cursor: pointer; }
.week-row.is-today { background: var(--today); border-color: var(--today-line); }
.week-row.chosen { box-shadow: 0 0 0 3px var(--ink); }
.week-in { display: grid; grid-template-columns: 84px minmax(0, 1fr) 150px; gap: 10px; align-items: center; padding: 5px 7px 5px 12px; min-height: 76px; border-radius: 12px; }
.week-things { display: flex; flex-wrap: wrap; gap: 5px; align-content: center; }
.week-dinner { align-self: stretch; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; font-size: .95rem; line-height: 1.25; overflow-wrap: anywhere; }
.week-dinner small, .current-dinner small { display: block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.week-dinner.none { color: var(--soft); font-style: italic; border-style: dashed; background: none; }
.week-dinner.none small { font-style: normal; }

/* A thing on a day in "Uka": small, with a handle and its name. */
.bit { display: inline-flex; align-items: center; max-width: 100%; border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 9px; background-color: var(--card); font-size: .95rem; }
.bit .grip { width: 26px; height: 40px; font-size: 1.05rem; }
.bit .title { min-height: 40px; padding: 4px 10px 4px 2px; background: none; border: 0; text-align: left; font-size: inherit; line-height: 1.2; overflow-wrap: anywhere; }
.bit:not(:has(.grip)) .title { padding-left: 10px; }
.bit.done .title { color: var(--soft); }
.bit.dropped .title { color: var(--soft); text-decoration: line-through; }
.bit.chosen, .thing.chosen { box-shadow: 0 0 0 3px var(--ink); }
button.bit.away-bit { min-height: 40px; padding: 4px 10px; border-left-width: 1px; background: #ece6d8; color: #55514a; text-align: left; }
.later-head { font-size: 1.15rem; margin: 16px 0 2px; }
.later-row { grid-template-columns: 110px minmax(0, 1fr); align-items: center; }

/* The right-hand side */
.side { position: sticky; top: 0; max-height: calc(100dvh - 110px); overflow: auto; background: #efe9dc; border-radius: 14px; padding: 14px; }
.side > h2, .side-head h2 { font-size: 1.35rem; }
.side > h2 { margin-bottom: 10px; }
.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.side p { margin: 8px 0; }
.side .tabs { margin-bottom: 10px; }
.side .tabs button { flex: 1; }
.side .quick-add { margin: 0 0 6px; }
.side .quick-add input { min-height: 48px; }
.side .quick-add .button { min-height: 48px; }
.side .blockhead { margin: 12px 0 4px; }
.side-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.side-buttons .spacer { flex: 1; }
.button.big { min-height: 56px; padding: 10px 22px; font-size: 1.1rem; }
.day-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 5px; }
.day-quick .button { min-height: 52px; }
.day-quick .button[aria-current] { background: var(--ink); border-color: var(--ink); color: #fff; opacity: 1; }
.day-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.day-grid .button { min-height: 52px; padding: 4px 2px; font-size: .86rem; white-space: normal; line-height: 1.15; }
.day-grid .button[aria-current] { background: var(--ink); border-color: var(--ink); color: #fff; opacity: 1; }

/* Something to pick at the right: a handle to drag it by, and its name to tap. */
.picks { display: grid; gap: 5px; }
.picks.two { grid-template-columns: 1fr 1fr; }
.picks.three { grid-template-columns: 1fr 1fr 1fr; margin-bottom: 4px; }
.pick { display: flex; align-items: center; gap: 2px; min-height: 46px; border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 10px; background-color: var(--card); padding-right: 4px; }
.pick .grip { width: 30px; height: 40px; }
.pick .button.small { min-height: 40px; }
.pick-main { flex: 1; min-width: 0; align-self: stretch; background: none; border: 0; padding: 5px 6px 5px 0; text-align: left; font-size: 1rem; line-height: 1.2; overflow-wrap: anywhere; }
.pick-main small, .away-pick small { display: block; color: var(--soft); font-size: .8rem; }
.pick.current { box-shadow: inset 0 0 0 2px var(--done); background-color: #e3efe6; }
button.pick.away-pick { display: block; width: 100%; padding: 6px 12px; text-align: left; font-size: 1rem; border-left-width: 1px; }
.current-dinner { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; margin-bottom: 8px; font-size: 1.1rem; }

/* "I dag": the chosen thing's buttons take the place of the lists. */
.today-screen > .side { max-height: none; position: static; }

/* "Handleliste": the list, a rail of groups, and the groceries of one group. */
.shopping { grid-template-columns: 320px 150px minmax(0, 1fr); gap: 14px; }
.rail { display: flex; flex-direction: column; gap: 5px; position: sticky; top: 0; }
.rail button { min-height: 50px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: .95rem; text-align: left; line-height: 1.15; }
.rail button[aria-current] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.rail .edit { margin-top: 10px; background: none; color: var(--soft); }
.rail .edit.active { background: #e6cf8e; border-color: var(--today-line); color: var(--ink); }
.shopping .tiles { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.shopping .tile { min-height: 96px; font-size: .9rem; }

/* Forms: days and months as buttons, and the parts of the form that depend on what is chosen. */
.chips.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.chips.days .chip span { padding: 8px 2px; text-align: center; border-left-width: 1px; font-size: .86rem; min-height: 48px; display: flex; align-items: center; justify-content: center; line-height: 1.15; }
.field .later-date { display: block; margin-top: 8px; }
form:not(:has(input[name=day][value=later]:checked)) .only-day-later, form:not(:has(input[name=from][value=later]:checked)) .only-from-later, form:not(:has(input[name=to][value=later]:checked)) .only-to-later, form:not(:has(input[name=day][value=month]:checked)) .only-month, form:has(input[name=day][value=month]:checked) .not-month, form:not(:has(input[name=repeat][value=ja]:checked)) .only-repeat { display: none; }
.only-repeat { display: inline-flex; align-items: center; gap: 6px; }
dialog { width: min(600px, 94vw); }

.recurring { grid-template-columns: minmax(0, 1fr); max-width: 860px; }

@media (max-width: 900px) {
  .week-screen, .shopping { grid-template-columns: 1fr; }
  .side, .rail { position: static; max-height: none; }
  .rail { flex-direction: row; flex-wrap: wrap; }
}

/* Category colours on the small things and on what can be picked (these come after the rules above, which set a plain background). */
.bit.farge-bla, .pick.farge-bla { border-left-color: var(--bla); background-color: var(--bla-bg); }
.bit.farge-oker, .pick.farge-oker { border-left-color: var(--oker); background-color: var(--oker-bg); }
.bit.farge-gronn, .pick.farge-gronn { border-left-color: var(--gronn); background-color: var(--gronn-bg); }
.bit.farge-plomme, .pick.farge-plomme { border-left-color: var(--plomme); background-color: var(--plomme-bg); }
.bit.farge-petrol, .pick.farge-petrol { border-left-color: var(--petrol); background-color: var(--petrol-bg); }
.bit.farge-rust, .pick.farge-rust { border-left-color: var(--rust); background-color: var(--rust-bg); }
.bit.farge-rosa, .pick.farge-rosa { border-left-color: var(--rosa); background-color: var(--rosa-bg); }
.bit.farge-gra, .pick.farge-gra { border-left-color: var(--gra); background-color: var(--gra-bg); }

/* A form may be taller than the screen. Its buttons stay in sight at the bottom while the form scrolls. */
dialog form .dialog-buttons { position: sticky; bottom: -20px; margin: 0 -22px -20px; padding: 12px 22px 20px; background: #fff; border-top: 1px solid var(--line); }
dialog .field { margin-bottom: 10px; }

/* After the second usability round */
.side .eyebrow { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); }
.side .eyebrow + h2 { margin-bottom: 10px; }
.side .eyebrow + h2::first-letter { text-transform: uppercase; }
.rail .edit { background: var(--card); color: var(--ink); border-style: dashed; }
/* The week scrolls inside its own column if a busy week is taller than the screen, so the page itself never does. */
.week-left { max-height: calc(100dvh - 104px); overflow-y: auto; padding: 3px; margin: -3px; }
/* The shopping list: the heading and the field stay put, and only the items scroll. */
.shopping > section.shop-column { display: flex; flex-direction: column; overflow: visible; }
.shop-list { overflow-y: auto; min-height: 0; padding-right: 2px; }

/* The "Angre" strip sits in the top bar, in the empty stretch between the screens and "Oppsett", where it covers nothing. */
#undo { top: max(8px, env(safe-area-inset-top)); bottom: auto; left: 58.5%; max-width: min(620px, 58vw); padding: 4px 4px 4px 16px; font-size: 1rem; box-shadow: 0 4px 16px #0004; }
#undo .button { min-height: 44px; }
@media (max-width: 900px) { #undo { top: auto; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; max-width: 92vw; } }
/* A long week or panel keeps its width when it starts to scroll. */
.week-left, .side, .shop-list { scrollbar-gutter: stable; }
/* The shopping list: tighter rows, so about ten things fit before it scrolls. */
.shop-item { padding: 1px 2px 1px 10px; margin: 3px 0; }
.shop-item .quiet { width: 44px; height: 42px; }
.shop-list .blockhead { margin: 7px 0 1px; }
.side-more { margin: 0 0 4px; }
.away-add { display: grid; gap: 6px; }
.away-add input[type=text] { font: inherit; padding: 6px 10px; border: 1px solid #c9bfa9; border-radius: 9px; background: #fff; min-height: 48px; }
.away-add .blockhead { margin: 4px 0 0; }
.away-add .button { min-height: 48px; justify-self: start; }
.rows .row .button.small { min-width: 44px; padding: 6px 0; }

/* After the third usability round */
.next-day .meal { color: var(--soft); font-style: italic; }
.shop-item .name { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0; background: none; border: 0; text-align: left; font-size: inherit; }
.chips.other-days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 5px; }
.chips.other-days .chip span { padding: 8px 6px; text-align: center; border-left-width: 1px; font-size: .9rem; min-height: 48px; display: flex; align-items: center; justify-content: center; line-height: 1.15; }
.side-head .eyebrow + h2 { margin-bottom: 8px; }
.remember .thing .button.small { min-height: 36px; min-width: 0; padding: 4px 10px; margin-right: -2px; }
