/* ==========================================================================
   QUICK REFERENCE (ADR-0199): the answers, the emergency details, the phone
   numbers, today's cleaning, and the card editor.
   --------------------------------------------------------------------------
   Loaded after v3.css (like camps.css), so a page rule wins over a v3 base at
   equal specificity. The card is the old page's own (`.qr-card`, `.qr-details`,
   `.qr-includes` ...), moved here when the hard-coded page was deleted; the
   page's new pieces are `ref-`. Everything else is the app's own and is only
   USED here: `.titled-section`, `.settings-callout`, `.attendance-search`,
   `.chip`, `.state-chip`, `.empty-state`, `.btn-icon`, the modal factory.
   A page's header is static markup the page fills (ADR-0122), pinned with its
   body (ADR-0197). No one-sided accent borders, no gradients, no pill radii
   (`--radius-sm`). The phone rules are in mobile.css, in its SQUEEZED PAGES block.
   `.qr-overlay`, `.qr-modal` and `.qr-hint` in visit.css are the member visit's
   QR code, not this page.
   ========================================================================== */

/* ── the header: one line, the way Camps' is ───────────────────────────────
   Only the gap and the ellipsis are restyled; the height is the one rule's
   (ADR-0197), never justify-content or flex-wrap (ADR-0122 §5). */
.qr-head {
  gap: var(--space-3);
  flex: none;
  padding-block: var(--space-1);
  border-bottom: 1px solid var(--color-border-subtle);
}
.qr-head .class-header-name-row { min-width: 0; align-items: baseline; }
.qr-head .class-header-name { overflow: hidden; text-overflow: ellipsis; }
.qr-head .class-header-name .bi { margin-right: var(--space-2); }
.qr-back { flex: none; }
/* The header's links are buttons that navigate: no underline. */
.qr-head a,
.qr-head a:hover { text-decoration: none; }
.qr-header-sub { font-size: var(--text-sm); color: var(--color-text-muted); white-space: nowrap; }
.qr-header-sub:empty { display: none; }
.qr-head .class-header-actions { flex: none; }
.qr-head .qr-overflow { display: inline-flex; }

/* The body is a flex column so the bands under the header keep their gap. */
#tab-quick-references > .page-body { display: flex; flex-direction: column; flex: 1 0 auto; }
.qr-page { gap: var(--space-3); min-width: 0; }

/* ── the card (the old page's own) ────────────────────────────────────────── */
.qr-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.qr-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-bg-subtle);
}

.qr-card-header > i {
  font-size: var(--text-lg);
  color: var(--color-accent);
  flex-shrink: 0;
}

.qr-card-header h3 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
  flex: 1;
}

.qr-price {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--color-success);
  text-align: right;
  white-space: nowrap;
}

.qr-card-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.qr-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.qr-detail {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.qr-detail i {
  color: var(--color-text-muted);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.qr-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
}

.qr-breakdown-item {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding-left: var(--space-3);
  position: relative;
}

.qr-breakdown-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 50%;
  transform: translateY(-50%);
}

