/* BABY Staff — the menu editor. Three columns: categories, the list, and (when an item is
   open) its details. Boxes in the list look like plain text until you point at them. */
body.menu-page { overflow: hidden; }
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr) auto; height: calc(100vh - 56px); }

/* ---- search and "Saved" in the top bar ---- */
.search { display: flex; align-items: center; gap: 8px; max-width: 520px; height: 36px; padding: 0 12px; border-radius: 10px;
  background: #262021; border: 1px solid var(--bar-line); color: var(--bar-muted); }
.search:focus-within { border-color: var(--pink); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--bar-ink); }
.search input::placeholder { color: var(--bar-muted); }
.savestate { color: var(--bar-muted); font-size: 13px; white-space: nowrap; min-width: 150px; text-align: right; }

/* ---- categories ---- */
.side { overflow: auto; padding: 14px 10px 30px; border-right: 1px solid var(--line); background: var(--panel); }
.side .cat { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 6px 10px; border-radius: 8px; color: var(--ink); }
.side .cat span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.side .cat:hover { background: var(--hover); }
.side .cat.on { background: var(--soft); color: var(--accent); font-weight: 700; }
.side .cat.on span { color: var(--accent); }
.side .cat.all { font-weight: 700; margin-bottom: 6px; }
.mgroup { margin-top: 14px; }
.mgroup h3 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 2px; padding: 0 4px 0 10px;
  font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.mgroup h3 button { width: 24px; height: 24px; border-radius: 6px; color: var(--muted); font-size: 14px; }
.mgroup h3 button:hover { background: var(--hover); color: var(--accent); }
.addcat input { width: 100%; margin: 4px 0; padding: 6px 9px; border-radius: 8px; border: 1px solid var(--accent); background: var(--field); outline: 0; }

/* ---- the list ---- */
.main { overflow: auto; container-type: inline-size; }
.mainhead { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 22px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }
.mainhead .title { flex: 1; min-width: 200px; }
.mainhead h1 { margin: 0; font-size: 21px; line-height: 1.25; }
.mainhead p { margin: 0; color: var(--muted); font-size: 13px; }
.ctitle { width: 100%; font-size: 21px; font-weight: 700; padding: 1px 6px; margin-left: -7px; border: 1px solid transparent; border-radius: 8px; background: none; }
.ctitle:hover { border-color: var(--line); }
.ctitle:focus { border-color: var(--accent); background: var(--field); outline: 0; }
.textbtn { color: var(--bad); text-decoration: underline; font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 600; }
.chip b { font-weight: 700; color: var(--ink); }
.chip.on { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.chip.on b { color: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); font-weight: 700; font-size: 14px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.btn.primary:disabled { opacity: .4; cursor: default; }
.btn.ghost { background: none; color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-bg); }

