/* Admin, platform and sign-in pages. The diner page has its own diner.css. */
:root {
  --bg: #f7f3ec;
  --fg: #221c16;
  --muted: #6f665c;
  --accent: #b5452b;
  --accent-hover: #983820;
  --accent-soft: #f8e7df;
  --accent-fg: #ffffff;
  --border: #e6ddd0;
  --surface: #ffffff;
  --error-bg: #fdecea;
  --error-fg: #8a1c12;
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --shadow: 0 1px 2px rgb(34 28 22 / 6%), 0 4px 14px rgb(34 28 22 / 5%);
  --shadow-pop: 0 8px 24px rgb(34 28 22 / 16%);
  --page: 48rem; /* header and content share one column, so their edges line up */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 {
  margin: 0.25rem 0 1.25rem;
  font-size: 1.75rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
h2 { margin: 0; font-size: 1.1rem; letter-spacing: -0.005em; }
section > h2 { margin: 1.5rem 0 0.6rem; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- header: brand and account row, then the section tabs ------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner, .nav-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1rem;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
}
.topbar form { margin: 0; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 750;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
}
.brand:hover { color: var(--fg); }
.brand-mark { display: block; width: 1.9rem; height: 1.9rem; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

/* Tabs scroll sideways on a phone instead of wrapping into a second untidy row. */
.nav-inner {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }
.nav a {
  flex: none;
  padding: 0.6rem 0.7rem;
  color: var(--muted);
  font-weight: 550;
  font-size: 0.95rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--fg); }
.nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* Dropdowns in the header: <details>, so they open without JavaScript. */
.lang-menu, .account-menu, .place-menu { position: relative; }
.lang-menu summary, .account-menu summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
  font-weight: 700;
  font-size: 0.9rem;
  user-select: none;
}
.lang-menu summary::-webkit-details-marker,
.account-menu summary::-webkit-details-marker,
.place-menu summary::-webkit-details-marker { display: none; }
/* Restaurant switcher, next to the brand: the current name, opening a list of the others. */
.place-menu summary {
  list-style: none;
  cursor: pointer;
  max-width: 12rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.place-menu summary::after { content: "\25BE"; margin-left: 0.3rem; color: var(--muted); }
.place-menu .menu-panel { left: 0; right: auto; }
.lang-menu summary {
  padding: 0 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.lang-menu summary::after { content: "\25BE"; margin-left: 0.3rem; color: var(--muted); }
.account-menu summary {
  width: 2.25rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.lang-menu summary:hover { background: var(--bg); }
.account-menu summary:hover { background: var(--border); }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 20;
  min-width: 11rem;
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
}
.menu-panel button {
  width: 100%;
  min-height: 0;
  padding: 0.5rem 0.9rem;
  border-radius: 0;
  background: none;
  color: var(--fg);
  text-align: left;
}
.menu-panel button:hover { background: var(--bg); }
.menu-panel button b { display: inline-block; min-width: 2rem; }
.menu-panel button[aria-current] { background: var(--accent-soft); }
.menu-panel .who {
  display: block;
  max-width: 16rem;
  padding: 0.4rem 0.9rem 0.5rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

/* --- forms ------------------------------------------------------------------------------------ */
.stack { display: flex; flex-direction: column; gap: 0.85rem; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }

input[type="text"], input[type="email"], input[type="number"], select, textarea {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; }

button {
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  min-height: 2.75rem; /* comfortable touch target on phones */
}
button:hover { background: var(--accent-hover); }
button.link {
  background: none;
  color: var(--accent);
  padding: 0.25rem;
  min-height: 0;
  font-weight: 400;
  text-decoration: underline;
}
button.icon, button.secondary {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  min-height: 2.5rem;
  font-weight: 500;
}
button.icon:hover, button.secondary:hover { background: var(--bg); }
button.icon { min-width: 2.5rem; }
button:disabled, button:disabled:hover { opacity: 0.35; cursor: default; }
button.danger { background: var(--error-fg); }

/* A link that looks like a secondary button; .primary fills it. */
a.button {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
a.button:hover { background: var(--accent-soft); }
a.button.primary { background: var(--accent); color: var(--accent-fg); }
a.button.primary:hover { background: var(--accent-hover); }
a.button.small { padding: 0.35rem 0.75rem; font-size: 0.9rem; min-height: 2.25rem; }

fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.7rem 0.9rem; }
legend { font-weight: 600; padding: 0 0.3rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.4rem; }
label.check { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 400; }
label.check input { width: auto; accent-color: var(--accent); }

/* --- messages --------------------------------------------------------------------------------- */
.error {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--error-bg);
  color: var(--error-fg);
}
/* One-time message after a redirect, e.g. "Saved. Translation is unavailable right now." */
.notice {
  margin: 0 0 1.25rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border-left: 0.3rem solid var(--accent);
  background: var(--accent-soft);
}
.hint { color: var(--muted); font-size: 0.875rem; font-weight: 400; }
.field-error { color: var(--error-fg); font-size: 0.875rem; font-weight: 400; }
.badge {
  font-size: 0.75rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
}
.badge.warn { border-color: var(--error-fg); background: var(--error-bg); color: var(--error-fg); }

/* --- cards and the menu editor ---------------------------------------------------------------- */
.card {
  padding: 1rem 1.15rem;
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card.inactive { opacity: 0.65; }
.card form { margin: 0.25rem 0 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.category > .row {
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
/* A section's sub-category, drawn inside the section's card. */
.category.sub { margin: 0.75rem 0 0; box-shadow: none; background: transparent; }
.category.sub h3 { margin: 0; font-size: 1.05rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.actions form { margin: 0; }
.actions > a:not(.button) { font-size: 0.9rem; text-decoration: none; }
.actions > a:not(.button):hover { text-decoration: underline; }
.items { list-style: none; margin: 0; padding: 0; }
.item { padding: 0.75rem 0; border-top: 1px solid var(--border); }
.item:first-child { border-top: 0; }
.item p { margin: 0.25rem 0; }
.item .actions { margin-top: 0.4rem; }
.item.sold-out strong { text-decoration: line-through; color: var(--muted); }
.price { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }

@media (max-width: 30rem) {
  h1 { font-size: 1.5rem; }
  .topbar .brand-name { display: none; } /* the mark alone on a phone: the row is full */
  .topbar:not(:has(.nav)) .brand-name { display: inline; }
  .topbar-inner { gap: 0.5rem; }
  .brand-mark { width: 1.7rem; height: 1.7rem; }
}

/* People page */
.people { list-style: none; padding: 0.25rem 1.15rem; }
.people li { padding: 0.6rem 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.people li:first-child { border-top: 0; }
.people form { margin: 0; }

/* Menu editor: which of the restaurant's menus is open (only with more than one). */
.menu-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 1rem; }
.menu-tabs form { margin: 0; }
.menu-tabs button { min-height: 2.25rem; padding: 0.35rem 0.85rem; border-radius: 999px; }
.menu-tabs a { margin-left: auto; font-size: 0.9rem; }

/* The platform admin managing a restaurant: a band under the header, impossible to miss. */
.acting {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1rem;
  padding: 0.5rem 1rem; background: #2b2118; color: #fff; font-size: 0.9rem;
}
.acting p { margin: 0; }
.acting form { margin: 0; }
.acting button { min-height: 2.25rem; padding: 0.3rem 0.8rem; }

/* History page */
.history { list-style: none; padding: 0.25rem 1.15rem; }
.history li {
  display: grid; grid-template-columns: 9rem 1fr auto; gap: 0.75rem; align-items: baseline;
  padding: 0.55rem 0; border-top: 1px solid var(--border); overflow-wrap: anywhere;
}
.history li:first-child { border-top: 0; }
@media (max-width: 30rem) { .history li { grid-template-columns: 1fr; gap: 0.1rem; } }

/* Allergen icons (static/allergens.svg), always followed by the allergen's name. */
.al { width: 1.1em; height: 1.1em; vertical-align: -0.2em; flex: none; }

/* Dish photo on the dish form and in the editor list */
.dish-preview { display: block; width: 8rem; height: 8rem; object-fit: cover; border-radius: var(--radius-sm); }
.dish-thumb { float: right; width: 3rem; height: 3rem; object-fit: cover; border-radius: 0.4rem; margin-left: 0.5rem; }

/* Sign-in pages: one small centred card */
.auth-card { max-width: 26rem; margin: 2rem auto; padding: 1.5rem 1.5rem 1.75rem; }
.auth-card h1 { font-size: 1.5rem; }
