/* Page-specific styles: queue, exports, report, admin. Prefer app.css components. */

/* ---------- Tabs (admin tabs, report view jump links) ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line-strong); margin: 0 0 20px; }
.tabs a { padding: 9px 16px; margin-bottom: -1px; border: 1px solid transparent; border-radius: var(--radius-sm) var(--radius-sm) 0 0; color: var(--text-2); font-weight: 600; text-decoration: none; }
.tabs a:hover { background: var(--brand-50); color: var(--brand); }
.tabs a.active { background: var(--surface); color: var(--brand); border-color: var(--line-strong); border-bottom-color: var(--surface); box-shadow: inset 0 3px 0 var(--accent); }
@media (max-width: 560px) { .tabs { flex-wrap: nowrap; overflow-x: auto; } .tabs a { white-space: nowrap; padding: 9px 12px; } }

/* ---------- Call queue ---------- */
.ready-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; padding: 26px 24px; }
.ready-card h2 { font-size: 22px; margin-bottom: 4px; }
.how { list-style: none; margin: 0; padding: 6px 18px 14px; counter-reset: how; }
.how li { counter-increment: how; display: grid; grid-template-columns: 34px 1fr; gap: 0 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.how li:last-child { border-bottom: 0; }
.how li::before { content: counter(how); grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; }
.how li span { color: var(--text-2); }

/* ---------- Call task ---------- */
.callee-name { font-size: 26px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.callee-name .pill { font-size: 13px; vertical-align: middle; margin-left: 4px; }
a.dial { color: var(--brand); text-decoration: none; }
a.dial:hover { text-decoration: underline; }
.facts dd.big { font-size: 26px; }
.task-cols .card { margin-bottom: 0; }
.task-cols { margin-bottom: 18px; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.plain legend { padding: 0; margin-bottom: 2px; }
.option > div { min-width: 0; }
.option { align-items: flex-start; }
.panel { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius); padding: 16px; margin: 0 0 18px; }
.panel[hidden], .oc[hidden] { display: none; }
.panel label:last-child { margin-bottom: 0; }
.panel .check { margin-bottom: 0; }
.compact-row { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.errlist { margin: 4px 0 0; padding-left: 18px; }
.save-btn { min-width: 220px; }
@media (max-width: 560px) { .save-btn { width: 100%; } .callee-name { font-size: 22px; } .options { grid-template-columns: 1fr; } }

/* ---------- Exports ---------- */
.kind-cards .card { margin-bottom: 0; display: flex; flex-direction: column; }
.kind-cards .card-body { flex: 1; }
.kind-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big-num { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.big-num.ok { color: var(--ok); } .big-num.warnc { color: var(--warn); } .big-num.zero { color: var(--text-3); }
.kind-cards { margin-bottom: 18px; }
button:disabled { pointer-events: none; }

/* ---------- Report ---------- */
.datebar { display: flex; align-items: flex-end; gap: 8px; }
.datebar label { margin: 0; } .datebar input { margin-top: 3px; }

.breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 18px; }
.breakdown h3 { margin-bottom: 6px; }
.subcard { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.subcard table { font-size: 13.5px; } .subcard td { padding: 7px 12px; }
.subcard p { padding: 10px 12px !important; }
.section-head[id], .card[id] { scroll-margin-top: 16px; }
@media (max-width: 640px) { .datebar { width: 100%; } .datebar label { flex: 1; } }

/* ---------- Admin ---------- */
.form-grid.wide { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.policy-list { margin: 0 0 16px; padding: 10px 14px 10px 32px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text-2); font-size: 13.5px; }
.policy-list li + li { margin-top: 4px; }
.save-bar { padding: 4px 0 12px; }
.tpl-text { min-width: 280px; max-width: 520px; font-size: 13px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input { margin: 0; min-width: 150px; }
.link-form { display: flex; gap: 6px; align-items: center; }
.link-form select { margin: 0; min-width: 130px; }
.filterbar { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: flex-end; border-bottom: 1px solid var(--line); }
.filterbar label { margin-bottom: 0; min-width: 190px; }
.filterbar .filter-btn { display: flex; gap: 6px; }
.detail { max-width: 420px; overflow-wrap: anywhere; }
.counter { font-size: 13px; margin-bottom: 4px; }
.grid.kind-cards, .kind-cards { align-items: stretch; } .kind-cards .card { height: 100%; }

/* ---------- Message templates list ---------- */
/* Groups by fail category: SMS and WhatsApp versions side by side (RCO-114) */
.tpl-group { padding: 16px 22px 20px; }
.tpl-group + .tpl-group { border-top: 1px solid var(--line-strong); }
.tpl-group-head { margin: 0 0 12px; font-size: 16px; }
.tpl-group-head .subtle { display: block; font-weight: 500; }
.tpl-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.tpl-col { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; min-width: 0; }
.tpl-col-head { padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.tpl-missing { margin: 0; padding: 14px; color: var(--text-2); background: var(--warn-50, var(--surface-2)); font-size: 13.5px; }
.tpl-name { margin: 0; font-size: 15px; }
@media (max-width: 900px) { .tpl-cols { grid-template-columns: 1fr; } }
.tpl-list { list-style: none; margin: 0; padding: 0; }
.tpl-col .tpl-row { grid-template-columns: 1fr; align-items: start; padding: 14px; gap: 10px; }
.tpl-row { display: grid; grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) 200px; gap: 18px 24px; align-items: center; padding: 18px 22px; }
.tpl-row + .tpl-row { border-top: 1px solid var(--line); }
.tpl-row.is-off { background: var(--surface-2); }
.tpl-row.is-off .tpl-bubble { opacity: .7; }
.tpl-meta { display: grid; gap: 8px; }
.tpl-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-bubble { max-width: none; white-space: pre-wrap; }
.tpl-side { display: grid; gap: 6px; justify-items: start; }
.tpl-side .btn { margin-top: 4px; }
.tpl-wname { font-family: var(--mono); font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .tpl-row { grid-template-columns: 1fr; } }

/* Template form: a clean grid. Label row, then the input, then any hint underneath, so inputs always line up (RCO-114). */
.tpl-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; align-items: start; }
.tpl-form.wa { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tpl-form .field.full { grid-column: 1 / -1; }
.field { margin-bottom: 16px; min-width: 0; }
.field > label { margin: 0; min-height: 22px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.field > input, .field > select, .field > textarea { margin-top: 6px; }
.field > .hint { margin-top: 4px; }
@media (max-width: 800px) { .tpl-form, .tpl-form.wa { grid-template-columns: 1fr; } }
.counter-chip { margin-left: auto; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-strong);
  color: var(--text-2); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.counter-chip.over { background: var(--warn-50, #fff4d6); border-color: var(--warn, #b7791f); color: var(--warn, #8a5a00); }
.btn.danger-text, button.danger-text { color: var(--bad); }
.btn.danger-text:hover, button.danger-text:hover { background: var(--bad-50); }
.detail { max-width: 560px; }
.kvp { display: inline-flex; gap: 5px; align-items: baseline; margin: 2px 10px 2px 0; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.kvp b { font-weight: 600; color: var(--text-3); font-size: 11.5px; }

/* Call screen: the reason for the call, impossible to miss */
.why-call { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; padding: 14px 22px; background: var(--brand); color: #fff; }
.why-call .why-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.why-call b { font: 700 19px/1.2 var(--display); }
.why-call span:last-child:not(.why-label) { color: #d3dcf7; font-size: 14px; flex-basis: 100%; }

/* RCO-104 overview flow */
.flow-strip { list-style: none; margin: 0; padding: 14px 22px 18px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.flow-step > a, .flow-step > div { display: grid; gap: 3px; align-content: start; height: 100%; padding: 12px; border: 1px solid var(--line, #d9dee8); border-radius: 8px; color: inherit; text-decoration: none; background: #fff; overflow-wrap: anywhere; }
.flow-step > a:hover, .flow-step > a:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.flow-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; }
.flow-text { font-size: 12.5px; color: var(--text-2); }
.flow-count { font-size: 13px; font-weight: 700; margin-top: 4px; }
.flow-step > a .flow-count::after { content: " \2192"; }
.flow-outside > div { border: 2px dashed var(--text-3, #6b7385); background: transparent; }
.flow-outside .flow-num { background: transparent; color: var(--text-2); border: 2px dashed var(--text-3, #6b7385); }
.start-here { display: grid; gap: 10px; justify-items: center; padding: 0 22px 28px; }
.start-here .empty { padding-bottom: 8px; text-align: center; }
@media (max-width: 600px) { .flow-strip { grid-template-columns: 1fr; padding: 12px 16px 16px; } }
/* RCO-103 help */
.help-q { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-left: 12px; border-radius: 50%; border: 1.5px solid var(--line-strong); color: var(--text-2); font: 700 14px/1 var(--display); text-decoration: none; }
.help-q:hover, .help-q:focus-visible { background: var(--brand); color: #fff; border-color: var(--brand); }
.help-sec { scroll-margin-top: 80px; margin-top: 16px; }
.help-toc { margin-bottom: 16px; }
.help-links { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 8px 0 0; padding: 0; }
.help-body { max-width: 760px; line-height: 1.55; }
.help-body ol, .help-body ul { padding-left: 22px; }
.help-body li { margin: 6px 0; }
.help-dl dt { font-weight: 700; margin-top: 12px; }
.help-dl dd { margin: 2px 0 0; color: var(--text-2); }
/* RCO-105 practice reset */
.practice-reset form { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; }
/* RCO-106 confirm */
.confirm-box { flex: 1 1 100%; margin: 0 0 12px; padding: 12px 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); }
.confirm-box p { margin: 0 0 6px; color: var(--text-2); }
.confirm-box p:last-child { margin-bottom: 0; }
.confirm-box .confirm-title { font-weight: 700; color: var(--text); }
.confirm-box .confirm-warn { color: var(--bad); font-weight: 600; }

/* Integrations panel (RCO-122, RCO-125): tile grid */
.integ-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1000px) { .integ-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .integ-grid { grid-template-columns: minmax(0, 1fr); } }
.integ-tile { padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: 10px; background: var(--surface); min-width: 0; }
.integ-tile.ok { border-left-color: var(--ok); }
.integ-tile.bad { border-left-color: var(--bad); }
.integ-tile.warn { border-left-color: var(--warn); }
.integ-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 12px; }
.integ-name { font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.integ-top .badge { flex: none; }
.integ-detail { margin: 8px 0 0; color: var(--text); overflow-wrap: anywhere; }
.integ-sub { margin: 3px 0 0; color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.integ-detail:empty, .integ-sub:empty { display: none; }
.integ .badge.plain::before { display: none; }
.integ .spin { display: inline-block; width: 16px; height: 16px; box-sizing: border-box; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: integ-spin .8s linear infinite; }
@keyframes integ-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .integ .spin { animation: none; border-top-color: var(--line-strong); } }
