/* Kin and Kitchen palette: near black joinery, cool ivory, granite sage, dovetail, tobacco, warm brass */
:root {
  --bg: #17181A; --panel: #212225; --panel2: #2A2B2F; --line: #3A3B40;
  --ivory: #F2EFE8; --muted: #A39E94; --sage: #8A9A82; --brass: #C39B5F; --tobacco: #7A5539;
  --warn: #D9A441; --bad: #D9705F; --ok: #8FB38A;
  --r: 14px; --nav: 64px;
  font-family: "Avenir Next", "Segoe UI", Roboto, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ivory); -webkit-tap-highlight-color: transparent; }
body { min-height: 100dvh; font-size: 16px; line-height: 1.45; }
h1, h2, h3 { font-family: Georgia, "Iowan Old Style", serif; font-weight: 500; margin: 0; letter-spacing: .01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--brass); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 1px; }
input[type=checkbox] { width: 1.3rem; height: 1.3rem; accent-color: var(--brass); flex: none; }
textarea { min-height: 4.5rem; resize: vertical; }
label { display: block; font-size: .8rem; color: var(--muted); margin: .7rem 0 .25rem; }
.btn {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: .6rem 1rem;
  cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
}
.btn.primary { background: var(--brass); border-color: var(--brass); color: #1b1408; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: .6rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.right { margin-left: auto; }

/* shell */
.shell { padding-bottom: calc(var(--nav) + env(safe-area-inset-bottom)); }
.page { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.page > header { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
nav.main {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: #111214; border-top: 1px solid var(--line);
  display: flex; z-index: 20;
}
nav.main a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); font-size: .72rem; gap: 2px; }
nav.main a .ico { font-size: 1.35rem; filter: grayscale(.6); }
nav.main a.on { color: var(--brass); } nav.main a.on .ico { filter: none; }
@media (min-width: 900px) {
  .shell { padding-bottom: 0; padding-left: 84px; }
  nav.main { top: 0; bottom: 0; right: auto; width: 84px; height: auto; flex-direction: column;
    border-top: 0; border-right: 1px solid var(--line); justify-content: center; gap: .6rem; }
  nav.main a { flex: none; padding: .8rem 0; }
}
.whochip { position: fixed; top: .6rem; right: .6rem; z-index: 30; background: var(--panel2);
  border: 1px solid var(--brass); border-radius: 999px; padding: .3rem .5rem .3rem .8rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; }
.card + .card { margin-top: .8rem; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; scrollbar-width: none; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: .35rem .8rem; white-space: nowrap;
  background: transparent; cursor: pointer; font-size: .9rem; color: var(--muted); }
.chip.on { background: var(--sage); border-color: var(--sage); color: #10140f; font-weight: 600; }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 1.1rem; flex: none; background: var(--sage); }
.avatar.big { width: 4.2rem; height: 4.2rem; font-size: 2.2rem; }
.tag { font-size: .72rem; border-radius: 6px; padding: .1rem .4rem; background: var(--panel2); color: var(--muted); }
.dot { width: .7rem; height: .7rem; border-radius: 50%; flex: none; background: var(--ok); }
.dot.low, .dot.check { background: var(--warn); } .dot.short { background: var(--bad); }
.list > .li { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.list > .li:last-child { border-bottom: 0; }
.aisle { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brass); margin: 1.1rem 0 .2rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.seg button { background: transparent; border: 0; padding: .45rem .55rem; cursor: pointer; font-size: .85rem; color: var(--muted); min-height: 40px; }
.seg button.on.good { background: var(--ok); color: #0e150d; }
.seg button.on.medium { background: #C9CF8A; color: #15170a; }
.seg button.on.low { background: var(--warn); color: #1a1303; }
.seg button.on.out { background: var(--bad); color: #1c0906; }
.seg button.on { background: var(--sage); color: #10140f; font-weight: 600; }
.qty { width: 5.2rem; text-align: right; padding: .45rem .5rem; }
.unit { width: 5.6rem; padding: .45rem .4rem; }

/* recipes */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; }
.rcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  cursor: pointer; display: flex; flex-direction: column; color: inherit; }
.rcard .ph { aspect-ratio: 4/3; background: linear-gradient(135deg, var(--tobacco), #3c2a1d); display: grid;
  place-items: center; font-family: Georgia, serif; font-size: 2.4rem; color: #e9d8c2; background-size: cover; background-position: center; }
.rcard .b { padding: .6rem .7rem .7rem; }
.rcard .t { font-family: Georgia, serif; font-size: 1.02rem; line-height: 1.2; }
.hero { width: 100%; max-height: 340px; object-fit: cover; border-radius: var(--r); margin-bottom: 1rem; }
.stepper { display: inline-flex; align-items: center; gap: .3rem; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); font-size: 1.3rem; cursor: pointer; }
.stepper b { min-width: 2.6rem; text-align: center; font-size: 1.3rem; }
.step { display: grid; grid-template-columns: 2.4rem 1fr; gap: .8rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step .n { width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 1px solid var(--brass); color: var(--brass);
  display: grid; place-items: center; font-family: Georgia, serif; }
.step p { margin: 0 0 .5rem; font-size: 1.08rem; white-space: pre-wrap; }
.step ul { margin: 0 0 .5rem; padding-left: 1.1rem; color: var(--sage); }
.photos { display: flex; gap: .5rem; flex-wrap: wrap; }
.photos img { width: 120px; height: 90px; object-fit: cover; border-radius: 10px; cursor: zoom-in; }
.photos .rm { position: relative; } .photos .rm button { position: absolute; top: 2px; right: 2px; border-radius: 50%; border: 0; width: 26px; height: 26px; background: #000a; cursor: pointer; }
.cols { display: grid; gap: 1rem; } .cols > .card { margin-top: 0; }
@media (min-width: 900px) { .cols { grid-template-columns: 360px 1fr; align-items: start; } }
.edrow { display: grid; grid-template-columns: 4.6rem 5.2rem 1fr 2.4rem; gap: .35rem; margin-bottom: .4rem; align-items: center; }
.edrow .sub { grid-column: 1 / -1; display: flex; gap: .5rem; align-items: center; margin-bottom: .3rem; }
.edrow input, .edrow select { padding: .5rem .45rem; }
.x { background: transparent; border: 0; color: var(--muted); font-size: 1.2rem; cursor: pointer; min-width: 36px; min-height: 36px; }

/* modal + toast */
.veil { position: fixed; inset: 0; background: #000a; z-index: 50; display: grid; place-items: end center; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 18px 18px 0 0; width: 100%; max-width: 560px;
  max-height: 90dvh; overflow: auto; padding: 1.2rem; padding-bottom: calc(1.2rem + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .veil { place-items: center; } .modal { border-radius: 18px; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav) + 1rem); background: var(--ivory);
  color: #17181A; padding: .7rem 1.1rem; border-radius: 12px; z-index: 99; max-width: 90vw; box-shadow: 0 6px 24px #0008; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .8rem; margin: 1rem 0; }
.people button { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem .4rem;
  display: flex; flex-direction: column; align-items: center; gap: .4rem; cursor: pointer; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; max-width: 300px; margin: 1rem auto 0; }
.pinpad button { height: 62px; font-size: 1.5rem; border-radius: 14px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; }
.pindots { text-align: center; font-size: 2rem; letter-spacing: .5rem; min-height: 2.6rem; color: var(--brass); }
.center { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.center .card { width: 100%; max-width: 400px; }

/* home display */
.home { display: grid; gap: 1rem; }
@media (min-width: 900px) { .home { grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.3fr) minmax(300px, 1.2fr); align-items: start; } }
.clock { font-family: Georgia, serif; font-size: clamp(3.2rem, 9vw, 5.5rem); line-height: 1; }
.date { color: var(--brass); letter-spacing: .14em; text-transform: uppercase; font-size: .9rem; margin-top: .4rem; }
.wx { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.wx .w { background: var(--panel2); border-radius: 12px; padding: .8rem; }
.wx .i { font-size: 2.4rem; line-height: 1.1; }
.wx .t { font-size: 1.5rem; font-family: Georgia, serif; }
.ev { display: grid; grid-template-columns: 5.4rem 1fr; gap: .6rem; padding: .5rem 0 .5rem .7rem; border-left: 3px solid var(--sage); margin-bottom: .5rem; }
.ev .tm { color: var(--muted); font-size: .88rem; }
.note { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem 0; }
.sticky { border-radius: 4px 4px 14px 4px; padding: .8rem .9rem; color: #1e1b14; position: relative; white-space: pre-wrap;
  font-size: 1.05rem; box-shadow: 0 3px 10px #0006; }
.sticky.ivory { background: #EFE7D2; } .sticky.sage { background: #B9C7B0; } .sticky.brass { background: #E2C48C; } .sticky.rose { background: #E5B8AC; }
.sticky footer { font-size: .75rem; opacity: .7; margin-top: .5rem; display: flex; gap: .4rem; align-items: center; }
.sticky footer button { background: transparent; border: 0; cursor: pointer; color: inherit; font-size: 1rem; min-width: 32px; min-height: 32px; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }

.facecam { width: 220px; height: 220px; border-radius: 50%; object-fit: cover; border: 3px solid var(--brass); background: #000; transform: scaleX(-1); }

/* cook mode */
.cook { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; padding: 1rem; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
.cookbody { flex: 1; overflow: auto; padding: 1rem 0; max-width: 900px; width: 100%; margin: 0 auto; }
.cooktext { font-size: clamp(1.5rem, 4.2vw, 2.4rem); line-height: 1.35; font-family: Georgia, serif; margin: 0 0 1rem; white-space: pre-wrap; }
.cooking { font-size: 1.3rem; color: var(--sage); padding-left: 1.3rem; }
.cooktimers { padding: .6rem 0; border-top: 1px solid var(--line); }
.btn.big { min-height: 64px; font-size: 1.2rem; padding: .8rem 1.4rem; }
.plan { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.meal { margin-top: .5rem; font-size: 1.05rem; }
.scancam { width: 100%; max-width: 420px; aspect-ratio: 4/3; object-fit: cover; border-radius: 14px; border: 2px solid var(--brass); background: #000; }
