/* ============================================================
   Sugared Dreams Coffee — Staff Dashboard
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
/* `hidden` must always win — .login sets display:grid, which would otherwise
   override the attribute and leave the login page showing over the dashboard */
[hidden] { display: none !important; }
body { margin: 0; font-family: var(--sd-font-body); color: var(--sd-text); background: var(--sd-night); min-height: 100vh; -webkit-font-smoothing: antialiased; }
.dash-sky { position: fixed; inset: 0; z-index: -1; background: radial-gradient(120% 90% at 50% -10%, #4A1877 0%, #2A0B47 45%, #16052a 100%); }
h1, h2, h3 { font-family: var(--sd-font-display); margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--sd-pink); outline-offset: 2px; border-radius: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font-family: var(--sd-font-body); font-weight: 800; font-size: .95rem; padding: .8rem 1.4rem; border-radius: 999px; border: 0; cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s; }
.btn--primary { background: var(--sd-grad-candy); color: #fff; box-shadow: 0 10px 26px -10px rgba(233,48,138,.6); }
.btn--primary:hover { transform: translateY(-2px); }
.btn--full { width: 100%; }
.btn--sm { padding: .5rem 1rem; font-size: .85rem; }
.btn--ghost { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(249,182,216,.3); }
.btn--ghost:hover { background: rgba(249,182,216,.16); }
.btn--danger { background: rgba(233,48,138,.14); color: #ffd9ec; border: 1px solid rgba(233,48,138,.5); }
.btn--danger:hover { background: rgba(233,48,138,.28); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login__card { width: min(400px, 94vw); background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.04)); border: 1px solid rgba(249,182,216,.22); border-radius: 26px; padding: 2.4rem 2rem; text-align: center; backdrop-filter: blur(12px); box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); }
.login__logo { margin: 0 auto; filter: drop-shadow(0 6px 16px rgba(233,48,138,.5)); }
.login__title { font-size: 2rem; margin: .6rem 0 .2rem; }
.login__sub { color: var(--sd-text-muted); margin: 0 0 1.6rem; font-weight: 700; }
.login__card label { display: block; text-align: left; font-weight: 800; font-size: .82rem; color: var(--sd-pink); margin: .9rem 0 .35rem; }
.login__card input { width: 100%; font-family: var(--sd-font-body); font-size: 1rem; color: #fff; background: rgba(255,255,255,.08); border: 1.5px solid rgba(249,182,216,.3); border-radius: 12px; padding: .8rem .9rem; }
.login__card input:focus { outline: none; border-color: var(--sd-pink); }
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 3rem; }
.pwd-toggle { position: absolute; top: 0; right: 0; height: 100%; width: 2.9rem; display: grid; place-items: center; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; color: rgba(249,182,216,.75); }
.pwd-toggle:hover { color: var(--sd-pink); }
.pwd-toggle svg { width: 22px; height: 22px; fill: currentColor; }
.pwd-toggle .pwd-eye-off { display: none; }
.pwd-toggle.is-on .pwd-eye { display: none; }
.pwd-toggle.is-on .pwd-eye-off { display: block; }
.login__card .btn { margin-top: 1.4rem; }
.login__error { color: #ffb0cf; font-weight: 700; font-size: .9rem; min-height: 1.1em; margin: .8rem 0 0; }
.login__back { display: inline-block; margin-top: 1rem; color: var(--sd-text-muted); font-weight: 700; font-size: .9rem; text-decoration: none; }
.login__back:hover { color: #fff; }

/* ---------- App shell ---------- */
.app__top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 2.5rem); background: linear-gradient(180deg, #1c0838, #160530); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; box-shadow: 0 6px 24px -14px rgba(0,0,0,.8); }
.app__brand { display: flex; align-items: center; gap: .7rem; }
.app__brand strong { font-family: var(--sd-font-display); font-size: 1.15rem; display: block; line-height: 1; }
.app__brand span { color: var(--sd-pink); font-weight: 700; font-size: .8rem; }
.app__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; font-weight: 800; font-size: .85rem; padding: .5rem .95rem; border-radius: 999px; background: rgba(255,255,255,.09); border: 1px solid rgba(249,182,216,.3); color: #fff; cursor: pointer; text-decoration: none; }
.pill:hover { background: rgba(249,182,216,.18); }
.pill--danger { background: rgba(233,48,138,.16); border-color: rgba(233,48,138,.5); }

.app__tabs { display: flex; gap: .4rem; overflow-x: auto; padding: .8rem clamp(1rem, 4vw, 2.5rem) 0; position: sticky; top: 64px; z-index: 15; background: #160530; box-shadow: 0 10px 22px -16px rgba(0,0,0,.9); }
.tab { flex: none; font-family: var(--sd-font-body); font-weight: 800; font-size: .92rem; color: rgba(255,253,249,.75); background: transparent; border: 0; border-bottom: 3px solid transparent; padding: .7rem .9rem; cursor: pointer; white-space: nowrap; }
.tab.is-active { color: #fff; border-bottom-color: var(--sd-pink); }
.tab__badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin-left: .3rem; border-radius: 999px; background: var(--sd-magenta); color: #fff; font-size: .72rem; }

.app__main { max-width: 1080px; margin: 0 auto; padding: clamp(1.2rem, 4vw, 2.2rem); }
.panel { display: none; }
.panel.is-active { display: block; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.panel__head h2 { font-size: 1.6rem; }
.muted { color: var(--sd-text-muted); }
.empty { text-align: center; color: var(--sd-text-muted); padding: 2.5rem; border: 1px dashed rgba(249,182,216,.3); border-radius: 18px; }

/* ---------- Cards / editors ---------- */
.card { background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03)); border: 1px solid rgba(249,182,216,.18); border-radius: 18px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.card--new { border-style: dashed; }
.grp-title { font-family: var(--sd-font-display); font-weight: 900; color: var(--sd-gold-soft); margin: 1.4rem 0 .7rem; font-size: 1.1rem; }

/* ---------- Menu management ---------- */
.menu-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.035)); border: 1px solid rgba(249,182,216,.24); border-radius: 16px; padding: .9rem 1.1rem; margin-bottom: 1rem; }
.menu-toolbar__stat { display: flex; gap: .5rem; flex-wrap: wrap; }
.menu-toolbar__actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; font-weight: 800; font-size: .8rem; padding: .34rem .72rem; border-radius: 999px; white-space: nowrap; }
.badge--live { background: rgba(52,211,153,.16); color: #86efc4; border: 1px solid rgba(52,211,153,.45); }
.badge--draft { background: rgba(255,255,255,.08); color: var(--sd-text-muted); border: 1px solid rgba(249,182,216,.3); }
.grp-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin: 1.5rem 0 .7rem; flex-wrap: wrap; }
.grp-count { font-family: var(--sd-font-body); font-weight: 700; font-size: .78rem; color: var(--sd-text-muted); }
.menu-item.is-draft { border-style: dashed; opacity: .9; }
.item-status { margin-bottom: .7rem; }

.f-row { display: grid; gap: .6rem; margin-bottom: .6rem; }
.f-row--2 { grid-template-columns: 1fr 1fr; }
.f-row--3 { grid-template-columns: 2fr 1fr 1fr; }
/* grid/flex children default to min-width:auto, which lets inputs and
   selects push the layout wider than the screen — clamp them so the
   dashboard never scrolls sideways on mobile */
.f-row > * { min-width: 0; }
input, textarea, select { max-width: 100%; }
label.lab { font-weight: 800; font-size: .78rem; color: var(--sd-pink); margin-bottom: .25rem; display: block; }
input, textarea, select { width: 100%; font-family: var(--sd-font-body); font-size: .95rem; color: #fff; background: rgba(255,255,255,.06); border: 1.5px solid rgba(249,182,216,.24); border-radius: 10px; padding: .6rem .7rem; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--sd-pink); }
/* native calendar popup renders dark (visible picker icon on the dark UI) */
input[type="date"], input[type="time"] { color-scheme: dark; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .85; }
select option { color: #1a0733; }
textarea { resize: vertical; min-height: 60px; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; font-size: .9rem; }
.check input { width: auto; }

.grid2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* gallery admin */
.gphoto { display: grid; grid-template-columns: 92px 1fr; gap: .9rem; align-items: start; }
.gphoto img { width: 92px; height: 92px; object-fit: cover; border-radius: 12px; border: 2px solid var(--sd-purple-royal); }

/* inbox */
.msg { border-left: 4px solid transparent; }
.msg.is-unread { border-left-color: var(--sd-magenta); background: linear-gradient(180deg, rgba(233,48,138,.1), rgba(255,255,255,.03)); }
.msg__meta { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.msg__name { font-weight: 800; }
.msg__date { color: var(--sd-text-muted); font-size: .82rem; }
.msg__body { white-space: pre-wrap; margin: .5rem 0 0; color: rgba(255,253,249,.85); }
.chiprow { display: flex; gap: .5rem; flex-wrap: wrap; }

.sub-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.sub { display: inline-flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.07); border: 1px solid rgba(249,182,216,.24); border-radius: 999px; padding: .4rem .8rem; font-size: .88rem; }
.sub button { background: none; border: 0; color: #ffb0cf; cursor: pointer; font-size: 1rem; padding: 0; }

.upload-drop { border: 1.5px dashed rgba(249,182,216,.4); border-radius: 14px; padding: 1rem; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #fff; color: #1a0733; font-weight: 800; padding: .8rem 1.3rem; border-radius: 999px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.6); opacity: 0; transition: opacity .25s, transform .25s; z-index: 100; }
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-err { background: #4a0f2a; color: #ffd9ec; }

/* ---------- Help "?" icons + bubble ---------- */
.help { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: .35rem; padding: 0; border-radius: 999px; border: 1px solid rgba(249,182,216,.5); background: rgba(249,182,216,.14); color: #ffd9ec; font-size: .72rem; font-weight: 800; font-family: var(--sd-font-body); line-height: 1; cursor: pointer; vertical-align: middle; }
.help:hover { background: var(--sd-magenta); color: #fff; border-color: var(--sd-magenta); }
.help-bubble { position: absolute; z-index: 120; max-width: min(300px, 86vw); background: #2a0b47; color: #fff; border: 1px solid rgba(249,182,216,.4); border-radius: 12px; padding: .7rem .85rem; font-size: .86rem; line-height: 1.45; box-shadow: 0 20px 50px -18px rgba(0,0,0,.85); }

/* ---------- Category viewer (menu, > 5 categories) ---------- */
.cat-viewer { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 1.5rem 0 .3rem; }
.cat-viewer__label { color: var(--sd-text-muted); font-weight: 700; font-size: .85rem; }
.cat-viewer select { width: auto; min-width: 190px; }

/* ---------- Details reference ---------- */
.detail { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid rgba(249,182,216,.14); }
.detail:last-child { border-bottom: 0; }
.detail__k { color: var(--sd-pink); font-weight: 800; font-size: .85rem; }
.detail__v { text-align: right; font-weight: 600; }
.detail__v a { color: #fff; text-decoration: underline; }

/* ---------- Guided tour ---------- */
.tour { position: fixed; inset: 0; z-index: 200; }
.tour__backdrop { position: absolute; inset: 0; background: rgba(8,2,20,.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.tour__card { position: absolute; top: 0; left: 0; width: min(420px, 92vw); background: linear-gradient(180deg, #2a0b47, #1c0838); border: 1px solid rgba(249,182,216,.3); border-radius: 20px; padding: 1.3rem 1.4rem; box-shadow: 0 30px 70px -20px rgba(0,0,0,.85); }
.tour__arrow { position: absolute; top: -8px; left: 24px; width: 16px; height: 16px; background: #2a0b47; border-left: 1px solid rgba(249,182,216,.3); border-top: 1px solid rgba(249,182,216,.3); transform: rotate(45deg); }
.tour__arrow.is-below { top: auto; bottom: -8px; border-left: 0; border-top: 0; border-right: 1px solid rgba(249,182,216,.3); border-bottom: 1px solid rgba(249,182,216,.3); background: #1c0838; }
.tour__step { color: var(--sd-pink); font-weight: 800; font-size: .78rem; }
.tour__title { font-size: 1.4rem; margin: .15rem 0 .5rem; }
.tour__body { color: rgba(255,253,249,.85); margin: 0 0 1.1rem; line-height: 1.5; }
.tour__actions { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.tour__nav { display: flex; gap: .5rem; }
/* during the tour, lift the header + tabs above the dim so the highlighted tab pops */
body.tour-on .app__top, body.tour-on .app__tabs { z-index: 210; }
.tab.tour-glow { color: #fff; border-bottom-color: var(--sd-pink); background: rgba(233,48,138,.16); border-radius: 10px 10px 0 0; box-shadow: 0 8px 22px -8px var(--sd-magenta); animation: tourpulse 1.2s ease; }
@keyframes tourpulse { 0%, 100% { transform: none; } 50% { transform: translateY(-3px); } }

/* ============================================================
   Mobile ( <= 640px ) — stack fields, keep everything on-screen
   ============================================================ */
html, body { max-width: 100%; overflow-x: hidden; }

@media (max-width: 640px) {
  .app__top { padding: .75rem 1rem; }
  .app__brand strong { font-size: 1rem; }
  .app__actions { gap: .4rem; }
  .pill { font-size: .8rem; padding: .45rem .8rem; }

  .app__tabs { top: 60px; padding: .6rem 1rem 0; gap: .2rem; }
  .tab { padding: .6rem .7rem; font-size: .88rem; }

  .app__main { padding: 1rem; }
  .panel__head { margin-bottom: 1rem; }
  .panel__head h2 { font-size: 1.4rem; }

  .card { padding: 1rem; border-radius: 14px; }

  /* stack every multi-column field into one column so nothing clips */
  .f-row--2, .f-row--3 { grid-template-columns: 1fr; }

  /* add/live toolbar: stat on top, the two add buttons share a full row */
  .menu-toolbar { flex-direction: column; align-items: stretch; gap: .7rem; }
  .menu-toolbar__actions { width: 100%; }
  .menu-toolbar__actions .btn { flex: 1; }

  .grp-head { gap: .4rem; }

  /* action rows: let long button groups wrap comfortably */
  .row-actions { gap: .45rem; }
  .row-actions .btn { flex: 1 1 auto; }
  .check { flex: 1 0 100%; }

  /* gallery thumb a touch smaller so the edit fields get room */
  .gphoto { grid-template-columns: 72px 1fr; gap: .7rem; }
  .gphoto img { width: 72px; height: 72px; }

  .cat-viewer select { width: 100%; min-width: 0; }
  .detail { flex-direction: column; gap: .15rem; }
  .detail__v { text-align: left; }
  .tour__card { padding: 1.1rem 1.1rem; }

  /* during the tour on phones, keep the brand + action pills under the
     dimmed, blurred backdrop so only the highlighted tab stands out */
  body.tour-on .app__top { z-index: 20; }
}
