/* components.css — Direction A (Focus)
   Shared, reusable component classes used across screens.
   Ported from the component blocks of the prototype's app.css.
   Screen-specific selectors live in the per-area screens_*.css files, not here. */

/* ---------- page headings & labels ---------- */
.hello {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px;
}

h1.page {
  font-size: 38px;
  line-height: 1.03;
  letter-spacing: -.03em;
  margin: 0 0 26px;
  font-weight: 800;
}

/* Page titles read in one consistent ink colour; the .accent span is kept for
   markup compatibility but no longer recolours part of the heading. */
h1.page .accent {
  color: inherit;
}

.step {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 2px 13px;
}

.sectlabel {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 2px 12px;
  font-weight: 600;
}

/* ---------- buttons ---------- */
.btn {
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  border-radius: 12px;
  padding: 11px 18px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  transition: .15s;
}

.btn:hover {
  border-color: #c9c7ba;
}

.btn.primary {
  background: var(--clay);
  border-color: var(--clay);
  color: #fff;
}

.btn.primary:hover {
  background: var(--clay-deep);
}

.cta {
  width: 100%;
  border: none;
  background: var(--clay);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  padding: 16px;
  border-radius: 14px;
  cursor: pointer;
  transition: .16s;
}

.cta:hover {
  background: var(--clay-deep);
}

.cta:disabled {
  background: #d9c3ba;
  cursor: not-allowed;
}

/* ---------- pills (status) ---------- */
.pill {
  font-size: 11.5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-weight: 600;
}

.pill.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill.you {
  background: #eceadd;
  color: #5a5b48;
}

.pill.pending {
  background: #fbf0e2;
  color: var(--warn);
}

/* ---------- toggle switch ---------- */
.switch {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #d8d6c9;
  position: relative;
  transition: .2s;
  flex: none;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

.on > .switch, .switch.on {
  background: var(--clay);
}

.on > .switch::after, .switch.on::after {
  left: 23px;
}

/* ---------- room list (booking) ---------- */
.rooms {
  display: grid;
  gap: 10px;
}

.room {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  cursor: pointer;
  transition: .16s;
}

.room:hover {
  border-color: #c9c7ba;
}

.room.sel {
  border-color: var(--clay);
  background: #fff;
  box-shadow: 0 0 0 3px var(--clay-soft);
}

.room .glyph {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  flex: none;
}

.room .meta strong {
  display: block;
  font-size: 14.5px;
}

.room .meta span {
  font-size: 12px;
  color: var(--muted);
}

.room .price {
  margin-left: auto;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
}

.room .price small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  font-size: 10.5px;
}

/* ---------- catering toggle + deadline note ---------- */
.catering-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  cursor: pointer;
}

.catering-toggle .ico {
  font-size: 22px;
}

.catering-toggle .meta strong {
  display: block;
  font-size: 14.5px;
}

.catering-toggle .meta span {
  font-size: 12px;
  color: var(--muted);
}

.catering-toggle .switch {
  margin-left: auto;
}

/* A prepared order can't be toggled off — the kitchen has already made it. */
.catering-toggle.is-locked {
  cursor: default;
  opacity: .75;
}

.deadline {
  font-size: 12.5px;
  color: var(--muted);
  margin: 11px 4px 0;
  display: flex;
  gap: 7px;
}

.deadline b {
  color: var(--ink);
  font-weight: 600;
}

.deadline.warn {
  color: var(--warn);
}

.deadline.warn b {
  color: var(--warn);
}

/* ---------- modal / confirmation overlay ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 23, 15, .42);
  backdrop-filter: blur(2px);
  display: grid;
  /* A shrinkable track, so a card's max-width:100% resolves against the screen
     (an auto track would grow to the card's 420px and overflow a phone). */
  grid-template-columns: minmax(0, 1fr);
  /* Top-aligned with auto block margins: centred when the card fits, and when it's
     taller than the screen its top stays reachable by scrolling. */
  align-items: start;
  justify-items: center;
  padding: 24px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left));
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  pointer-events: none;
  transition: .26s;
  z-index: 60;
}

.scrim > * {
  margin-block: auto;
}

.scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.doneCard {
  background: var(--paper);
  border-radius: 24px;
  width: 420px;
  max-width: 100%;
  text-align: center;
  padding: 38px 30px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .5);
  transform: translateY(14px) scale(.99);
  transition: .26s;
}

.scrim.open .doneCard {
  transform: none;
}

.check {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--ok);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both;
}

