:root {
  --navy: #0E2C35; --navy-2: #163C47; --sand: #F3EEE4; --sand-2: #E6E0D3; --paper: #FFFFFF;
  --gold: #C9A26A; --gold-ink: #8C6425; --ink: #0E2C35; --muted: #4A5B61; --line: rgba(14,44,53,.16);
  --danger: #A23B2A; --ok: #2F7D4F; --radius: 10px;
  --serif: 'Instrument Serif', Georgia, serif; --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--sand); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.serif { font-family: var(--serif); font-weight: 400; }
.serif em, h1 em, h2 em { font-style: italic; color: var(--gold-ink); }
.muted { color: var(--muted); }
a { color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--navy); background: transparent; color: var(--navy); font: 700 15px/1 var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, color .15s, opacity .15s; }
.btn:hover { background: rgba(14,44,53,.06); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primary { background: var(--navy); color: var(--sand); }
.btn-primary:hover { background: var(--navy-2); }
.btn-ghost { border-color: var(--line); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-danger { border-color: rgba(162,59,42,.4); color: var(--danger); }
.btn-danger:hover { background: rgba(162,59,42,.08); }
.btn-wide { width: 100%; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--navy); cursor: pointer; font-size: 16px; }
.icon-btn:hover { background: var(--sand-2); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.danger { color: var(--danger); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 50% -10%, #fff 0%, var(--sand) 60%); }
.login-card { width: 100%; max-width: 420px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 36px 28px; box-shadow: 0 40px 80px -50px rgba(14,44,53,.45); display: flex; flex-direction: column; gap: 16px; }
.login-logo { height: 64px; width: auto; align-self: center; }
.login-card h1 { margin: 0; text-align: center; font-size: 44px; line-height: 1; }
.login-card > p { margin: 0 0 6px; text-align: center; }
.back-link { text-align: center; font-size: 14px; color: var(--muted); }

/* fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child, .field-label { font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--navy); }
.hint { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
input, textarea, select { width: 100%; font: 500 16px/1.4 var(--sans); color: var(--ink); background: var(--paper); border: 1.5px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px; }
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(201,162,106,.35); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; font: 700 13px var(--sans); color: var(--muted); cursor: pointer; padding: 8px; }
.error { margin: 0; padding: 10px 12px; border-radius: 8px; background: rgba(162,59,42,.08); color: var(--danger); font-weight: 600; font-size: 14px; white-space: pre-line; }

/* app layout */
.app { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); grid-template-rows: auto 1fr auto; grid-template-areas: "top top" "nav panel" "save save"; }
.topbar { grid-area: top; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; background: var(--navy); color: var(--sand); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--sand); text-decoration: none; min-width: 0; }
.brand img { height: 40px; width: auto; background: var(--sand); border-radius: 8px; padding: 3px 6px; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand small { opacity: .7; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; }
.topbar .btn { color: var(--sand); border-color: rgba(243,238,228,.35); min-height: 40px; }
.topbar .btn:hover { background: rgba(243,238,228,.1); }

.sidenav { grid-area: nav; position: sticky; top: 60px; align-self: start; display: flex; flex-direction: column; gap: 2px; padding: 20px 12px; max-height: calc(100vh - 140px); overflow-y: auto; }
.sidenav button { text-align: left; border: 0; background: transparent; padding: 11px 14px; border-radius: 8px; font: 600 15px var(--sans); color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 10px; }
.sidenav button:hover { background: rgba(14,44,53,.06); }
.sidenav button[aria-current="true"] { background: var(--navy); color: var(--sand); }
.sidenav .nav-ico { width: 20px; text-align: center; opacity: .8; }

.panel { grid-area: panel; padding: 28px 32px 120px; max-width: 980px; width: 100%; outline: none; }
.panel-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.panel-head h2 { margin: 0; font: 400 44px/1.05 var(--serif); }
.panel-head p { margin: 0; color: var(--muted); max-width: 680px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.card h3 { margin: 0; font: 400 28px/1.1 var(--serif); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.note { padding: 12px 14px; border-radius: 8px; background: rgba(201,162,106,.16); font-size: 14px; color: var(--navy); }

/* list items (menu items, reviews, …) */
.item { border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: #FCFAF6; }
.item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.item-title { font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-title small { font-weight: 600; color: var(--muted); }
.add-row { display: flex; gap: 10px; flex-wrap: wrap; }
.opts { border-left: 3px solid var(--sand-2); padding-left: 12px; display: flex; flex-direction: column; gap: 8px; }
.opt-row { display: grid; grid-template-columns: 1fr 90px 90px auto; gap: 8px; align-items: center; }
details.group { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); margin-bottom: 12px; }
details.group > summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary .g-title { font: 400 26px/1.1 var(--serif); }
details.group > summary .g-count { color: var(--muted); font-size: 14px; font-weight: 600; }
details.group > summary::after { content: "＋"; font-size: 18px; color: var(--muted); }
details.group[open] > summary::after { content: "－"; }
details.group > .group-body { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 12px; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--navy); background: transparent; font: 700 14px var(--sans); color: var(--navy); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--navy); color: var(--sand); }

/* photo picker */
.photo { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: start; }
.photo-preview { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--sand-2) center / cover no-repeat; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.photo-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-preview.contain img { object-fit: contain; padding: 10px; }
.photo-preview .busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(243,238,228,.85); font-weight: 700; color: var(--navy); }
.photo-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.photo-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* history */
.history { display: flex; flex-direction: column; gap: 6px; }
.history-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #FCFAF6; }

/* save bar */
.savebar { grid-area: save; position: sticky; bottom: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(6px); }
.save-status { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.save-status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.savebar.dirty .save-status::before { background: var(--gold); }
.savebar.dirty { background: #FFF8EC; }
.save-actions { display: flex; gap: 8px; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60; background: var(--navy); color: var(--sand); padding: 14px 20px; border-radius: 12px; font-weight: 700; box-shadow: 0 20px 40px -20px rgba(0,0,0,.5); max-width: calc(100vw - 32px); }
.toast a { color: var(--gold); }
.toast.bad { background: var(--danger); color: #fff; }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "nav" "panel" "save"; }
  .topbar { padding: 8px 16px; }
  .topbar .btn-ghost[href] { display: none; }
  .brand small { display: none; }
  .sidenav { position: sticky; top: 56px; z-index: 20; flex-direction: row; overflow-x: auto; padding: 8px 16px; max-height: none; background: var(--sand); border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .sidenav::-webkit-scrollbar { display: none; }
  .sidenav button { white-space: nowrap; padding: 9px 14px; }
  .sidenav .nav-ico { display: none; }
  .panel { padding: 20px 16px 140px; }
  .panel-head h2 { font-size: 36px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .photo { grid-template-columns: 1fr; }
  .photo-preview { max-width: 320px; }
  .opt-row { grid-template-columns: 1fr 80px auto; }
  .opt-row .opt-tags { display: none; }
  .savebar { padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; }
  .save-status { font-size: 14px; }
  .save-actions { width: 100%; }
  .save-actions .btn { flex: 1; }
}
.grid-col { display: flex; flex-direction: column; gap: 12px; }
.card-head .row-actions { flex-wrap: wrap; flex-shrink: 1; }

/* page sections list */
.back { align-self: flex-start; border: 0; background: transparent; padding: 6px 0; font: 700 15px var(--sans); color: var(--gold-ink); cursor: pointer; }
.back:hover { text-decoration: underline; }
.steps { margin: 0 0 20px; padding: 16px 20px 16px 40px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 6px; }
.steps em { font-style: normal; font-weight: 700; }
.sec-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.sec-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.sec-row.fixed { background: #FCFAF6; border-style: dashed; }
.sec-row.is-hidden { background: transparent; }
.sec-row.is-hidden .sec-main strong { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.sec-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sec-main strong { font-size: 17px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sec-main .muted { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.pill { display: inline-block; font: 800 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; background: var(--sand-2); color: var(--muted); text-decoration: none; }
.pill-new { background: rgba(201,162,106,.25); color: var(--gold-ink); }
.type-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.type-card { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1.5px dashed rgba(14,44,53,.35); border-radius: var(--radius); background: #FCFAF6; font: 500 14px/1.45 var(--sans); color: var(--muted); cursor: pointer; }
.type-card strong { font-size: 16px; color: var(--navy); }
.type-card:hover { border-color: var(--navy); background: var(--paper); }
.sec-state { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; font-weight: 700; }
.sec-state.off { background: rgba(162,59,42,.08); color: var(--danger); }
details.more { border-top: 1px solid var(--line); padding-top: 10px; }
details.more > summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--navy); }
.more-body { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.tab-add { border-style: dashed; }
.group-foot { justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 12px; }
@media (max-width: 860px) {
  .sec-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .sec-main .muted { white-space: normal; }
  .sec-actions { flex-wrap: wrap; }
  .sec-actions .btn { flex: 1; }
  .type-grid { grid-template-columns: minmax(0, 1fr); }
  .save-actions .btn { padding: 0 10px; }
}

/* a menu PDF on the menus page */
.pdf { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }

/* a tick box with its words (e.g. the Uber Eats button on a menu) */
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink, #0E2C35); flex: none; }
