/* =============================================================================
 * concierge.css — the Concierge: the round button in the header and the panel it opens (js/concierge.js)
 * =============================================================================
 * Phone first: on a phone the panel fills the screen; from 641 px it is a sheet that slides in from the
 * inline end (the right, the left in Arabic). Built from the site's tokens (css/styles.css, section 2): paper
 * and ink, hairlines, the serif for headings. The chart marks use --brand-ink, the theme colour that keeps
 * its contrast on white (the yellow theme's --brand would not).
 * ========================================================================== */

/* ---- The button, beside the language menu */
.nav-tools { display: flex; align-items: center; gap: .25rem; }
.concierge-btn {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; cursor: pointer;
  font: 600 .8125rem/1 var(--font-body); letter-spacing: .02em; color: var(--ink);
  background: transparent; border: 1.5px solid var(--line); border-radius: 50%;
  transition: background-color .15s, border-color .15s, color .15s;
}
.concierge-btn:hover { background: var(--mist); border-color: var(--grey-300); }
.concierge-btn svg { width: 22px; height: 22px; }
.concierge-btn.is-user { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.concierge-btn.is-user:hover { background: #000; }
.concierge-btn.is-muted { background: var(--grey-500); border-color: var(--grey-500); }
.concierge-avatar { display: grid; place-items: center; }

/* ---- The panel: a modal <dialog> */
.concierge {
  width: min(100vw, 30rem); max-width: none; height: 100vh; height: 100dvh; max-height: none;
  margin: 0; margin-inline-start: auto; padding: 0; color: var(--ink); background: var(--paper);
  border: 0; box-shadow: 0 0 60px -20px rgb(20 20 19 / .45);
}
.concierge[open] { display: flex; flex-direction: column; animation: cg-in .32s var(--ease); }
.concierge::backdrop { background: rgb(20 20 19 / .4); }
[dir="rtl"] .concierge[open] { animation-name: cg-in-rtl; }
@keyframes cg-in { from { transform: translateX(100%); } }
@keyframes cg-in-rtl { from { transform: translateX(-100%); } }

.concierge-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: max(.85rem, env(safe-area-inset-top)) 1.25rem .85rem; border-bottom: 1px solid var(--line);
}
.concierge-title { margin: 0; font-size: var(--step-2); font-weight: 400; }
.concierge-x {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: -.4rem; padding: 0; cursor: pointer;
  color: var(--ink); background: transparent; border: 0; border-radius: 50%;
}
.concierge-x:hover { background: var(--mist); }
.concierge-x svg { width: 1.25rem; height: 1.25rem; }
.concierge-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 1.25rem 1.25rem max(1.5rem, env(safe-area-inset-bottom));
}
.concierge-status {
  flex: none; margin: 0; padding: .7rem 1.25rem max(.7rem, env(safe-area-inset-bottom));
  font-size: .875rem; font-weight: 600; color: var(--paper); background: var(--ink);
}
.concierge-status:empty { display: none; }
.concierge-status.is-error { background: #b00020; }

/* ---- Building blocks */
.cg-view { display: grid; gap: 1.25rem; }
.cg-stack { display: grid; gap: 1rem; }
.cg-card { padding: 1rem; background: var(--white); border: 1px solid var(--line); border-radius: 18px; }
.cg-h { margin: 0 0 .35rem; font-size: 1.25rem; font-weight: 500; }
.cg-note { margin: 0; font-size: .875rem; line-height: 1.5; color: var(--grey-700); }
.cg-warn { margin: 0; padding: .75rem 1rem; font-size: .9375rem; color: #4d3b00; background: #fff6d6; border: 1px solid #e8c24a; border-radius: var(--radius-ctl); }
.cg-empty { margin: 0; padding: 1rem 0; font-size: .875rem; color: var(--grey-700); text-align: center; }
.cg-wide { width: 100%; }
.cg-inline { display: flex; align-items: center; gap: .5rem; }
.cg-inline > input, .cg-inline > code { flex: 1; min-width: 0; }
.cg-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
code.cg-code {
  padding: .6rem .75rem; font-size: .9375rem; background: var(--white);
  border: 1.5px dashed var(--grey-300); border-radius: 10px; overflow-wrap: anywhere; user-select: all;
}

.cg-form { display: grid; gap: .45rem; }
.cg-form label, .cg-diet legend { margin-top: .3rem; font-weight: 600; font-size: .875rem; }
.cg-form .cg-h + label, .cg-form .cg-note + label { margin-top: .5rem; }
.cg-form .field-error { margin: .1rem 0; }
.cg-form .field-error:empty { display: none; }
.cg-form .btn-primary { margin-top: .4rem; }
.concierge :is(input[type="email"], input[type="date"], input[type="search"], select, textarea) {
  width: 100%; min-height: 44px; padding: .55rem .8rem; font: inherit; font-size: .9375rem; color: var(--ink);
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-ctl); transition: border-color .15s;
}
.concierge textarea { min-height: 5.5rem; resize: vertical; line-height: 1.45; }
.concierge select { padding-inline-end: 2rem; cursor: pointer; }
.concierge :is(input, select, textarea):focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgb(29 29 29 / .08); }
.concierge .password-field input { min-height: 48px; }