@keyframes pop {
  from {
    transform: scale(.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.check svg {
  width: 36px;
  height: 36px;
  stroke: #fff;
  stroke-width: 2.4;
  fill: none;
}

.doneCard h2 {
  font-size: 24px;
  margin: 0 0 6px;
  letter-spacing: -.02em;
}

.doneCard p {
  color: var(--muted);
  margin: 0 0 18px;
  font-size: 14px;
}

/* Rails wraps an invalid field's label and control in this div; keep it out of
   layout so error states look like the normal form (tooltips stay inline). */
.field_with_errors {
  display: contents;
}

/* ---------- flash messages ---------- */
.flash {
  margin: 0 0 18px;
  padding: 13px 16px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--line);
}

.flash-notice {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: #c9ddc5;
}

.flash-alert {
  background: var(--clay-soft);
  color: var(--clay-deep);
  border-color: #f1c4ab;
}

/* ---------- table row states (folded from old application.css) ----------
   Status cues for the workflow-task and member tables on the dashboards. */
tr.terminated {
  opacity: .5;
}

tr.task-overdue {
  background-color: #fde7e7;
}

tr.task-amber {
  background-color: #fff4d6;
}

tr.task-completed {
  opacity: .5;
}

/* ---------- native form controls ----------
   Pull the browser's default checkboxes/radios/file inputs onto the warm palette so
   they stop rendering in iOS blue (notification preferences) or as the raw "Choose
   File" widget (printer drivers). */
input[type="checkbox"], input[type="radio"] {
  accent-color: var(--clay);
}

input[type="file"] {
  font: inherit;
  font-size: 14px;
  color: var(--muted);
}

input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  border-radius: 12px;
  padding: 9px 16px;
  margin-right: 12px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  transition: .15s;
}

input[type="file"]::file-selector-button:hover {
  border-color: #c9c7ba;
}

/* ---------- utility ---------- */
.hidden {
  display: none !important;
}

/* iOS Safari zooms the whole page when it focuses a text control under 16px, and
   doesn't zoom back out. Every screen styles its own fields, so this one override
   wins over all of them on phones. */
@media (max-width: 760px) {
  input:not([type="checkbox"], [type="radio"], [type="file"], [type="submit"], [type="button"]), select, textarea {
    font-size: 16px !important;
  }
}

/* Tables on phones: each row becomes a stacked card instead of a grid you have to
   scroll sideways. The title cell leads (the first cell, or the one marked .title),
   cells with a data-label read as "Label ... value" lines, and row actions sit at
   the bottom. Covers the admin lists (.st-table) and the report/statement tables. */
@media (max-width: 760px) {
  main :is(.st-table, .reporttable table),
  main :is(.st-table, .reporttable table) :is(tbody, tfoot) {
    display: block;
  }

  main :is(.st-table, .reporttable table) thead {
    display: none;
  }

  main :is(.st-table, .reporttable table) tr {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }

  main :is(.st-table, .reporttable table) tbody tr:last-child {
    border-bottom: none;
  }

  main :is(.st-table, .reporttable table) td {
    padding: 0;
    border: none;
    text-align: left;
    font-size: 14px;
    overflow-wrap: anywhere;
  }

  main :is(.st-table, .reporttable table) td:is(.title, :first-child:not([data-label])) {
    order: -1;
    font-size: 15px;
    font-weight: 700;
  }

  main :is(.st-table, .reporttable table) td[data-label] {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    text-align: right;
  }

  main :is(.st-table, .reporttable table) td[data-label]::before {
    content: attr(data-label);
    flex: none;
    color: var(--muted);
    font-family: "Hanken Grotesk", system-ui, sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    text-align: left;
  }

  /* Long prose (descriptions, tooltip bodies) reads better under its label. */
  main :is(.st-table, .reporttable table) td.stacked {
    display: block;
    text-align: left;
  }

  main :is(.st-table, .reporttable table) td.stacked::before {
    display: block;
    margin-bottom: 2px;
  }

  main :is(.st-table, .reporttable table) td:has(> .st-actions) {
    margin-top: 5px;
  }

  main .st-table .st-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  main .reporttable tfoot tr {
    flex-direction: row;
    justify-content: space-between;
    background: var(--paper);
  }
}

/* iOS Safari draws date/time inputs as its own inline-flex control: it ignores
   width:100% (overflowing cards and colliding in rows), centres the value, and
   collapses to a sliver when empty. Strip the native appearance on iOS only
   (desktop keeps its calendar picker) so they size and align like text fields. */
@supports (-webkit-touch-callout: none) {
  input:is([type="date"], [type="time"], [type="datetime-local"]) {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    min-width: 0;
    max-width: 100%;
    text-align: left;
  }

  input:is([type="date"], [type="time"], [type="datetime-local"])::-webkit-date-and-time-value {
    min-height: 1.25em;
    margin: 0;
    text-align: left;
  }
}