.rows { padding: 0 12px 60px; }
.row { display: grid; grid-template-columns: 22px 64px minmax(170px, 1.1fr) minmax(200px, 2fr) 164px 56px 28px; gap: 12px; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid var(--line); border-radius: 0; position: relative; }
.row.head { position: static; padding: 10px 10px 6px; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; align-items: end; }
.row.head .r { text-align: right; padding-right: 8px; }
.row.head .c { text-align: center; }
.row.head span { white-space: nowrap; }
.row.head small { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 11px; white-space: normal; }
.row:not(.head):hover { background: var(--hover); }
.row.sel { background: var(--soft); }
.row.off .names input, .row.off textarea, .row.off .thumb { opacity: .5; }
.row.dragging { opacity: .4; }
.row.dropb::before, .row.dropa::after { content: ""; position: absolute; left: 0; right: 0; height: 3px; background: var(--accent); border-radius: 2px; }
.row.dropb::before { top: -2px; } .row.dropa::after { bottom: -2px; }
.row.dropa.dropb { outline: 2px dashed var(--accent); outline-offset: -2px; }       /* a picture file is over this row */
.row.dropa.dropb::before, .row.dropa.dropb::after { display: none; }
.grip { color: var(--muted); cursor: grab; text-align: center; opacity: 0; user-select: none; }
.row:hover .grip { opacity: 1; }
.thumb { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--hover); border: 1px solid var(--line); display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb span { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 10px; line-height: 1.25; text-align: center; }
.row input, .row textarea { width: 100%; padding: 4px 7px; border: 1px solid transparent; border-radius: 7px; background: none; outline: 0; resize: none; }
.row textarea { color: var(--muted); font-size: 14px; line-height: 1.4; field-sizing: content; min-height: 2.9em; overflow: hidden; }
.row input:hover, .row textarea:hover { border-color: var(--line); background: var(--field); }
.row input:focus, .row textarea:focus { border-color: var(--accent); background: var(--field); color: var(--ink); }
.names input:first-child { font-weight: 700; }
.names input + input { font-size: 14px; color: var(--muted); }
.names input::placeholder, .row textarea::placeholder { color: var(--muted); opacity: .55; }
.price { text-align: right; }
.price label { display: flex; align-items: center; justify-content: flex-end; gap: 2px; color: var(--muted); }
.price input { width: 92px; text-align: right; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.price small { display: block; color: var(--muted); font-size: 11px; padding-right: 8px; white-space: nowrap; min-height: 16px; }
.sizes { display: block; width: 100%; text-align: right; padding: 4px 7px; border-radius: 7px; border: 1px solid transparent; font-size: 13px; color: var(--muted); }
.sizes:hover { border-color: var(--line); background: var(--field); }
.sizes span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sizes b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sw { width: 40px; height: 24px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; justify-self: center; }
.sw i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.sw.on { background: var(--ok); }
.sw.on i { transform: translateX(16px); }
.more { width: 28px; height: 36px; border-radius: 8px; color: var(--muted); font-size: 20px; }
.more:hover { background: var(--line); color: var(--ink); }
.blank { padding: 60px 20px; text-align: center; color: var(--muted); }
/* a narrow list (small window, or the details panel is open): the description moves to the panel */
@container (max-width: 820px) {
  .row { grid-template-columns: 22px 56px minmax(150px, 1fr) 164px 56px 28px; }
  .row > textarea, .row.head > span:nth-child(4) { display: none; }
  .thumb { width: 56px; height: 56px; }
}

/* ---- details of one item ---- */
.drawer { width: 430px; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
.drawer.over { outline: 3px dashed var(--accent); outline-offset: -6px; }
.drawer header { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.drawer h2 { flex: 1; min-width: 0; margin: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer .x { width: 32px; height: 32px; border-radius: 8px; color: var(--muted); }
.drawer .x:hover { background: var(--hover); color: var(--ink); }
.dbody { overflow: auto; padding: 16px 18px 28px; display: flex; flex-direction: column; gap: 16px; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; display: block; background: var(--hover); }
.nophoto { aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 2px dashed var(--line); border-radius: 14px; color: var(--muted); font-weight: 600; }
.nophoto small { font-weight: 400; }
.pacts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.f { display: block; }
.f > span, .f > summary { display: block; font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.f small { color: var(--muted); font-weight: 400; }
.f input:not([type=checkbox]), .f textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--field); outline: 0; resize: vertical; }
.f textarea { field-sizing: content; min-height: 4.4em; line-height: 1.45; }
.f input:focus, .f textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.money { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; }
.money input { max-width: 150px; text-align: right; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.hint span { opacity: .8; }
.vars { display: flex; flex-direction: column; gap: 6px; }
.vars:not(:empty) { margin-bottom: 8px; }
.var { display: grid; grid-template-columns: 1fr 150px 30px; gap: 8px; align-items: center; }
.var .money input { max-width: none; }
.var > button { height: 30px; border-radius: 8px; color: var(--muted); }
.var > button:hover { background: var(--bad-bg); color: var(--bad); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { padding: 6px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--field); font-weight: 600; font-size: 13px; }
.seg button:hover { border-color: var(--accent); }
.seg button.on { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
details.f > summary { cursor: pointer; margin-bottom: 0; }
details.f[open] > summary { margin-bottom: 10px; }
details.f > .f + .f { margin-top: 12px; }
.where { display: flex; flex-direction: column; gap: 10px; }
.where > div { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 14px; }
.where b { flex-basis: 100%; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.where label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.hist { font-size: 13px; color: var(--muted); }
.hist p { margin: 0 0 8px; overflow-wrap: anywhere; }
.hist b { color: var(--ink); }
.foot { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* ---- the line at the bottom ---- */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 14px;
  max-width: min(720px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 12px; background: #221a1c; color: #f6eef0; box-shadow: var(--shadow); font-size: 14px; }
.toast.bad { background: #5a1f1a; }
.toast button { color: #facbd1; font-weight: 700; white-space: nowrap; padding: 2px 4px; }

/* ---- a small window ---- */
@media (max-width: 1100px) {
  .shell { grid-template-columns: 210px minmax(0, 1fr) auto; }
  .drawer { position: fixed; top: 56px; right: 0; bottom: 0; width: min(430px, 100vw); box-shadow: var(--shadow); z-index: 20; }
  .savestate { display: none; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .topbar nav, .topbar .who b { display: none; }
}