.cg-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem .75rem; }
.cg-field { display: grid; gap: .3rem; min-width: 0; }
.cg-field-day { grid-column: 1 / -1; }

.cg-chip {
  display: inline-flex; align-items: center; min-height: 24px; padding: .15rem .6rem;
  font-size: .75rem; font-weight: 600; color: var(--ink); background: var(--mist); border-radius: 999px;
}
.cg-chip.is-warn { color: var(--brand-ink); background: var(--brand-soft); }

/* ---- Who is logged in */
.cg-id, .cg-guest { display: flex; align-items: center; gap: .9rem; }
.cg-guest { align-items: flex-start; }
.cg-avatar {
  flex: none; display: grid; place-items: center; width: 52px; height: 52px;
  font: 600 1.05rem/1 var(--font-body); color: var(--paper); background: var(--ink); border-radius: 50%;
}
.cg-avatar.is-guest { color: var(--ink); background: var(--mist); }
.cg-avatar.is-guest svg { width: 28px; height: 28px; }
.cg-avatar.is-small { width: 36px; height: 36px; font-size: .8125rem; }
.cg-id-text { display: grid; gap: .15rem; justify-items: start; min-width: 0; }
.cg-id-name { margin: 0; font-weight: 600; font-size: 1.0625rem; overflow-wrap: anywhere; }
.cg-id-mail { margin: 0; font-size: .8125rem; color: var(--grey-700); overflow-wrap: anywhere; }
.cg-id .cg-chip { margin-top: .2rem; }

.cg-kitchen {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .5rem .75rem;
  padding: .85rem 1rem; background: var(--white); border: 1px solid var(--line); border-radius: 18px;
}
.cg-kitchen-icon { display: grid; color: var(--brand-ink); }
.cg-kitchen-icon svg { width: 1.5rem; height: 1.5rem; }
.cg-kitchen .btn-ghost { grid-column: 1 / -1; }

/* ---- Tabs and small segmented choices */
.cg-tabs {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px;
  background: var(--mist); border-radius: 14px;
}
.cg-tab, .cg-seg-btn {
  min-width: 0; min-height: 42px; padding: .3rem .5rem; cursor: pointer;
  font: 600 .875rem/1.15 var(--font-body); color: var(--grey-700); background: transparent; border: 0; border-radius: 11px;
}
.cg-tab[aria-selected="true"], .cg-seg-btn[aria-pressed="true"] { color: var(--ink); background: var(--white); box-shadow: 0 1px 2px rgb(20 20 19 / .12); }
.cg-tab:hover, .cg-seg-btn:hover { color: var(--ink); }
.cg-panel:focus { outline: none; }
.cg-seg { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; background: var(--mist); border-radius: 12px; }
.cg-seg-btn { min-height: 34px; padding-inline: .75rem; font-size: .8125rem; border-radius: 9px; }
.cg-controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; margin-bottom: .9rem; }

/* ---- My numbers: tiles, chart, table */
.cg-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .5rem; }
.cg-tile { padding: .75rem .9rem; background: var(--paper); border-radius: 12px; }
.cg-tile p { margin: 0; }
.cg-tile-label { font-size: .75rem; font-weight: 600; color: var(--grey-700); }
.cg-tile-value { font-size: 1.5rem; font-weight: 600; line-height: 1.25; }
.cg-tile-sub { font-size: .8125rem; color: var(--grey-700); }

