/* ===========================================================================
   Nana Tam — staff admin. Denser and plainer than the public site: this is a
   tool used on a phone behind the bar during service.
   ======================================================================== */

:root {
  --a-bg: #f4f5f3;
  --a-surface: #fff;
  --a-line: #e0e2dd;
  --a-ink: #1f2420;
  --a-muted: #6c7570;
  --a-green: #1c3b28;
  --a-green-dark: #12261b;
  --a-amber: #c8622f;
  --a-amber-soft: #fdf0e6;
  --a-danger: #a5301f;
  --a-ok: #2f6b46;
  --a-radius: 10px;
  --a-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body.adm {
  margin: 0;
  background: var(--a-bg);
  color: var(--a-ink);
  font: 15px/1.55 system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Thai', sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1 { font-size: 1.5rem; margin: 0 0 .2rem; }
h2 { font-size: 1.02rem; margin: 0 0 .8rem; }
p { margin: 0 0 .8rem; }
a { color: var(--a-amber); }
:focus-visible { outline: 2.5px solid var(--a-amber); outline-offset: 2px; border-radius: 4px; }

.adm-muted { color: var(--a-muted); }
.adm-small { font-size: .82rem; font-weight: 400; }
.adm-mono { font-family: var(--a-mono); font-size: .9em; }
.adm-nowrap { white-space: nowrap; }
.adm-capitalise { text-transform: capitalize; }
.adm-truncate { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-inline { display: inline-block; margin: 0; }
.adm-link { font-size: .88rem; }
.adm-code { font-family: var(--a-mono); font-size: .78rem; word-break: break-all; background: var(--a-bg); padding: .6rem; border-radius: 8px; }
.adm-key { font-family: var(--a-mono); font-size: .78rem; color: var(--a-muted); }

/* --- Chrome ------------------------------------------------------------- */

.adm-header { background: var(--a-green-dark); color: #eef1ec; position: sticky; top: 0; z-index: 30; }
.adm-header__inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem;
  width: min(100% - 2rem, 78rem); margin-inline: auto; padding: .7rem 0;
}
.adm-brand { color: inherit; text-decoration: none; display: flex; align-items: baseline; gap: .45rem; }
.adm-brand__name { font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-size: .95rem; }
.adm-brand__sub { font-size: .72rem; color: #8ea795; text-transform: uppercase; letter-spacing: .1em; }

.adm-nav { display: flex; flex-wrap: wrap; gap: .15rem; margin-right: auto; }
.adm-nav a {
  color: #cfd8d0; text-decoration: none; font-size: .88rem;
  padding: .35rem .7rem; border-radius: 999px;
}
.adm-nav a:hover { background: rgb(255 255 255 / 10%); color: #fff; }
.adm-nav a.is-active { background: var(--a-amber); color: #fff; }

.adm-user { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.adm-user__name { color: #cfd8d0; }

.adm-main { padding: 1.5rem 0 4rem; }
.adm-shell { width: min(100% - 2rem, 78rem); margin-inline: auto; }
.adm-shell--narrow { max-width: 52rem; }

.adm-page-head {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between;
  margin-bottom: 1.2rem;
}
.adm-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.adm-actions--sticky {
  position: sticky; bottom: 0; background: var(--a-bg);
  padding: .8rem 0; border-top: 1px solid var(--a-line); margin-top: 1rem;
}

/* --- Buttons ------------------------------------------------------------ */

.adm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: 8px; border: 1px solid transparent;
  background: var(--a-amber); color: #fff; font: inherit; font-size: .88rem; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.adm-btn:hover { filter: brightness(1.05); color: #fff; }
.adm-btn--quiet { background: var(--a-surface); color: var(--a-ink); border-color: var(--a-line); }
.adm-btn--quiet:hover { background: #fff; border-color: var(--a-muted); color: var(--a-ink); }
.adm-btn--danger { background: var(--a-danger); }
/* Deleting a booking is the one thing in here with no undo, so it sits below a
   rule rather than beside the buttons that only move it between statuses. */
.adm-danger { margin: 1rem 0 0; padding: .9rem 0 0; border-top: 1px solid var(--a-line); }
/* One action per booking row, sized so the column stays narrow on a phone. */
.adm-rowactions { white-space: nowrap; text-align: right; }
.adm-rowactions form { display: inline; }
.adm-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.adm-btn--sm { padding: .34rem .7rem; font-size: .82rem; }
.adm-btn--full { width: 100%; }
.adm-btn--icon { background: var(--a-surface); color: var(--a-ink); border-color: var(--a-line); padding: .3rem .55rem; font-size: .95rem; }
.adm-btn[disabled] { opacity: .5; cursor: default; }
.adm-linkbtn { background: none; border: 0; padding: 0; color: var(--a-amber); font: inherit; font-size: .82rem; cursor: pointer; text-decoration: underline; }

/* --- Cards, banners ----------------------------------------------------- */

.adm-card {
  background: var(--a-surface); border: 1px solid var(--a-line);
  border-radius: var(--a-radius); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem;
}
.adm-card__head { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; margin-bottom: .7rem; }
.adm-card__head h2 { margin: 0; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.adm-card--warning { border-color: #e7cfa5; background: #fffaf1; }

.adm-banner { padding: .7rem .9rem; border-radius: 8px; font-size: .9rem; margin-bottom: 1rem; }
.adm-banner--ok { background: #e5f1e8; color: var(--a-ok); }
.adm-banner--error { background: #fbe9e6; color: var(--a-danger); }
.adm-banner--warning { background: #fdf3e0; color: #8a5b12; }

.adm-help { font-size: .85rem; color: var(--a-muted); background: var(--a-bg); padding: .7rem .85rem; border-radius: 8px; }

.adm-grid-2 { display: grid; gap: 1.1rem; }
@media (min-width: 60rem) { .adm-grid-2 { grid-template-columns: 1fr 1fr; align-items: start; } }

/* --- Stats -------------------------------------------------------------- */

.adm-stats {
  list-style: none; margin: 0 0 1.2rem; padding: 0;
  display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
}
.adm-stats li {
  background: var(--a-surface); border: 1px solid var(--a-line); border-radius: var(--a-radius);
  padding: .8rem .9rem; display: grid; gap: .1rem;
}
.adm-stats li.is-warning { border-color: #e7cfa5; background: #fffaf1; }
.adm-stats__n { font-size: 1.7rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.adm-stats li span:last-child { font-size: .78rem; color: var(--a-muted); text-transform: uppercase; letter-spacing: .05em; }

/* --- Tables & lists ----------------------------------------------------- */

.adm-table-wrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.adm-table th, .adm-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--a-line); vertical-align: top; }
.adm-table th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--a-muted); }
.adm-table tr.is-dim { opacity: .5; }
.adm-table--form td { padding: .3rem .4rem; }
.adm-table--form input[type="time"] { width: 8rem; }
.adm-checkcell { display: flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--a-muted); }

.adm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; font-size: .9rem; }
.adm-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; padding-bottom: .5rem; border-bottom: 1px solid var(--a-line); }
.adm-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.adm-list--compact li { border: 0; padding: 0; }

.adm-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; font-size: .84rem; }
.adm-timeline li { padding-left: .8rem; border-left: 2px solid var(--a-line); }

.adm-pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; font-size: .85rem; }

.adm-pill {
  display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: .15rem .45rem; border-radius: 5px;
  background: var(--a-bg); color: var(--a-muted);
}
.adm-pill--pending { background: #fdf0d8; color: #8a5b12; }
.adm-pill--confirmed { background: #e2efe3; color: var(--a-ok); }
.adm-pill--seated { background: #e5eefb; color: #26548c; }
.adm-pill--completed { background: var(--a-bg); color: var(--a-muted); }
.adm-pill--cancelled { background: #fbe9e6; color: var(--a-danger); }
.adm-pill--no_show { background: #f1e6f6; color: #6b3c85; }
.adm-pill--closed { background: #f2e2de; color: var(--a-danger); }
.adm-pill--gold { background: #f6e2c2; color: #7a4a12; }

.adm-loadbars { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; font-size: .85rem; }
.adm-loadbars li { display: grid; grid-template-columns: 4.5rem 1fr 3rem auto; gap: .6rem; align-items: center; }
.adm-loadbars__time { font-family: var(--a-mono); font-size: .82rem; }
.adm-loadbars__track { background: var(--a-bg); border-radius: 999px; height: .65rem; overflow: hidden; }
.adm-loadbars__fill { display: block; height: 100%; background: linear-gradient(90deg, var(--a-green), var(--a-amber)); border-radius: 999px; }
.adm-loadbars__n { font-variant-numeric: tabular-nums; color: var(--a-muted); text-align: right; }

/* --- Day view slots ----------------------------------------------------- */

.adm-slots {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
}
.adm-slot { background: var(--a-bg); border-radius: var(--a-radius); padding: .35rem; }
.adm-slot form { margin: 0; }
.adm-slot__btn {
  width: 100%; display: grid; gap: .1rem; justify-items: center;
  padding: .55rem .3rem; border: 1px solid var(--a-line); border-radius: 8px;
  background: var(--a-surface); color: var(--a-ink); font: inherit; cursor: pointer;
}
.adm-slot__btn:hover { border-color: var(--a-amber); }
.adm-slot__time { font-family: var(--a-mono); font-weight: 700; font-size: 1rem; }
.adm-slot__meta { font-size: .74rem; color: var(--a-muted); }
.adm-slot.is-closed .adm-slot__btn { background: #f7e6e2; border-color: #e2bdb4; color: var(--a-danger); }
.adm-slot.is-closed .adm-slot__time { text-decoration: line-through; }
.adm-slot.is-closed .adm-slot__meta { color: var(--a-danger); font-weight: 600; }
.adm-slot__bookings { list-style: none; margin: .35rem 0 .1rem; padding: 0 .2rem; font-size: .78rem; display: grid; gap: .12rem; }

/* --- Forms -------------------------------------------------------------- */

.adm-field { display: grid; gap: .25rem; margin: 0 0 .9rem; }
.adm-field label { font-size: .8rem; font-weight: 600; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.adm-field__hint { font-size: .76rem; color: var(--a-muted); }
.adm-error { font-size: .78rem; color: var(--a-danger); font-weight: 600; }
.adm-field-row { display: grid; gap: .8rem; }
@media (min-width: 40rem) {
  .adm-field-row { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); align-items: start; }
  .adm-field--narrow { max-width: 8rem; }
  .adm-field--wide { grid-column: span 2; }
}
.adm-field--check label { font-weight: 400; font-size: .88rem; align-items: flex-start; }
.adm-field--action { align-self: end; flex-direction: row; }
.adm-field--action { display: flex; gap: .5rem; }

.adm input[type="text"], .adm input[type="email"], .adm input[type="tel"],
.adm input[type="date"], .adm input[type="time"], .adm input[type="number"],
.adm input[type="password"], .adm input[type="search"], .adm select, .adm textarea {
  width: 100%; padding: .48rem .6rem; font: inherit; font-size: .9rem;
  border: 1px solid var(--a-line); border-radius: 7px; background: #fff; color: var(--a-ink);
}
.adm textarea { resize: vertical; min-height: 3.2rem; }
.adm input:focus, .adm select:focus, .adm textarea:focus { border-color: var(--a-amber); }

.adm-filters {
  display: grid; gap: .7rem; margin-bottom: 1.1rem;
  background: var(--a-surface); border: 1px solid var(--a-line);
  border-radius: var(--a-radius); padding: .9rem 1rem;
}
@media (min-width: 52rem) { .adm-filters { grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; } }
.adm-filters .adm-field { margin: 0; }

.adm-addrow { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .8rem 0 0; }
.adm-addrow input { flex: 1 1 8rem; width: auto; }

.adm-checks { border: 1px solid var(--a-line); border-radius: 8px; padding: .6rem .8rem; margin: 0 0 .9rem; display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; }
.adm-checks legend { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--a-muted); padding: 0 .3rem; }
.adm-checks label { font-size: .85rem; display: flex; align-items: center; gap: .35rem; }

.adm-status-grid { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.adm-status-grid form { margin: 0; }

/* --- Menu editor -------------------------------------------------------- */

.adm-details { margin-bottom: .8rem; }
.adm-details > summary,
.adm-dish > details > summary,
.adm-texts summary {
  cursor: pointer; padding: .45rem 0; font-size: .88rem; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
}
.adm-texts summary h2 { margin: 0; }

.adm-dishes { list-style: none; margin: .3rem 0 0; padding: 0; }
.adm-dish { border-top: 1px solid var(--a-line); }
.adm-dish.is-hidden { opacity: .55; }
.adm-dish__name { font-weight: 600; }
.adm-dish__meta { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--a-muted); font-variant-numeric: tabular-nums; }
.adm-dish__form { padding: .5rem 0 1rem; }

.adm-translations { display: grid; gap: .5rem; }
@media (min-width: 52rem) { .adm-translations { grid-template-columns: 1fr 1fr; } }
.adm-lang-chip {
  font-size: .68rem; font-weight: 700; letter-spacing: .05em;
  background: var(--a-green); color: #fff; padding: .08rem .35rem; border-radius: 4px;
}

.adm-langbar { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1rem; }
.adm-langbar a {
  padding: .35rem .8rem; border-radius: 999px; font-size: .85rem; text-decoration: none;
  background: var(--a-surface); border: 1px solid var(--a-line); color: var(--a-ink);
}
.adm-langbar a.is-active { background: var(--a-green); border-color: var(--a-green); color: #fff; }

/* --- Auth --------------------------------------------------------------- */

.adm--auth { display: grid; place-items: center; min-height: 100dvh; background: var(--a-green-dark); }
.adm-auth__card {
  background: var(--a-surface); border-radius: 16px; padding: 2rem;
  width: min(100% - 2rem, 24rem); box-shadow: 0 20px 50px rgb(0 0 0 / 25%);
}
.adm-auth__brand { text-transform: uppercase; letter-spacing: .12em; font-size: .74rem; color: var(--a-muted); margin-bottom: .3rem; }
.adm-auth__back { margin: 1.2rem 0 0; font-size: .82rem; text-align: center; }

/* Disclosure affordance: a <summary> that looks like a plain row gives no hint
   that it opens, which is the difference between "where do I edit a price?" and
   an obvious click target. */
.adm-details > summary,
.adm-dish > details > summary,
.adm-texts summary { position: relative; padding-left: 1.15rem; }

.adm-details > summary::before,
.adm-dish > details > summary::before,
.adm-texts summary::before {
  content: '▸';
  position: absolute; left: 0; color: var(--a-amber);
  transition: transform .12s ease;
}
.adm-details[open] > summary::before,
.adm-dish > details[open] > summary::before,
.adm-texts details[open] summary::before { transform: rotate(90deg); }

.adm-details > summary::-webkit-details-marker,
.adm-dish > details > summary::-webkit-details-marker,
.adm-texts summary::-webkit-details-marker { display: none; }

.adm-details > summary,
.adm-dish > details > summary,
.adm-texts summary { list-style: none; }

/* --- Photos --------------------------------------------------------------- */

.adm-section-title { margin: 2rem 0 .6rem; font-size: 1.05rem; }
.adm-section-title:first-of-type { margin-top: 1rem; }

.adm-photos { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }
.adm-photo { display: flex; flex-direction: column; gap: .8rem; }
.adm-photo__frame {
  position: relative; border-radius: 8px; overflow: hidden;
  background: var(--a-bg); border: 1px solid var(--a-line);
  aspect-ratio: 4 / 3; display: grid; place-items: center;
}
.adm-photo__frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.adm-photo__empty { margin: 0; color: var(--a-muted); font-size: .85rem; }
/* The preview covers the current photo, so "before" and "after" sit in the
   same place instead of the card growing a second image. */
.adm-photo__preview { position: absolute; inset: 0; }
.adm-photo__body { display: flex; flex-direction: column; gap: .35rem; }
.adm-photo__body h3 { margin: 0; font-size: .98rem; }
.adm-photo__meta { margin: 0; font-size: .82rem; }
.adm-photo__status { margin: .1rem 0; font-size: .8rem; color: var(--a-muted); min-height: 1.2em; }
.adm-photo__status.is-error { color: var(--a-danger); }
.adm-photo__remove { margin-top: -.2rem; }

/* A file input styled as a button: the native control cannot be, so it is
   hidden inside its own label and the label carries the appearance. */
.adm-file { display: inline-block; cursor: pointer; }
.adm-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.adm-file span {
  display: inline-block; padding: .4rem .8rem; border-radius: 7px;
  border: 1px dashed var(--a-line); background: var(--a-bg);
  font-size: .85rem; color: var(--a-ink);
}
.adm-file:hover span, .adm-file input:focus-visible + span { border-color: var(--a-amber); color: var(--a-amber); }
.adm-file input:focus-visible + span { outline: 2px solid var(--a-amber); outline-offset: 2px; }
.adm-file--sm span { padding: .28rem .55rem; font-size: .78rem; }

.adm-dishgrid {
  display: grid; gap: .9rem; margin-top: .8rem;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
}
.adm-dishcard {
  display: flex; flex-direction: column; gap: .5rem;
  border: 1px solid var(--a-line); border-radius: 8px; padding: .6rem; background: var(--a-surface);
}
.adm-dishcard__frame {
  position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden;
  background: var(--a-bg); display: grid; place-items: center;
}
.adm-dishcard__frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.adm-dishcard__empty { font-size: 1.6rem; color: var(--a-line); line-height: 1; }
.adm-dishcard__body { display: flex; flex-direction: column; gap: .3rem; }
.adm-dishcard__name { margin: 0; font-size: .85rem; font-weight: 600; line-height: 1.3; }
.adm-dishcard__actions { display: flex; gap: .35rem; flex-wrap: wrap; }

/* --- Mail settings -------------------------------------------------------- */

.adm-kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: .6rem 0 0; font-size: .88rem; }
.adm-kv dt { color: var(--a-muted); }
.adm-kv dd { margin: 0; word-break: break-word; }
.adm-inline-form { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.adm-inline-form input { flex: 1 1 16rem; min-width: 0; }
