/* ============================================================
   Where work comes from, and what it looked like.
   QR codes (Settings), job photos (lead panel), calls (lead panel
   and dashboard). Tokens only: every colour here follows the theme.
   ============================================================ */

/* ------------------------------------------------------- QR codes */

.qr-tools { gap: var(--s2); flex-wrap: wrap; }

.qr-rows { display: flex; flex-direction: column; gap: var(--s2); }

.qr-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "thumb meta figures"
    "thumb actions actions";
  align-items: center;
  column-gap: var(--s4);
  row-gap: var(--s2);
  padding: var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface-2);
  transition: border-color var(--fast) var(--ease);
}
.qr-row:hover { border-color: var(--line-2); }
.qr-row.is-archived { opacity: 0.66; }

.qr-thumb {
  grid-area: thumb;
  align-self: start;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: var(--r-control);
  background: #ffffff;
  overflow: hidden;
  color: var(--text-3);
}
.qr-meta { grid-area: meta; min-width: 0; gap: 2px; }
.qr-meta strong { font-size: var(--t-15); }
.qr-last { font-size: var(--t-12); }

/* The two numbers the row exists for: large, tabular, side by side. */
.qr-figures {
  grid-area: figures;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s1) var(--s5);
  margin: 0;
  text-align: right;
}
.qr-figures dt {
  font-size: var(--t-11);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-3);
}
.qr-figures dd {
  margin: 0;
  font-size: var(--t-21);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--track-title);
}
.qr-rate { flex-basis: 100%; margin: 0; font-size: var(--t-12); color: var(--won-text); }

.qr-actions { grid-area: actions; gap: var(--s1); flex-wrap: wrap; }

.qr-empty {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-card);
  color: var(--text-2);
}
.qr-empty p { margin: 0; }
.qr-empty-glyph {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--r-control);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.qr-link {
  font-family: var(--mono);
  font-size: var(--t-13);
  color: var(--text-2);
  word-break: break-all;
  text-align: center;
}

@media (max-width: 680px) {
  .qr-row {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "thumb meta"
      "figures figures"
      "actions actions";
  }
  .qr-figures { justify-content: flex-start; text-align: left; }
}

/* ---------------------------------------------------------- photos */

.photo-count { margin-left: var(--s2); letter-spacing: 0; font-variant-numeric: tabular-nums; }

.photo-groups { display: flex; flex-direction: column; gap: var(--s4); }
.photo-group-head { display: flex; align-items: baseline; gap: var(--s2); margin-bottom: var(--s2); }
.photo-group-head strong { font-size: var(--t-13); }
.photo-group-head .faint { font-size: var(--t-12); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: var(--s2);
}

.photo-thumb,
.photo-add {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--r-control);
  overflow: hidden;
}

.photo-thumb {
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: zoom-in;
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.photo-thumb:hover { border-color: var(--line-3); transform: translateY(-1px); }
.photo-thumb:active { transform: scale(0.97); }
.photo-thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-thumb.is-broken { background: var(--danger-soft); }
.photo-img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* A caption exists: a small mark, not the caption itself, which would
   not fit and would cover the work. */
.photo-caption-dot {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
}

.photo-add {
  gap: 2px;
  align-content: center;
  border: 1px dashed var(--line-3);
  color: var(--text-2);
  font-size: var(--t-12);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.photo-add:hover { border-color: var(--accent-line); color: var(--accent-text); background: var(--accent-soft); }
.photo-add:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.photo-hint, .photo-status { margin: var(--s2) 0 0; font-size: var(--t-12); }
.photo-status:empty { display: none; }

.photo-frame {
  display: grid;
  place-items: center;
  min-height: 200px;
  max-height: min(62vh, 560px);
  border-radius: var(--r-card);
  background: var(--canvas);
  overflow: hidden;
}
.photo-full { max-width: 100%; max-height: min(62vh, 560px); object-fit: contain; display: block; }
.photo-fields { display: flex; gap: var(--s3); flex-wrap: wrap; }
.photo-fields .grow { flex: 1 1 14rem; }
.photo-viewer-tools { justify-content: space-between; gap: var(--s2); }

/* The viewer needs more room than a confirm does. */
.dialog:has(.photo-viewer) { width: min(720px, calc(100vw - 32px)); }

/* ----------------------------------------------------------- calls */

.call-list { display: flex; flex-direction: column; gap: var(--s1); }

.call-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s2) 0;
  border-top: 1px solid var(--line);
}
.call-row:first-child { border-top: none; }

.call-glyph {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--won-soft);
  color: var(--won-text);
}
.call-row.is-missed .call-glyph { background: var(--attention-soft); color: var(--attention-text); }
.call-row.is-missed.is-handled .call-glyph { background: var(--surface-3); color: var(--text-3); }

