/* ==========================================================================
   moffy mochi — menu manager
   Same palette & type as the public site.
   ========================================================================== */
:root {
  --pink: #FCBFCF;
  --pink-soft: #FDD3DE;
  --berry: #9B010D;
  --berry-ink: #4A0006;
  --cream: #F8F6E9;
  --cream-warm: #F1EBDC;
  --line: rgba(155, 1, 13, .14);
  --f-display: "Nunito", system-ui, sans-serif;
  --f-mono: "DM Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  min-height: 100svh;
  background: var(--pink);
  color: var(--berry);
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--berry); outline-offset: 3px; border-radius: 8px; }
code { font-family: var(--f-mono); font-size: .9em; background: var(--pink-soft); padding: 1px 6px; border-radius: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font-family: var(--f-mono); font-size: 13px; opacity: .8; margin-bottom: 6px; }

.logo { display: block; width: 150px; height: auto; aspect-ratio: 2316 / 1356; color: var(--berry); }
.logo--sm { width: 64px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: 99px;
  border: 2px solid var(--berry); font-weight: 800; white-space: nowrap; text-decoration: none;
  transition: background .3s, color .3s, transform .3s var(--spring), opacity .3s;
}
.btn:active { transform: scale(.97); }
.btn--solid { background: var(--berry); color: var(--cream); }
.btn--solid:hover { background: var(--berry-ink); border-color: var(--berry-ink); }
.btn--ghost:hover { background: var(--berry); color: var(--cream); }
.btn--danger { border-color: #C0262D; color: #C0262D; }
.btn--danger:hover { background: #C0262D; color: #fff; }
.btn--sm { height: 40px; padding: 0 16px; font-size: 14px; }
.btn--wide { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.link-btn { font-family: var(--f-mono); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; justify-self: center; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--pink-soft); transition: background .3s, transform .4s var(--spring);
}
.icon-btn:hover { background: var(--pink); transform: rotate(90deg); }

/* ---------- Boot ---------- */
.boot { min-height: 100svh; display: flex; align-items: center; justify-content: center; gap: 12px; font-family: var(--f-mono); font-size: 14px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--berry); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Auth ---------- */
.auth { min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; }
.card { background: var(--cream); border-radius: 28px; box-shadow: 0 30px 80px -40px rgba(110, 0, 9, .45); }
.auth-card { width: min(100%, 420px); padding: 36px 32px; display: grid; gap: 16px; animation: rise .7s var(--ease); }
.auth-card .logo { margin: 0 auto 8px; width: 120px; }
.auth-card h1 { font-weight: 900; font-size: 34px; line-height: 1; letter-spacing: -.03em; text-align: center; }
.auth-card > p { text-align: center; opacity: .85; }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }

/* ---------- Fields ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-family: var(--f-mono); font-size: 13px; font-weight: 500; }
.field small { font-size: 13px; opacity: .75; }
.field input:not([type="color"]), .field select {
  height: 50px; padding: 0 16px; border-radius: 14px;
  background: #fff; border: 2px solid var(--line); color: var(--berry-ink); font-weight: 700;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--berry); box-shadow: 0 0 0 4px rgba(155, 1, 13, .12); }
.field input::placeholder { color: rgba(74, 0, 6, .35); font-weight: 600; }
.field--color input { width: 64px; height: 50px; padding: 4px; border-radius: 14px; border: 2px solid var(--line); background: #fff; cursor: pointer; }
.field-row { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.form-msg { min-height: 1.4em; font-size: 14px; font-weight: 700; color: #C0262D; }
.form-msg.is-ok { color: #2E7D32; }
.hint { font-size: 13px; opacity: .75; margin-top: 10px; }

/* ---------- Switch ---------- */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-family: var(--f-mono); font-size: 13px; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 44px; height: 26px; border-radius: 99px; background: rgba(155, 1, 13, .2); position: relative; transition: background .3s; flex-shrink: 0; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .4s var(--spring); }
.switch input:checked + .switch__track { background: var(--berry); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--berry); outline-offset: 3px; }
.switch--lg { height: 50px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(252, 191, 207, .85); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.topbar__title { font-family: var(--f-mono); font-size: 13px; padding-left: 14px; border-left: 2px solid var(--line); }
.topbar__right { display: flex; align-items: center; gap: 10px; }
.topbar__user { font-family: var(--f-mono); font-size: 13px; opacity: .8; margin-right: 6px; }

/* ---------- Dashboard ---------- */
.dash { max-width: 1040px; margin: 0 auto; padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 40px) 80px; }
.dash__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.dash__head h1 { font-weight: 900; font-size: clamp(40px, 6vw, 64px); line-height: .95; letter-spacing: -.04em; }
.dash__hint { margin-top: 10px; opacity: .8; max-width: 52ch; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  height: 44px; padding: 0 18px; border-radius: 99px; font-weight: 800;
  border: 2px solid var(--berry); display: inline-flex; align-items: center; gap: 8px;
  transition: background .3s, color .3s;
}
.tab__count { font-family: var(--f-mono); font-size: 12px; font-weight: 500; min-width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center; background: var(--pink-soft); color: var(--berry); padding: 0 6px; }
.tab[aria-selected="true"] { background: var(--berry); color: var(--cream); }

