/* Gujarati Thal — admin panel. Phone-first: everything works one-handed on a mobile. */
:root {
  --ink: #14110d; --ink-2: #1e1a14; --gold: #d6a23e; --gold-2: #f0c867;
  --bg: #f6f2ea; --card: #fff; --line: #e8dfcf; --text: #2b241b; --muted: #776b58;
  --ok: #1f8a4c; --ok-bg: #e5f5ea; --err: #b3261e; --err-bg: #fde8e6; --warn: #9a6200; --warn-bg: #fff3d6;
  --wa: #1fa855; --radius: 14px;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--sans); color: var(--text); background: var(--bg); }
a { color: #8a5a00; }
img { max-width: 100%; }
h1, h2 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.08rem; margin-bottom: 12px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .88rem; margin: 0 0 16px; }
.warn { color: var(--warn); font-size: .82rem; font-weight: 600; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #e9dec8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; text-decoration: none; color: var(--gold-2); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .78rem; }
.side__brand img { width: 74px; height: auto; }
.side__nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; flex: 1; }
.side__nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #e9dec8; text-decoration: none; font-weight: 500; }
.side__nav a:hover { background: rgba(240,200,103,.08); }
.side__nav a[aria-current] { background: rgba(240,200,103,.16); color: var(--gold-2); }
.side__nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.pill { margin-left: auto; background: var(--gold); color: var(--ink); border-radius: 999px; font-size: .74rem; padding: 1px 8px; }
.side__foot { padding: 14px 20px 20px; border-top: 1px solid rgba(214,162,62,.2); display: grid; gap: 6px; font-size: .86rem; }
.side__foot a { color: var(--gold-2); text-decoration: none; }
.side__foot span { color: #a89c86; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgba(246,242,234,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 1.3rem; flex: 1; }
.topbar__site { font-size: .88rem; font-weight: 600; text-decoration: none; }
.topbar__menu { display: none; background: none; border: 0; width: 40px; height: 40px; padding: 9px 8px; cursor: pointer; }
.topbar__menu span { display: block; height: 2px; background: var(--ink); margin: 5px 0; border-radius: 2px; }
.content { padding: 22px 28px 60px; max-width: 1240px; width: 100%; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 9px 16px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--text); font: 600 .92rem var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--gold); }
.btn--primary { background: var(--ink); border-color: var(--ink); color: var(--gold-2); }
.btn--primary:hover { background: #2a241b; }
.btn--danger { color: var(--err); border-color: #f0c4bf; }
.btn--danger:hover { background: var(--err-bg); border-color: var(--err); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn--small { min-height: 34px; padding: 5px 11px; font-size: .84rem; }
.btn--block { width: 100%; }

/* ---------- Cards, grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card__head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + .grid2 { margin-top: 18px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; background: var(--ok-bg); color: var(--ok); }
.flash--error { background: var(--err-bg); color: var(--err); }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 4px; }
.stat strong { font-size: 1.7rem; line-height: 1; }
.stat span { font-size: .84rem; color: var(--muted); }
.stat--alert { border-color: var(--gold); background: #fffaf0; }
.stat--alert strong { color: #8a5a00; }
.stat--warn { border-color: #f0c98a; background: var(--warn-bg); }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 8px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bars__col span { width: 100%; max-width: 26px; min-height: 2px; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-radius: 4px 4px 0 0; }
.bars__col em { font-style: normal; font-size: .68rem; color: var(--muted); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid #f1eadd; vertical-align: top; }
.table tr.is-new td { background: #fffaf0; }
.table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.badge { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #eee6d6; color: var(--text); vertical-align: middle; }
.badge--new { background: var(--gold); color: var(--ink); }
.badge--contacted { background: #e6eefb; color: #2456a6; }
.badge--confirmed { background: #e9e4fb; color: #5b3cc4; }
.badge--active { background: var(--ok-bg); color: var(--ok); }
.badge--completed { background: #ececec; color: #555; }
.badge--cancelled { background: var(--err-bg); color: var(--err); }
.inline-status select { min-height: 36px; padding: 4px 8px; font-size: .86rem; }
.details { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; margin: 16px 0; }
.details dt { color: var(--muted); font-size: .86rem; }
.details dd { margin: 0; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.danger-zone { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

/* ---------- Filters ---------- */
.filterbar { display: grid; gap: 12px; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips a { display: inline-flex; gap: 6px; align-items: center; padding: 7px 13px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; font-size: .86rem; }
.chips a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--gold-2); }
.chips b { font-weight: 500; opacity: .7; }
.filterbar__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filterbar__row input[type=search] { flex: 1 1 220px; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.form label, .settings label, label.field-inline { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .86rem; min-width: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  font: inherit; font-size: 16px; font-weight: 400; color: var(--text); background: #fff;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; min-height: 44px; width: 100%;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214,162,62,.2); }
input[readonly] { background: #faf7f1; }
label.check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; font-size: .92rem !important; cursor: pointer; }
label.check input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.row-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
label.narrow { width: 96px; flex: none; }
.form-msg { margin: 0; font-weight: 600; color: var(--muted); min-height: 1.2em; }
details > summary { cursor: pointer; list-style: none; padding: 2px 0; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--gold); }
details[open] > summary::before { content: "▾ "; }
details[open] > summary { margin-bottom: 14px; }
.add-card summary strong { font-size: 1rem; }
.sticky-save { position: sticky; bottom: 0; z-index: 5; padding: 12px 0; background: linear-gradient(180deg, rgba(246,242,234,0), var(--bg) 35%); }
.sticky-save .btn { min-width: 220px; box-shadow: 0 8px 20px -10px rgba(0,0,0,.5); }
.settings__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.settings .card { margin-bottom: 18px; }

/* ---------- Upload ---------- */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 30px 16px; border: 2px dashed #d9c9a8; border-radius: var(--radius); background: #fffcf6; cursor: pointer; margin: 12px 0; transition: background .2s, border-color .2s; }
.dropzone:hover, .dropzone.is-over { background: #fff5df; border-color: var(--gold); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone strong { font-size: 1.05rem; }
.dropzone span { color: var(--muted); font-size: .86rem; }
.dropzone--small { padding: 16px; }
label.field-inline select { max-width: 320px; }
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.queue__item { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: .88rem; }
.queue__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue__size { color: var(--muted); }
.queue progress { grid-column: 1 / -1; width: 100%; height: 8px; accent-color: var(--gold); }
.queue__msg { grid-column: 1 / -1; color: var(--muted); }
.queue__item.is-done { border-color: #bfe3cc; background: #f6fcf8; }
.queue__item.is-done .queue__msg { color: var(--ok); font-weight: 600; }
.queue__item.is-error { border-color: #f0c4bf; background: #fff8f7; }
.queue__item.is-error .queue__msg { color: var(--err); font-weight: 600; }

/* ---------- Library ---------- */
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.lib-item { position: relative; display: block; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #f4efe5; cursor: pointer; text-align: left; font: inherit; color: inherit; aspect-ratio: 1; }
.lib-item:hover { border-color: var(--gold); box-shadow: 0 6px 16px -8px rgba(0,0,0,.35); }
.lib-item img, .lib-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-item.is-hidden img, .lib-item.is-hidden video { opacity: .4; filter: grayscale(1); }
.lib-item__icon { display: grid; place-items: center; height: 100%; font-weight: 700; color: var(--muted); background: linear-gradient(135deg, #f6e9d0, #f3dbe7); }
.lib-item__type { position: absolute; top: 6px; left: 6px; background: rgba(20,17,13,.78); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.lib-item__type--instagram { background: #c13584; }
.lib-item__type--youtube { background: #cc0000; }
.lib-item__star { position: absolute; top: 4px; right: 8px; color: var(--gold-2); font-size: 1.2rem; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.lib-item__cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.75)); color: #fff; font-size: .78rem; font-weight: 600; line-height: 1.25; }
.lib-item__cap small { display: block; font-weight: 400; opacity: .8; }
.library--picker { max-height: 55vh; overflow-y: auto; margin: 12px 0; }

/* ---------- Dialogs ---------- */
.modal { border: 0; padding: 0; border-radius: 16px; width: min(560px, calc(100% - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.modal--wide { width: min(900px, calc(100% - 24px)); }
.modal::backdrop { background: rgba(12,10,7,.6); }
.modal__box { padding: 20px; }
.modal__preview { background: #111; border-radius: 10px; overflow: hidden; display: grid; place-items: center; min-height: 80px; color: #ddd; font-size: .86rem; word-break: break-all; }
.modal__preview img, .modal__preview video { width: 100%; max-height: 300px; object-fit: contain; display: block; }
.modal__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; opacity: 0; transition: all .25s; z-index: 100; pointer-events: none; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Banners, menu, tiffin ---------- */
.picker-field { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.picker-field label { flex: 1 1 260px; }
.picker-field + .row3 { margin-top: 2px; }
.picker-preview { width: 160px; height: 100px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
input[data-picker] + .btn { margin-top: 6px; align-self: flex-start; }
.banner-list { display: grid; gap: 14px; }
.banner-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.banner-row img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
.banner-row__fields { display: grid; gap: 10px; }
.banner-row.is-off { opacity: .55; }

.menu-admin { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.cat-list { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; max-height: calc(100vh - 100px); overflow-y: auto; }
.cat-list a { display: flex; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 500; font-size: .92rem; }
.cat-list a:hover { background: #faf5ea; }
.cat-list a[aria-current] { background: var(--ink); color: var(--gold-2); }
.cat-list a.is-off { opacity: .5; }
.cat-list b { font-weight: 500; opacity: .6; }
.cat-add { display: flex; gap: 6px; padding: 8px 2px 2px; border-top: 1px solid var(--line); margin-top: 6px; }
.cat-add input { min-height: 36px; padding: 6px 10px; font-size: .9rem; }

.dishes { display: grid; gap: 10px; }
.dish { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.dish.is-off { background: #faf7f1; }
.dish.is-off .dish__fields > .dish__row:first-child { opacity: .55; }
.dish__img { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dish__img img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; }
.dish__img .btn { margin: 0; align-self: stretch; }
.dish__fields { display: grid; gap: 10px; min-width: 0; }
.dish__fields label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .8rem; color: var(--muted); min-width: 0; }
.dish__row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.dish__row .grow { flex: 1 1 200px; }
.dish__row label.narrow { width: 84px; }
.price-input input { font-weight: 700; }
.dish__row--opts { gap: 16px; }
.dish__row--opts label.check { color: var(--text); }
.plan-edit { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 14px; display: grid; gap: 12px; }
.plan-edit.is-off { opacity: .55; }
.plan-edit label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .86rem; }
.card > label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .86rem; margin-top: 12px; }
.card > .row3 { margin-top: 4px; }

/* ---------- Login / setup ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 600px at 30% 40%, #2a241b, var(--ink) 70%); }
.auth__card { width: min(560px, 100%); background: #fff; border-radius: 24px; padding: 56px 56px 48px; box-shadow: 0 40px 90px -30px rgba(0,0,0,.85); }
.auth__badge { width: 150px; height: 150px; margin: 0 auto 34px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; box-shadow: 0 0 0 4px rgba(214,162,62,.35); }
.auth__badge img { width: 116px; height: auto; }
.auth__card h1 { font-size: 1.9rem; text-align: center; margin-bottom: 10px; }
.auth__sub { text-align: center; color: var(--muted); font-size: 1.1rem; margin: 0 0 34px; }
.auth__card .muted { text-align: center; }
.auth__form { display: grid; gap: 24px; }
.auth__form label { display: flex; flex-direction: column; gap: 10px; font-weight: 700; font-size: 1.12rem; }
.auth__form .req { color: var(--err); }
.auth__form input { min-height: 58px !important; border-radius: 14px !important; font-size: 1.05rem !important; }
.auth__btn { margin-top: 6px; min-height: 60px; border: 0; border-radius: 14px; background: var(--ink); color: #fff; font: 600 1.15rem var(--sans); cursor: pointer; }
.auth__btn:hover { background: #2a241b; }
@media (max-width: 520px) { .auth__card { padding: 36px 22px 30px; } .auth__badge { width: 124px; height: 124px; margin-bottom: 26px; } .auth__badge img { width: 96px; } }
.topbar__logo { display: none; }
.topbar__logo img { display: block; height: 36px; width: auto; background: var(--ink); border-radius: 8px; padding: 4px 8px; box-sizing: content-box; }
@media (max-width: 900px) { .topbar__logo { display: block; } }

/* ---------- Phones ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(280px, 82%); transform: translateX(-105%); visibility: hidden; transition: transform .25s, visibility .25s; }
  .side.is-open { transform: none; visibility: visible; box-shadow: 20px 0 50px rgba(0,0,0,.35); }
  .topbar { padding: 10px 14px; }
  .topbar__menu { display: block; }
  .topbar h1 { font-size: 1.12rem; }
  .content { padding: 16px 14px 60px; }
  .grid2, .row3, .settings__grid, .menu-admin { grid-template-columns: minmax(0, 1fr); }
  .row2 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .cat-list { position: static; flex-direction: row; overflow-x: auto; max-height: none; padding: 6px; }
  .cat-list a { flex: none; }
  .cat-add { border-top: 0; margin: 0; padding: 0 0 0 6px; flex: none; }
  .cat-add input { width: 150px; }
  .banner-row { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .details { grid-template-columns: 1fr; gap: 0 0; }
  .details dd { margin-bottom: 8px; }
  .table--stack thead { display: none; }
  .table--stack tr { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; }
  .table--stack td { display: flex; gap: 10px; justify-content: space-between; border: 0; padding: 5px 0; }
  .table--stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .8rem; flex: none; }
  .table--stack tr.is-new td { background: none; }
  .table--stack tr.is-new { border-color: var(--gold); background: #fffaf0; }
  .library { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .dish { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
  .dish__img img { width: 64px; height: 64px; }
  .sticky-save .btn { width: 100%; }
}