.call-body { min-width: 0; gap: 1px; }
.call-summary { font-size: var(--t-13); font-weight: 500; }
.call-row.is-missed:not(.is-handled) .call-summary { color: var(--attention-text); }
.call-meta { font-size: var(--t-12); }

.call-actions { display: flex; gap: var(--s1); flex: none; align-items: center; }
.call-actions .btn { gap: 5px; }

.call-player:empty { display: none; }
.call-player audio { width: 100%; max-width: 320px; height: 34px; margin-top: var(--s2); }

/* Dashboard */
.calls-card { overflow: hidden; }
.calls-card::before {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--trust), transparent 70%);
}
.calls-card.has-missed { border-color: color-mix(in oklab, var(--attention) 30%, var(--line)); }
.calls-card.has-missed::before { background: linear-gradient(90deg, var(--attention), transparent 70%); }
.calls-card h2 { font-size: var(--t-17); }

.calls-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: var(--s6);
  padding: 0 var(--s5) var(--s5);
}
.calls-channels h3 {
  font-size: var(--t-11);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--s3);
}

.calls-waiting-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
  padding: var(--s3) 0;
  border-top: 1px solid var(--line);
}
.calls-waiting-row:first-child { border-top: none; padding-top: 0; }
.calls-waiting-row .call-player { flex-basis: 100%; }
.calls-waiting-row .btn-primary { gap: 5px; }

.calls-who {
  display: flex;
  flex-direction: column;
  flex: 1 1 12rem;
  min-width: 0;
  gap: 1px;
  text-align: left;
  padding: 0;
  border-radius: var(--r-chip);
}
.calls-who:not(:disabled):hover strong { color: var(--accent-text); }
.calls-who:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.calls-who .faint { font-size: var(--t-12); }

.calls-clear {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin: 0;
  color: var(--won-text);
  font-size: var(--t-13);
}

@media (max-width: 760px) {
  .calls-split { grid-template-columns: 1fr; padding: 0 var(--s4) var(--s4); }
}

/* --------------------------------------------- tracking numbers */

.number-rows { display: flex; flex-direction: column; gap: var(--s2); }
.number-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s4);
  padding: var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface-2);
}
.number-row.is-off { opacity: 0.6; }
.number-main { flex: 1 1 14rem; min-width: 0; gap: 2px; }
.number-main strong { font-variant-numeric: tabular-nums; font-size: var(--t-15); }
.number-main .faint { font-size: var(--t-12); }
.number-flags { display: flex; gap: var(--s1); flex-wrap: wrap; }

.webhook-list { display: grid; gap: var(--s3); margin: 0; }
.webhook-list dt { font-size: var(--t-12); color: var(--text-2); margin-bottom: 4px; }
.webhook-list dd { margin: 0; display: flex; gap: var(--s2); align-items: center; }
.webhook-list code {
  flex: 1;
  min-width: 0;
  padding: 6px var(--s2);
  border-radius: var(--r-control);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: var(--t-12);
  overflow-x: auto;
  white-space: nowrap;
}

/* --------------------------------------------------------- reviews */

.review-status {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3);
  border-radius: var(--r-control);
  background: var(--booked-soft);
  border: 1px solid color-mix(in oklab, var(--booked) 30%, var(--line));
  font-size: var(--t-13); line-height: var(--lh-snug);
}
.review-status p { margin: 0; color: var(--text); }
.review-status.is-sent { background: var(--surface-2); border-color: var(--line); }
.review-status.is-sent p { color: var(--text-2); }
.review-star { flex: none; font-size: 18px; line-height: 1; color: var(--booked); }
.review-status .btn { flex: none; }

.review-delay { gap: var(--s2); align-items: center; }

/* The email, drawn as an email: a paper card, the shop's words, the one
   button. Light on purpose in both themes, because that is how it lands
   in the customer's inbox. */
.review-preview {
  max-width: 460px;
  padding: var(--s5);
  border-radius: var(--r-card);
  background: #fbfaf7;
  color: #17150f;
  font-size: var(--t-14);
  line-height: var(--lh-body);
  box-shadow: var(--lift-2);
}
.review-preview p { margin: 0 0 var(--s3); }
.review-preview .faint { color: #615c53; font-size: var(--t-13); margin: var(--s4) 0 0; }
.review-preview-subject {
  font-weight: 700;
  padding-bottom: var(--s3);
  margin-bottom: var(--s4) !important;
  border-bottom: 1px solid #e6e2da;
}
.review-preview-button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 9px;
  background: #17150f;
  color: #fff;
  font-weight: 700;
}