.cg-chart { position: relative; touch-action: pan-y; border-radius: 10px; }
.cg-chart:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.cg-chart-svg { display: block; max-width: none; overflow: visible; }
.cg-grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.cg-axis { fill: var(--grey-500); font: 500 11px var(--font-body); font-variant-numeric: tabular-nums; }
.cg-area { fill: var(--brand-ink); fill-opacity: .1; }
.cg-line { fill: none; stroke: var(--brand-ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cg-dot { fill: var(--brand-ink); stroke: var(--white); stroke-width: 2; }
.cg-cross { stroke: var(--grey-300); stroke-width: 1; shape-rendering: crispEdges; }
.cg-end { fill: var(--ink); font: 600 12px var(--font-body); }
.cg-tip {
  position: absolute; z-index: 1; display: grid; justify-items: center; padding: .35rem .65rem;
  font-size: .8125rem; line-height: 1.3; white-space: nowrap; color: var(--paper); background: var(--ink);
  border-radius: 8px; pointer-events: none; transform: translate(-50%, calc(-100% - 12px));
}
.cg-tip.is-below { transform: translate(-50%, 12px); }
.cg-tip strong { font-weight: 600; }
.cg-tip span { opacity: .75; }

.cg-table-wrap { overflow-x: auto; }
.cg-table { width: 100%; border-collapse: collapse; font-size: .875rem; font-variant-numeric: tabular-nums; }
.cg-table th { padding: .4rem .5rem; font-size: .75rem; font-weight: 600; color: var(--grey-700); text-align: start; border-bottom: 1px solid var(--line); }
.cg-table td { padding: .3rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cg-table tr:last-child td { border-bottom: 0; }
.cg-table td:last-child { width: 1%; text-align: end; }
.cg-icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; cursor: pointer;
  color: var(--grey-700); background: transparent; border: 0; border-radius: 50%;
}
.cg-icon-btn:hover { color: var(--ink); background: var(--mist); }
.cg-icon-btn svg { width: 1rem; height: 1rem; }

/* ---- Diet */
.cg-diet { margin: .4rem 0 0; padding: 0; border: 0; min-width: 0; }
.cg-diet legend { margin-bottom: .45rem; padding: 0; }

/* ---- Users */
.cg-list-tools { display: grid; gap: .5rem; margin: .4rem 0 .5rem; }
.cg-list-tools .cg-seg { justify-self: start; }
.cg-count { margin: 0 0 .5rem; font-size: .8125rem; color: var(--grey-700); }
.cg-members { display: grid; gap: .5rem; }
.cg-member {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .2rem .75rem; align-items: start;
  padding: .75rem; background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
}
.cg-member-main { min-width: 0; }
.cg-member-name { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cg-you { font-weight: 400; color: var(--grey-700); }
.cg-member-mail { margin: 0; font-size: .8125rem; color: var(--grey-700); overflow-wrap: anywhere; }
.cg-member-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .4rem; }
.concierge select.cg-role { width: auto; min-height: 36px; padding-block: .3rem; font-size: .8125rem; }
.cg-member.is-revoked .cg-member-main { opacity: .65; }
.cg-member-actions, .cg-member-more { grid-column: 2 / -1; }
.cg-member-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.cg-member-more:empty { display: none; }
.cg-small { min-height: 36px; padding: .3rem .75rem; font-size: .8125rem; }
.btn-ghost.is-danger { color: #b00020; border-color: #e7b3bc; }
.btn-ghost.is-danger:hover { border-color: #b00020; }
.btn-primary.is-danger { color: #fff; background: #b00020; border-color: #b00020; }
.cg-confirm { display: grid; gap: .5rem; margin-top: .5rem; padding: .75rem; background: var(--mist); border-radius: 12px; }
.cg-confirm p { margin: 0; font-size: .875rem; }
.cg-confirm .cg-inline { flex-wrap: wrap; }
.cg-confirm input { min-height: 36px; }
.cg-result { display: grid; gap: .5rem; padding: .75rem; background: #eef6ee; border: 1px solid #b7d8b9; border-radius: 12px; }
.cg-result p { margin: 0; font-size: .875rem; overflow-wrap: anywhere; }
.cg-logout { margin-top: .25rem; }

/* ---- Phones: the panel fills the screen; 16 px fields stop iOS Safari from zooming */
@media (max-width: 640px) {
  .concierge { width: 100vw; box-shadow: none; }
  .concierge :is(input, select, textarea) { font-size: 16px; }
  .concierge-body { padding-inline: 1rem; }
  .cg-card { padding: .9rem; }
}

/* ---- Touch: 44 px targets */
@media (pointer: coarse) {
  .concierge-btn { width: 44px; height: 44px; }
  .cg-tab, .cg-seg-btn, .cg-small, .concierge select.cg-role { min-height: 44px; }
  .cg-icon-btn { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .concierge[open] { animation: none; }
}

@media print {
  .nav-tools, .concierge { display: none !important; }
}