.qr-includes {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.qr-includes strong {
  color: var(--color-success);
}

.qr-excludes {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.qr-excludes strong {
  color: var(--color-danger);
}

.qr-addon {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding: var(--space-2) var(--space-3);
  background: var(--color-info-tint);
  border-radius: var(--radius-md);
}

.qr-addon i {
  color: var(--color-info);
}

.qr-purpose {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.qr-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.qr-note i {
  color: var(--color-warning);
  margin-top: 2px;
  flex-shrink: 0;
}

.qr-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.qr-tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  padding: 2px var(--space-2);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
}

.qr-disciplines {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ── the page: Find over the cards, the emergency details beside them ──────── */
#ref-q-field { flex: 1 1 280px; min-width: 0; }
.ref-faint { color: var(--color-text-muted); font-size: var(--text-sm); }
.ref-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-areas: "main emerg" "main phones" "main today";
  grid-template-rows: auto auto 1fr;
  gap: var(--space-3) var(--space-4);
  align-items: start;
}
.ref-main { grid-area: main; display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.ref-emerg { grid-area: emerg; }
.ref-contacts { grid-area: phones; }
.ref-today { grid-area: today; }
.qr-page .qr-card { margin: 0; max-width: none; }
.ref-main .titled-section { gap: var(--space-3); }
.ref-main .titled-section:not(.hidden) + .titled-section:not(.hidden) { margin-top: var(--space-2); }
.ref-clear-row { display: flex; justify-content: center; margin-top: var(--space-2); }
.ref-none { margin: 0; padding: var(--space-3) var(--space-4); font-size: var(--text-sm); color: var(--color-text-muted); }
#ref-cleaning { scroll-margin-top: var(--page-pin-h); }
.qr-cleaning .qr-cleaning-print, .qr-cleaning .qr-rota-link { flex-shrink: 0; }

/* The card body, laid out for one column: facts read across, not down. */
.ref-card .qr-details { flex-direction: row; flex-wrap: wrap; gap: 4px var(--space-4); }
.ref-card .qr-price { white-space: normal; }
.ref-card .qr-card-header { padding: var(--space-3) var(--space-4); }
.ref-card .qr-card-body { padding: var(--space-3) var(--space-4); gap: var(--space-2); }
.ref-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); color: var(--color-text-secondary); }
.ref-steps li::marker { font-weight: var(--font-bold); color: var(--color-text); }
/* A Link line is a button that navigates (the prototype's is a <button>; this one is an <a> so it is a real link): no underline. */
.ref-link, .ref-link:hover { align-self: flex-start; text-decoration: none; }
.ref-card-edit { margin-left: var(--space-1); }
.ref-notice { margin-bottom: 0; align-items: center; }

/* Emergency: a full red-tinted border, never a one-sided stripe. */
.ref-emerg {
  border: 1px solid color-mix(in srgb, var(--color-danger) 40%, transparent);
  background: var(--color-danger-tint);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.ref-emerg-head { display: flex; align-items: center; gap: 6px; font-weight: var(--font-bold); color: var(--color-danger); }
.ref-emerg-head .btn-icon { margin-left: auto; }
.ref-911 { justify-content: center; font-size: var(--text-lg); font-weight: var(--font-bold); min-height: 48px; text-decoration: none; }
.ref-emerg-addr { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); }
.ref-emerg-facts { margin: 0; padding-left: 18px; font-size: var(--text-sm); color: var(--color-text-secondary); display: flex; flex-direction: column; gap: 2px; }
.ref-emerg-more > summary { cursor: pointer; font-size: var(--text-sm); color: var(--color-text-secondary); list-style: none; }
.ref-emerg-more > summary::-webkit-details-marker { display: none; }
@media (min-width: 601px) { .ref-emerg-more > summary { display: none; } }
.ref-emerg-more[open] > summary { margin-bottom: 4px; }

/* The phone numbers. */
.ref-contact-list { list-style: none; margin: 0; padding: 0; }
.ref-contact { display: flex; align-items: center; gap: var(--space-2); padding: 8px var(--space-4); border-bottom: 1px solid var(--color-border-subtle); }
.ref-contact:last-child { border-bottom: 0; }
.ref-contact-what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ref-contact-what span { font-size: var(--text-xs); color: var(--color-text-muted); }
.ref-contact-num { white-space: nowrap; font-weight: var(--font-semibold); font-variant-numeric: tabular-nums; color: var(--color-accent); text-decoration: none; }
.ref-contact-num:hover { text-decoration: underline; }
.ref-contact.is-emergency .ref-contact-num { color: var(--color-danger); }

/* Cleaning today. */
.ref-shift { display: flex; flex-direction: column; gap: 4px; padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md); }
.ref-shift.is-now { background: var(--color-bg-subtle); border-color: var(--color-border); }
.ref-shift-head { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.ref-shift-head span:not(.state-chip) { color: var(--color-text-muted); }
.ref-shift-head .state-chip { margin-left: auto; }
.ref-shift-none { font-size: var(--text-sm); color: var(--color-text-muted); }
.ref-room-name { font-weight: var(--font-semibold); font-size: var(--text-sm); }
.ref-room ul { margin: 2px 0 0; padding-left: 18px; font-size: var(--text-sm); color: var(--color-text-secondary); }
.ref-print-rooms { margin-top: var(--space-4); }

/* ── the card editor ──────────────────────────────────────────────────────── */
.ref-edit { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-5); align-items: start; }
.ref-edit-form { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.ref-edit-form .titled-section { margin-top: 0; }
.ref-edit-preview { position: sticky; top: var(--page-pin-h); }
.ref-edit-preview-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); margin-bottom: var(--space-2); }
.ref-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-4); }
.ref-lines { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-2); }
.ref-line { display: grid; grid-template-columns: 150px auto minmax(0, 1fr) auto; gap: var(--space-2); align-items: center; }
.ref-line .ref-line-text:nth-child(2) { grid-column: span 2; }
.ref-line-btns { display: inline-flex; gap: 2px; }
.ref-price-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: var(--space-2); }
.ref-delete-note { margin: 0; font-size: var(--text-sm); color: var(--color-text-muted); }

/* ── the emergency sheet: paper, so its colours are fixed, not the theme's ── */
.ref-esheet { background: #fff; color: #14110f; border: 1px solid #d8d2ca; padding: 28px 32px; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; font-family: 'Roboto', sans-serif; }
.ref-esheet-top { text-align: center; border: 3px solid #14110f; padding: 14px; }
.ref-esheet-label { font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: .08em; font-size: 15px; }
.ref-esheet-911 { font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 54px; line-height: 1.05; }
.ref-esheet-addr { font-weight: 700; font-size: 18px; }
.ref-esheet-sub { font-size: 13px; }
.ref-esheet-where { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; font-size: 13px; }
.ref-esheet-where strong { display: block; font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.ref-esheet-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ref-esheet-table th { text-align: left; border-bottom: 2px solid #14110f; font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: .04em; padding: 4px 6px; }
.ref-esheet-table td { border-bottom: 1px solid #d8d2ca; padding: 5px 6px; }
.ref-esheet-num { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ref-esheet-foot { font-size: 11px; color: #3a3530; text-align: center; }

