/* Bedwise prototype. One grotesk, colour only on data, near-black primary (taste-skill app rules);
   press feedback, safe areas, 16px inputs, gated hover (Emil Kowalski mobile rules). */
:root {
  --ground: #F1F2EC; --surface: #FFFFFF; --active: #EEEFEA;
  --border: #E2E5DA; --rule: #ECEEE6; --control: #CDD2C4;
  --text: #151913; --muted: #5A6157; --primary: #1A1E19;
  --crop: #CFE6D6; --crop-ink: #1F5C38; --accent: #2F7A4C; --crop-pale: #DCEFE2;
  --soil: #E9E1D3; --timber: #A88D68;
  --neg-bg: #FFEDEA; --neg-ink: #831C1E; --neg-border: #F5C2BB;
  --warn-bg: #FFFBEB; --warn-ink: #92400E; --warn-border: #FDE68A;
  --font: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;
  --r-card: 20px; --r-control: 14px;
}

* { box-sizing: border-box; }
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  background: #DDE1D5;
}
body { margin: 0; font: 14px/20px var(--font); color: var(--text); background: #DDE1D5; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
input { font: inherit; font-size: 16px; color: var(--text); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 18px; }
.tiny { font-size: 12px; line-height: 16px; }

/* Phone-sized column; on desktop it sits centred like a device. */
.device {
  position: relative; max-width: 430px; min-height: 100dvh; margin: 0 auto;
  background: var(--ground); display: flex; flex-direction: column;
}
@media (min-width: 600px) {
  .device { margin: 24px auto; min-height: 844px; height: 844px; border-radius: 40px; overflow: hidden; box-shadow: 0 20px 60px rgba(21, 25, 19, 0.18); }
  #app { overflow-y: auto; }
}
#app { flex: 1; outline: none; overscroll-behavior: contain; }
.screen {
  padding: calc(20px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px;
}
.screen.dark { background: #111410; color: #FFFFFF; min-height: 100%; }
.proto-note { text-align: center; font-size: 12px; color: #4E5549; margin: 8px 16px 24px; }

/* Press feedback on pointer-down; hover only where a real pointer exists. */
.press, .btn, .chip, .tab { touch-action: manipulation; -webkit-user-select: none; user-select: none; cursor: pointer; transition: transform 120ms cubic-bezier(.2, .8, .2, 1), background 160ms ease-out; }
.press:active, .btn:active, .chip:active { transform: scale(.97); }
.tab:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .btn:hover, .chip:hover { filter: brightness(.96); } }
@media (prefers-reduced-motion: reduce) { .press, .btn, .chip, .tab { transition: none; } .press:active, .btn:active, .chip:active, .tab:active { transform: none; } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Type */
.title { font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.01em; }
.h2 { font-size: 16px; line-height: 22px; font-weight: 600; }
.big { font-size: 20px; line-height: 26px; font-weight: 600; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); }
.pad { padding: 14px 16px; }
.rows > * + * { border-top: 1px solid var(--rule); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; min-height: 48px; }
.stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.split > :nth-child(odd) { border-right: 1px solid var(--rule); }
.split > :nth-child(-n + 2) { border-bottom: 1px solid var(--rule); }
.cell { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; }
.notice { padding: 14px 16px; border-radius: var(--r-card); background: var(--warn-bg); border: 1px solid var(--warn-border); display: flex; flex-direction: column; gap: 4px; }
.notice .ink { color: var(--warn-ink); }
.danger { padding: 14px; border-radius: var(--r-card); background: var(--neg-bg); display: flex; flex-direction: column; gap: 8px; }
.danger .ink { color: var(--neg-ink); }
.header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.back { display: flex; align-items: center; gap: 8px; }

/* Controls */
.btn { min-height: 48px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--primary); background: var(--primary); color: #FFFFFF; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--control); }
.btn.small-btn { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.done { background: var(--crop-pale); color: var(--crop-ink); border-color: var(--crop-pale); }
.btn.block { width: 100%; }
.btn.light { background: #FFFFFF; color: #111410; border-color: #FFFFFF; }
.btn.ghost-dark { background: #262B24; color: #B4BAB1; border-color: #262B24; }
.btn.danger-outline { background: var(--surface); color: var(--neg-ink); border-color: #E5A9A3; }
.link { min-height: 44px; display: inline-flex; align-items: center; font-weight: 500; background: none; border: 0; padding: 0 8px; cursor: pointer; }
.icon-btn { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; }
.dark .icon-btn { background: #262B24; border-color: #262B24; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--control); background: var(--surface); font-weight: 600; font-size: 13px; }
.chip[aria-checked="true"], .chip[aria-pressed="true"] { background: var(--primary); color: #FFFFFF; border-color: var(--primary); }
.dark .chip { background: transparent; color: #FFFFFF; border-color: #4A5247; }
.dark .chip[aria-checked="true"], .dark .chip[aria-pressed="true"] { background: #FFFFFF; color: #111410; border-color: #FFFFFF; }
.chip.fill { flex: 1; }
.option { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 0; padding: 10px 12px; min-height: 56px; border-radius: var(--r-control); border: 1px solid var(--control); background: var(--surface); }
.option[aria-checked="true"] { background: var(--primary); color: #FFFFFF; border-color: var(--primary); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--active); color: #3E443C; font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 500; }
.field input { height: 50px; padding: 0 14px; border-radius: var(--r-control); border: 1px solid var(--control); background: var(--surface); }
.switch { flex: none; position: relative; width: 48px; height: 28px; border-radius: 999px; border: 0; padding: 0; background: var(--control); cursor: pointer; transition: background 160ms ease-out; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 999px; background: #FFFFFF; transition: left 160ms ease-out; }
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"]::after { left: 23px; }

/* The bed plan: the one element only this product has. */
.bedplan { display: flex; flex-direction: column; gap: 5px; padding: 8px; background: var(--soil); border: 5px solid var(--timber); border-radius: 12px; }
.bedplan.mini { gap: 3px; padding: 4px; border-width: 3px; border-radius: 8px; flex: none; }
.bedplan .r { flex: 1; min-height: 0; display: flex; align-items: center; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bedplan.mini .r { border-radius: 3px; }
.r.crop { background: var(--crop); color: var(--crop-ink); }
.r.empty { border: 1px dashed #B5A88E; color: #6E654F; }
.r.flag { background: var(--neg-bg); color: var(--neg-ink); border: 1px solid var(--neg-border); }
.r.plan { background: #E3EEE6; color: var(--crop-ink); border: 1px dashed #7FB291; }

/* Jobs */
.job { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.job-top { display: flex; gap: 12px; align-items: flex-start; }
.job-task { font-size: 16px; line-height: 22px; font-weight: 600; }
.job.is-done .job-task { color: var(--muted); text-decoration: line-through; }
.job-actions { display: flex; gap: 6px; align-items: center; }

/* Tab bar */
.tabbar { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border); }
.tabbar[hidden] { display: none; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px; font-size: 11px; line-height: 14px; color: var(--muted); font-weight: 500; }
.tab[aria-current="page"] { color: var(--text); font-weight: 600; }

/* Bottom sheet (the only thing that floats, so the only shadow) */
.scrim { position: fixed; inset: 0; background: rgba(21, 25, 19, 0.42); z-index: 10; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 430px; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; z-index: 11; padding: 10px 16px calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-radius: 28px 28px 0 0; box-shadow: 0 -8px 32px rgba(21, 25, 19, 0.18); display: flex; flex-direction: column; gap: 14px; animation: sheet-in 260ms cubic-bezier(.2, .8, .2, 1); }
.sheet .handle { align-self: center; width: 40px; height: 5px; border-radius: 999px; background: var(--control); }
@keyframes sheet-in { from { transform: translate(-50%, 24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

/* Camera */
.viewfinder { position: relative; height: 340px; border-radius: 24px; overflow: hidden; background: #3D5233; }
.viewfinder img, .viewfinder svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewfinder .hint { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 10px 14px; border-radius: 14px; background: #111410; }
.shutter { width: 72px; height: 72px; border-radius: 999px; border: 4px solid #FFFFFF; background: #FFFFFF; box-shadow: inset 0 0 0 4px #111410; cursor: pointer; display: block; }
.cam-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Timeline */
.timeline { position: relative; height: 150px; }
.timeline .m { position: absolute; top: 0; text-align: center; font-size: 12px; color: var(--muted); }
.timeline .bar { position: absolute; height: 14px; border-radius: 4px; }
.timeline .bar.done { background: var(--accent); }
.timeline .bar.planned { border: 1.5px dashed var(--accent); background: var(--crop-pale); }
.timeline .lbl { position: absolute; font-size: 12px; line-height: 16px; white-space: nowrap; }
.timeline .today { position: absolute; top: 18px; bottom: 0; width: 2px; background: var(--accent); }
.photos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.photos svg { width: 100%; height: auto; border-radius: 12px; display: block; }
