/* WeKitchen
   Palette comes from the plate: rice, nori, wasabi, pickled ginger.
   The one signature device is the menu-board ledger (name ........ amount). */

@font-face {
  font-family: "Shippori Mincho";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url(fonts/shippori-mincho-latin-600-normal.woff2) format("woff2");
}
@font-face {
  font-family: "Shippori Mincho";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url(fonts/shippori-mincho-latin-700-normal.woff2) format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk";
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  src: url(fonts/hanken-grotesk-latin-wght-normal.woff2) format("woff2");
}

:root {
  --bg: #edf0ea;
  --panel: #fafbf8;
  --field: #ffffff;
  --ink: #14201b;
  --muted: #5a675f;
  --line: #d8ded5;
  --line-strong: #b7c0b4;
  --action: #58770f;
  --action-ink: #ffffff;
  --alert: #a8323f;
  --alert-soft: #f7dcdf;
  --good: #3f6212;
  --good-soft: #e2ebc8;
  --board-bg: #14201b;
  --board-ink: #edf0ea;
  --board-dim: #9fb0a5;
  --board-leader: #41564a;
  --board-good: #bbd66a;
  --board-warn: #f0a3ab;
  --focus: #2b6cb0;
  --serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1512;
    --panel: #151f1a;
    --field: #1b2822;
    --ink: #e6ebe3;
    --muted: #9aa99f;
    --line: #26352d;
    --line-strong: #3a4c42;
    --action: #a9c95a;
    --action-ink: #10190b;
    --alert: #f0929b;
    --alert-soft: #3a1e22;
    --good: #bbd66a;
    --good-soft: #26331a;
    --board-bg: #1c2b24;
    --board-ink: #e6ebe3;
    --board-dim: #93a599;
    --board-leader: #3b5044;
    --focus: #7db2ff;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
}

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; font-family: var(--sans); font-weight: 650; }

p { margin: 0 0 .75rem; max-width: 62ch; }
.muted { color: var(--muted); }
.sr { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.small { font-size: .875rem; }
.right { text-align: right; }

/* ---------- shell: sidebar and status bar ---------- */

.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--bg); padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: 0; }

.shell { display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.side {
  background: var(--board-bg);
  color: var(--board-ink);
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem .75rem;
}
.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.1;
  color: var(--board-ink);
  text-decoration: none;
  padding: .25rem .75rem 1.5rem;
}
.side nav { display: flex; flex-direction: column; gap: .15rem; }
.side nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--board-dim);
  text-decoration: none;
  font-weight: 550;
  padding: .65rem .75rem;
  min-height: 2.75rem;
  border-left: 3px solid transparent;
  border-radius: 0 4px 4px 0;
}
.side nav a:hover { color: var(--board-ink); background: rgba(255, 255, 255, .05); }
.side nav a.on { color: var(--board-ink); background: rgba(255, 255, 255, .08); border-left-color: var(--board-good); }
.side :focus-visible { outline-color: var(--board-good); }
.ico { flex: none; }
.badge {
  margin-left: auto;
  min-width: 1.4rem;
  padding: 0 .4rem;
  border-radius: 999px;
  background: var(--board-warn);
  color: #3a1e22;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.4rem;
  text-align: center;
}
.nav-short { display: none; }

.col { min-width: 0; display: flex; flex-direction: column; }

.statusbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.5rem;
  padding: .6rem 2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line-strong);
}
.clock { display: flex; align-items: baseline; gap: .6rem; }
.clock-time { font-family: var(--serif); font-weight: 700; font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.clock-date { color: var(--muted); font-size: .9375rem; }

.today { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.today-link { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; }
.today-link:hover span:last-child { text-decoration: underline; }
.today-none { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); }
.dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot.on { background: var(--action); box-shadow: 0 0 0 3px var(--good-soft); }
.open-today { margin: 0; }
.btn.small-btn { min-height: 2.25rem; padding: .3rem .85rem; font-size: .9375rem; }

.status-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-left: auto; }
.schip {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: .1rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: .875rem;
  font-weight: 650;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.schip:hover { background: var(--line); }
.schip.warn { background: var(--alert-soft); color: var(--alert); border-color: transparent; }
.schip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.schip.calm { color: var(--muted); }

.acct { position: relative; }
.acct summary {
  list-style: none;
  cursor: pointer;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.acct summary::-webkit-details-marker { display: none; }
.acct summary:hover { background: var(--line); }
.acct-menu {
  position: absolute;
  right: 0;
  top: calc(100% + .4rem);
  min-width: 12rem;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: .35rem;
  box-shadow: 0 6px 18px rgba(10, 18, 14, .18);
  z-index: 30;
}
.acct-menu a, .acct-menu .link-btn { display: block; width: 100%; text-align: left; padding: .6rem .7rem; text-decoration: none; border-radius: 4px; color: var(--ink); min-height: 2.5rem; }
.acct-menu a:hover, .acct-menu .link-btn:hover { background: var(--line); }
.acct-menu form { margin: 0; }

/* ---------- page ---------- */

main { width: 100%; max-width: 72rem; padding: 1.75rem 2rem 3rem; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  margin-bottom: 1.5rem;
}

.head-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------- popout forms ---------- */

dialog.modal {
  width: min(38rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  max-height: calc(100dvh - 1.5rem);
  margin: auto;
  padding: 0;
  overflow: auto;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}
dialog.modal::backdrop { background: rgba(10, 18, 14, .66); }
body:has(dialog.modal[open]) { overflow: hidden; }

/* The title bar borrows the top bar and menu board's nori so the popout reads as part of the same place. */
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.1rem .85rem 1.25rem;
  background: var(--board-bg);
  color: var(--board-ink);
}
.modal-head h2 { font-size: 1.25rem; }
.modal-body { padding: 1.1rem 1.25rem 1.3rem; margin: 0; }
.modal-body .hint { margin: 0 0 1rem; color: var(--muted); font-size: .9375rem; }
.modal-body .flash { max-width: none; }
.modal-body .actions { margin-top: 1.25rem; position: sticky; bottom: 0; background: var(--panel); padding: .75rem 0 .1rem; border-top: 1px solid var(--line); }

.cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 2.25rem; align-items: start; }
.stack > * + * { margin-top: 2rem; }

/* A section is a ruled heading and its content: no boxes, no shadows. */
.section { border-top: 2px solid var(--ink); padding-top: .75rem; }
.section > h2 { margin-bottom: .75rem; }
.section .hint { margin: -.35rem 0 .9rem; color: var(--muted); font-size: .9375rem; }

/* ---------- the ledger ---------- */

.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: flex; align-items: baseline; gap: .5rem; padding: .3rem 0; }
.ledger .lbl { min-width: 0; overflow-wrap: anywhere; }
.ledger .lbl a { text-decoration: none; }
.ledger .lbl a:hover { text-decoration: underline; }
.ledger .dots {
  flex: 1;
  min-width: 1rem;
  border-bottom: 2px dotted var(--line-strong);
  transform: translateY(-.28em);
}
.ledger .amt { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.ledger .dim .lbl, .ledger .dim .amt { color: var(--muted); }
.ledger .good .amt { color: var(--good); font-weight: 650; }
.ledger .bad .amt { color: var(--alert); font-weight: 650; }
.ledger .total { padding-top: .6rem; margin-top: .35rem; border-top: 1px solid var(--line-strong); }
.ledger .total .lbl, .ledger .total .amt { font-family: var(--serif); font-weight: 700; font-size: 1.9rem; line-height: 1.2; }

.board {
  background: var(--board-bg);
  color: var(--board-ink);
  padding: 1.25rem 1.5rem 1.4rem;
  border-radius: 3px;
}
.board h2 { margin-bottom: .25rem; }
.board .hint { color: var(--board-dim); font-size: .9375rem; margin: 0 0 .9rem; }
.board .ledger .dots { border-bottom-color: var(--board-leader); }
.board .ledger .lbl a { color: var(--board-ink); }
.board .ledger .good .amt { color: var(--board-good); }
.board .ledger .bad .amt { color: var(--board-warn); }
.board .ledger .dim .lbl, .board .ledger .dim .amt { color: var(--board-dim); }
.board .ledger .dim a { color: var(--board-dim); }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 -.25rem; padding: 0 .25rem; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th {
  text-align: left;
  font-weight: 650;
  color: var(--muted);
  font-size: .875rem;
  padding: .45rem .6rem .45rem 0;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.tbl td { padding: .65rem .6rem .65rem 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th.num, .tbl td.num { text-align: right; padding-right: .6rem; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl td .sub { display: block; color: var(--muted); font-size: .8125rem; }
.tbl tr.off td { color: var(--muted); }
.tbl tfoot td { font-weight: 650; border-bottom: 0; border-top: 1px solid var(--line-strong); }

.chip {
  display: inline-block;
  padding: .05rem .6rem;
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 650;
  background: var(--line);
  color: var(--ink);
  white-space: nowrap;
}
.chip.low { background: var(--alert-soft); color: var(--alert); }
.chip.ok { background: var(--good-soft); color: var(--good); }

/* ---------- forms ---------- */

form.box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.1rem 1.1rem 1.2rem;
}

label { display: block; font-weight: 600; font-size: .9375rem; margin-bottom: .25rem; }
label .opt { font-weight: 400; color: var(--muted); }

input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  font: inherit;
  font-size: 1rem;
  width: 100%;
  min-height: 2.75rem;
  padding: .55rem .7rem;
  background: var(--field);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}
textarea { min-height: 5rem; resize: vertical; }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: .9rem 1rem; align-items: start; }
.fields > div:has(> .btn:only-child) { align-self: end; }
.fields .wide { grid-column: 1 / -1; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin-top: 1rem; }

.btn {
  font: inherit;
  font-weight: 650;
  min-height: 2.75rem;
  padding: .55rem 1.15rem;
  border: 1px solid var(--action);
  border-radius: 6px;
  background: var(--action);
  color: var(--action-ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--line); filter: none; }
.btn.danger { background: transparent; color: var(--alert); border-color: var(--alert); }
.btn.danger:hover { background: var(--alert-soft); filter: none; }

.link-btn {
  font: inherit;
  background: none;
  border: 0;
  padding: .35rem .25rem;
  color: var(--alert);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn.light { color: var(--board-dim); text-decoration: none; padding: .5rem .25rem; }
.link-btn.light:hover { color: var(--board-ink); text-decoration: underline; }
.link-btn.neutral { color: var(--ink); }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.seg a { padding: .5rem .9rem; text-decoration: none; font-weight: 600; min-height: 2.5rem; display: inline-flex; align-items: center; }
.seg a + a { border-left: 1px solid var(--line-strong); }
.seg a.on { background: var(--ink); color: var(--bg); }

.flash { padding: .7rem 1rem; margin-bottom: 1.25rem; border-left: 4px solid; background: var(--panel); max-width: 40rem; }
.flash.ok { border-color: var(--action); }
.flash.err { border-color: var(--alert); background: var(--alert-soft); color: var(--alert); font-weight: 600; }

/* ---------- to-do ---------- */

.tasks { list-style: none; margin: 0 0 1rem; padding: 0; }
.tasks li { display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid var(--line); }
.tasks li form { margin: 0; display: contents; }
.tasks .tick {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  background: none;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.tasks .tick span {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: grid;
  place-items: center;
  color: var(--action-ink);
  font-size: .9rem;
  line-height: 1;
}
.tasks .done .tick span { background: var(--action); border-color: var(--action); }
.tasks .title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tasks .done .title { color: var(--muted); text-decoration: line-through; }

/* ---------- kitchen day entry ---------- */

.tbl input.qty-in { width: 4.75rem; text-align: right; padding-inline: .5rem; }
.tbl input.price-in { width: 6.5rem; text-align: right; padding-inline: .5rem; }

.empty { border: 1px dashed var(--line-strong); border-radius: 6px; padding: 1.1rem 1.2rem; color: var(--muted); }
.empty p:last-child { margin-bottom: 0; }

/* ---------- login ---------- */

body.auth { min-height: 100vh; display: grid; place-items: center; background: var(--board-bg); padding: 1rem; }
.auth-card { width: min(26rem, 100%); background: var(--bg); border-radius: 4px; padding: 2rem 1.75rem 2.1rem; }
.auth-brand { font-family: var(--serif); font-weight: 700; font-size: 2.4rem; line-height: 1.1; margin: 0 0 1.5rem; }
.auth-card .actions { margin-top: 1.25rem; }
.auth-card .btn { width: 100%; }

/* ---------- small helpers for the supply and planner pages ---------- */

.note { margin: .3rem 0 0; color: var(--muted); font-size: .8125rem; line-height: 1.4; max-width: none; }
ul.note { padding-left: 1.1rem; }
ul.note li { margin: .25rem 0; }
.forms { margin: .6rem 0 0; color: var(--board-dim); font-size: .9375rem; }
.ledger .warn .amt { color: var(--alert); font-weight: 650; }
.board .ledger .warn .amt { color: var(--board-warn); }
.ledger .sub-line { padding-top: 0; padding-bottom: .35rem; font-size: .8125rem; }

details.pack-box { border: 1px solid var(--line-strong); border-radius: 6px; padding: .2rem .9rem .9rem; background: var(--field); }
details.pack-box summary { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; font-weight: 650; padding: .7rem 0 .45rem; min-height: 2.75rem; }
details.pack-box[open] summary { border-bottom: 1px solid var(--line); margin-bottom: .75rem; }
details.pack-box .opt { font-weight: 400; color: var(--muted); }

/* "How you buy it": the bottle or package question, always visible in the supply form */
fieldset.buy-box { border: 1px solid var(--line-strong); border-radius: 6px; padding: .2rem .9rem .9rem; margin: 0; min-width: 0; background: var(--field); }
fieldset.buy-box legend { font-weight: 650; padding: 0 .35rem; }
fieldset.buy-box legend .opt { font-weight: 400; color: var(--muted); }

/* numbered "how it works" list on empty pages */
ol.steps { padding-left: 1.3rem; margin: .5rem 0 1rem; }
ol.steps li { margin: .45rem 0; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .3rem 0; border-bottom: 1px solid var(--line); }

/* ---------- laptop and tablet: the sidebar becomes a tab bar at the bottom ---------- */

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed;
    inset: auto 0 0 0;
    height: auto;
    z-index: 40;
    padding: 0 0 env(safe-area-inset-bottom);
    border-top: 1px solid var(--board-leader);
  }
  .brand { display: none; }
  .side nav { flex-direction: row; gap: 0; }
  .side nav a {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: .15rem;
    padding: .5rem .1rem .45rem;
    min-height: 3.5rem;
    border-left: 0;
    border-top: 3px solid transparent;
    border-radius: 0;
    font-size: .6875rem;
    font-weight: 600;
    text-align: center;
  }
  .side nav a.on { border-top-color: var(--board-good); }
  .nav-long { display: none; }
  .nav-short { display: inline; }
  .badge { position: absolute; top: .2rem; right: calc(50% - 1.6rem); margin: 0; min-width: 1.15rem; line-height: 1.15rem; font-size: .6875rem; }
  main { padding: 1.25rem 1rem calc(5.5rem + env(safe-area-inset-bottom)); }
  .statusbar { position: static; padding: .6rem 1rem; gap: .4rem 1rem; }
  .status-chips { margin-left: 0; order: 5; flex: 1 0 100%; }
  .acct { margin-left: auto; order: 3; }
  .today { order: 4; flex: 1 0 100%; }
  .clock-time { font-size: 1.4rem; }
}

@media (max-width: 760px) {
  .cols { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  h1 { font-size: 1.65rem; }
  .ledger .total .lbl, .ledger .total .amt { font-size: 1.6rem; }
  form.box { padding: .9rem .75rem 1rem; }
  .modal-body { padding: 1rem 1rem 1.2rem; }
  .modal-body .actions .btn { flex: 1 1 8rem; }
  .tbl td { padding-right: .4rem; }
  .tbl input.price-in { width: 5.25rem; }
  .tbl input.qty-in { width: 3.75rem; }
}

@media (max-width: 400px) {
  main { padding-inline: .75rem; }
  .statusbar { padding-inline: .75rem; }
  form.box { padding-inline: .6rem; }
  .tbl input.price-in { width: 4.9rem; }
  .tbl input.qty-in { width: 3.25rem; }
  .tbl td { padding-right: .3rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