.list { list-style: none; display: grid; gap: 10px; }
.row {
  display: grid; grid-template-columns: 64px 1fr auto auto auto; align-items: center; gap: 16px;
  padding: 10px 14px 10px 10px; border-radius: 20px; background: var(--cream);
  box-shadow: 0 10px 30px -24px rgba(110, 0, 9, .6);
  animation: rise .5s var(--ease) both;
}
.row.is-hidden-item .row__thumb, .row.is-hidden-item .row__info { opacity: .45; }
.row__thumb { width: 64px; height: 80px; border-radius: 14px; object-fit: cover; background: var(--cream-warm); }
.row__info { min-width: 0; display: grid; gap: 2px; }
.row__info strong { font-weight: 900; font-size: 18px; line-height: 1.2; display: flex; align-items: center; gap: 8px; }
.row__info strong i { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.row__info span { font-family: var(--f-mono); font-size: 13px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__order { display: flex; gap: 4px; }
.row__order button { width: 36px; height: 36px; border-radius: 10px; background: var(--pink-soft); font-weight: 900; transition: background .2s; }
.row__order button:hover:not([disabled]) { background: var(--pink); }
.row__order button[disabled] { opacity: .3; cursor: default; }

/* ---------- Menu card panel ---------- */
.menu-panel {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: clamp(20px, 4vw, 44px); align-items: start;
  background: var(--cream); border-radius: 24px; padding: clamp(16px, 3vw, 28px);
  box-shadow: 0 10px 30px -24px rgba(110, 0, 9, .6);
  animation: rise .5s var(--ease) both;
}
.menu-panel__preview { border-radius: 16px; overflow: hidden; background: var(--cream-warm); border: 1px solid var(--line); }
.menu-panel__preview img { display: block; width: 100%; height: auto; }
.menu-panel__side { display: grid; gap: 14px; position: sticky; top: 88px; }
.menu-panel__side h2 { font-weight: 900; font-size: 32px; line-height: 1; letter-spacing: -.03em; }
.menu-panel__status {
  justify-self: start; font-family: var(--f-mono); font-size: 12px;
  padding: 4px 12px; border-radius: 99px; background: var(--pink-soft);
}
.menu-panel__status.is-draft { background: #FFE9A8; color: #6B4E00; }
.menu-panel__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.menu-panel__actions label.btn { cursor: pointer; }
.menu-panel .link-btn { justify-self: start; }

.empty { text-align: center; padding: 56px 20px; border: 2px dashed var(--line); border-radius: 24px; display: grid; gap: 16px; justify-items: center; }

/* ---------- Editor ---------- */
.editor {
  width: min(94vw, 860px); max-height: 92svh; margin: auto; padding: 0; border: 0;
  border-radius: 28px; background: var(--cream); color: var(--berry);
  box-shadow: 0 40px 120px -20px rgba(74, 0, 6, .55);
}
.editor::backdrop { background: rgba(74, 0, 6, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.editor[open] { animation: pop .5s var(--spring); }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(20px); } }
.editor form { display: flex; flex-direction: column; max-height: 92svh; }
.editor__head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.editor__head h2 { font-weight: 900; font-size: 26px; letter-spacing: -.02em; }
.editor__body { display: grid; grid-template-columns: 260px 1fr; gap: 28px; padding: 24px; overflow: auto; }
.fields { display: grid; gap: 16px; align-content: start; }
.editor__foot { display: flex; align-items: center; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }
.spacer { flex: 1; }

.photo__drop {
  position: relative; display: grid; place-items: center; aspect-ratio: 4 / 5; border-radius: 22px; overflow: hidden;
  border: 2px dashed rgba(155, 1, 13, .35); background: var(--pink-soft); cursor: pointer; text-align: center;
  transition: border-color .2s, background .2s;
}
.photo__drop:hover, .photo__drop.is-over { border-color: var(--berry); background: var(--pink); }
.photo__drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo__drop:has(img:not([hidden]))::after {
  content: "change photo"; position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: var(--berry); color: var(--cream); font-size: 13px; font-weight: 800; padding: 6px 14px; border-radius: 99px;
}
.photo__empty { display: grid; gap: 4px; padding: 20px; }
.photo__empty strong { font-weight: 900; font-size: 20px; }
.photo__empty span { font-family: var(--f-mono); font-size: 12px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  transform: translate(-50%, 140%); opacity: 0;
  background: var(--berry); color: var(--cream); font-weight: 800;
  padding: 12px 22px; border-radius: 99px; box-shadow: 0 16px 40px -12px rgba(74, 0, 6, .5);
  transition: transform .5s var(--spring), opacity .3s;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.toast.is-error { background: #C0262D; color: #fff; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .topbar__user, .topbar__title { display: none; }
  .row { grid-template-columns: 56px 1fr auto; grid-template-areas: "thumb info info" "thumb switch actions"; row-gap: 8px; }
  .row__thumb { grid-area: thumb; width: 56px; height: 72px; }
  .row__info { grid-area: info; }
  .row .switch { grid-area: switch; }
  .row__actions { grid-area: actions; display: flex; gap: 6px; }
  .editor__body { grid-template-columns: 1fr; }
  .menu-panel { grid-template-columns: 1fr; }
  .menu-panel__side { position: static; order: -1; }
  .photo__drop { aspect-ratio: 16 / 11; }
  #add-btn { width: 100%; }
}
@media (min-width: 721px) { .row__actions { display: contents; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
