/* ==========================================================================
   Square Ibis — order confirmation centre (/app/confirm): queue, call card,
   statistics, merchants
   ========================================================================== */

.cf-page { display: flex; flex-direction: column; gap: 18px; }
.cf-today { margin: 0; }
.cf-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- layout: queue on the side, call card in the middle ---------- */

.cf-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.cf-side {
  position: sticky;
  inset-block-start: 76px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 96px);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  min-width: 0;
}
.cf-side .segmented button { gap: 6px; }
.cf-count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding-inline: 5px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-family: var(--mono); font-size: 11px; font-weight: 600; }
.cf-count.is-hot { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }
.cf-filters { display: flex; flex-direction: column; gap: 8px; }
.cf-filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cf-filter-row > *, .cf-filter-row select { min-width: 0; width: 100%; }

.cf-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 120px; margin-inline: -4px; padding-inline: 4px; overscroll-behavior: contain; }
.cf-list .empty-state { padding-block: 28px; }
.cf-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  text-align: start;
  color: var(--text);
  transition: background var(--dur-2, .18s), border-color var(--dur-2, .18s), opacity .2s;
}
.cf-row:hover { background: var(--row-hover, var(--surface-2)); }
.cf-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cf-row.is-active { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.cf-row.is-done:not(.is-active) { opacity: .5; }
.cf-row-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.cf-row-top { display: flex; align-items: baseline; gap: 8px; }
.cf-row-top b { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; }
.cf-amount { font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.cf-row-sub { font-size: 12px; color: var(--text-3); }
.cf-row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.cf-row-meta .tag { font-size: 11px; }
.cf-row-meta .tag svg { width: 12px; height: 12px; }
.cf-age { font-size: 11px; white-space: nowrap; }

.cf-dot { width: 9px; height: 9px; margin-block-start: 5px; border-radius: 50%; flex-shrink: 0; background: var(--gray); }
.cf-dot.risk-good { background: var(--green); box-shadow: 0 0 8px var(--green); }
.cf-dot.risk-mid { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.cf-dot.risk-bad { background: var(--rose); box-shadow: 0 0 8px var(--rose); }

/* ---------- the call card ---------- */

.cf-main { min-width: 0; }
.cf-empty { padding-block: 40px; }
.cf-card { display: flex; flex-direction: column; gap: 16px; padding: 20px; animation: fadeUp .35s var(--ease-out) both; }
.cf-card-head { display: flex; align-items: flex-start; gap: 16px; }
.cf-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; }
.cf-trk { font-weight: 600; font-size: 12.5px; letter-spacing: .02em; color: var(--accent); }
.cf-trk:hover { text-decoration: underline; }
.cf-name { margin-block: 6px 0; font-size: var(--fs-xl, 24px); font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.cf-attempts { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; font-size: 12px; }
.cf-attempts b { font-size: 20px; font-weight: 600; }

.cf-phones { display: flex; flex-direction: column; gap: 8px; }
.cf-phone {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.cf-phone-num { font-size: 22px; font-weight: 600; letter-spacing: .04em; color: var(--text); direction: ltr; unicode-bidi: isolate; }
.cf-phone + .cf-phone .cf-phone-num { font-size: 17px; }
.cf-phone .spacer { flex: 1; }

.cf-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.cf-fact { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.cf-fact > span:first-child { font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.cf-fact b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }

.cf-script { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--r); border: 1px dashed var(--border-strong); }
.cf-script-head { display: flex; align-items: center; gap: 10px; }
.cf-script-head b { display: inline-flex; align-items: center; gap: 7px; flex: 1; font-size: 13px; font-weight: 600; }
.cf-script-head b svg { width: 15px; height: 15px; }
.cf-script-head .segmented button { min-width: 38px; }
.cf-script-text { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.cf-script-text[dir="rtl"] { font-family: var(--font-ar, var(--font)); font-size: 15px; }

.cf-details { border-radius: var(--r); border: 1px solid var(--border); }
.cf-details > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 11px 14px; cursor: pointer; font-size: 13px; font-weight: 600; list-style: none; }
.cf-details > summary::-webkit-details-marker { display: none; }
.cf-details > summary svg { width: 15px; height: 15px; }
.cf-details[open] > summary { border-block-end: 1px solid var(--border); }
.cf-edit { padding: 14px; }
.cf-dirty { display: inline-flex; align-items: center; gap: 5px; margin-inline-start: auto; padding: 2px 9px; border-radius: 99px; background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); font-size: 11.5px; font-weight: 500; }
.cf-dirty[hidden] { display: none; }
.cf-dirty svg { width: 12px; height: 12px; }

.cf-notes { display: flex; flex-direction: column; gap: 6px; }
.cf-notes .section-title { margin: 0 0 2px; }
.cf-note { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-inline-start: 2px solid var(--border-strong); font-size: 13px; }
.cf-note > span:first-child { font-size: 11.5px; }

.cf-outcomes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cf-outcomes .btn { justify-content: center; min-height: 44px; }
.cf-out-confirmed { grid-column: span 2; font-size: 15px; }
.cf-keys { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 11.5px; }
.cf-keys svg { width: 14px; height: 14px; flex-shrink: 0; }

/* call-back picker */
.cf-quick-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-block-end: 14px; }
.cf-quick { justify-content: center; }

/* ---------- statistics & merchants ---------- */

.cf-stats-head { display: flex; justify-content: flex-end; }
.cf-table-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 4px; }
.cf-table-head .card-title { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.cf-table-head svg { width: 16px; height: 16px; }
.cf-fee-wrap { max-width: 130px; }
.cf-fee { min-width: 0; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .cf-layout { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }
  .cf-outcomes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cf-out-confirmed { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  .cf-layout { grid-template-columns: minmax(0, 1fr); }
  .cf-side { position: static; max-height: none; }
  .cf-list { max-height: 46vh; }
}

@media (max-width: 640px) {
  .cf-card { padding: 14px; gap: 14px; }
  .cf-name { font-size: 20px; }
  .cf-phone { padding: 10px 12px; }
  .cf-phone-num { flex-basis: 100%; font-size: 20px; }
  .cf-phone .spacer { display: none; }
  .cf-phone .btn { flex: 1; justify-content: center; }
  .cf-outcomes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cf-quick-row { grid-template-columns: minmax(0, 1fr); }
  .cf-keys { display: none; }
  .cf-filter-row { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .cf-card { animation: none; }
}

/* five KPIs sit on one row on wide screens */
@media (min-width: 1000px) { .kpis.cf-today { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
