/* ============================================================================
   BARBAROS — call-mode.css ("Mode appel", owner-approved model 05)
   Reproduces prototypes/orders-models.html (.focus / .fc / .ph / .fbtns / .script / .queue)
   on the app tokens. Root: #callMode inside #panel-confirmation.cmo-on.
   Class names avoid the legacy painter fragments (card, chip, tag, box, block, badge, status)
   and use the `cmo-` namespace: orders.css already owns .cm-row / .cm-info / .cm-badge.

   Collision list (!important only here):
   - #panel-confirmation.cmo-on > :not(.panel-header):not(#callMode) { display:none }
       legacy .call-center-layout / #callEmpty carry display rules of their own (orders.css,
       buld-theme.css) and the [hidden] toggle from renderConfirmation(); hiding must win.
   - .cmo-btn color / background on <a>: the global link colour rules of styles.css and
       orders-theme.css (a { color } / a:hover) otherwise repaint Appeler / WhatsApp.
   ============================================================================ */

#panel-confirmation.cmo-on > :not(.panel-header):not(#callMode) { display: none !important; }

html[data-buld-theme] #callMode {
    --cmo-card: var(--buld-elevated);
    --cmo-s2: var(--buld-surface-2);
    --cmo-line: var(--buld-divider);
    --cmo-hair: var(--buld-hairline);
    --cmo-ok: var(--buld-success);
    --cmo-bad: var(--buld-danger);
    --cmo-warn: var(--buld-warning);
    --cmo-cta: var(--buld-cta);
    --cmo-on-accent: var(--buld-page);
    display: block;
    margin: 4px 0 24px;
    color: var(--buld-ink-1);
    font-size: 13px;
    line-height: 1.45;
}
html[data-buld-theme="light"] #callMode { --cmo-on-accent: var(--buld-elevated-2); }
html[data-buld-theme] #callMode *, html[data-buld-theme] #callMode *::before, html[data-buld-theme] #callMode *::after { box-sizing: border-box; }

/* ---------- layout: call sheet + queue ---------- */
html[data-buld-theme] #callMode .cmo-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
html[data-buld-theme] #callMode .cmo-main {
    background: var(--cmo-card); border: 1px solid var(--cmo-hair); border-radius: 20px; padding: 24px; min-width: 0;
}
html[data-buld-theme] #callMode .cmo-muted { color: var(--buld-ink-3); }
html[data-buld-theme] #callMode .cmo-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
html[data-buld-theme] #callMode .cmo-oid { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--buld-ink-1); }

/* status pill (tone from ORDER_STATUS) */
html[data-buld-theme] #callMode .cmo-pill {
    --c: var(--cmo-cta);
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; white-space: nowrap;
    border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
    background: color-mix(in srgb, var(--c) 16%, transparent);
    color: color-mix(in srgb, var(--c) 70%, var(--buld-ink-1));
}
html[data-buld-theme] #callMode .cmo-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
html[data-buld-theme] #callMode .cmo-pill[data-tone="success"] { --c: var(--cmo-ok); }
html[data-buld-theme] #callMode .cmo-pill[data-tone="warning"] { --c: var(--cmo-warn); }
html[data-buld-theme] #callMode .cmo-pill[data-tone="danger"]  { --c: var(--cmo-bad); }

/* client */
html[data-buld-theme] #callMode .cmo-who { display: flex; gap: 14px; align-items: center; margin-top: 16px; min-width: 0; }
html[data-buld-theme] #callMode .cmo-who-t { min-width: 0; }
html[data-buld-theme] #callMode .cmo-name { font-size: 20px; font-weight: 700; color: var(--buld-ink-1); overflow-wrap: anywhere; }
html[data-buld-theme] #callMode .cmo-av {
    --hue: 210;
    width: 30px; height: 30px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
    font-size: 11px; font-weight: 700; letter-spacing: .02em;
    color: hsl(var(--hue) 55% 32%); background: hsl(var(--hue) 70% 90%);
}
html[data-buld-theme="dark"] #callMode .cmo-av { color: hsl(var(--hue) 80% 88%); background: hsl(var(--hue) 40% 40%); }
html[data-buld-theme] #callMode .cmo-who .cmo-av { width: 44px; height: 44px; font-size: 14px; }
html[data-buld-theme] #callMode .cmo-av[data-hue="0"] { --hue: 0; }
html[data-buld-theme] #callMode .cmo-av[data-hue="1"] { --hue: 30; }
html[data-buld-theme] #callMode .cmo-av[data-hue="2"] { --hue: 60; }
html[data-buld-theme] #callMode .cmo-av[data-hue="3"] { --hue: 120; }
html[data-buld-theme] #callMode .cmo-av[data-hue="4"] { --hue: 170; }
html[data-buld-theme] #callMode .cmo-av[data-hue="5"] { --hue: 210; }
html[data-buld-theme] #callMode .cmo-av[data-hue="6"] { --hue: 250; }
html[data-buld-theme] #callMode .cmo-av[data-hue="7"] { --hue: 290; }

/* the number */
html[data-buld-theme] #callMode .cmo-ph {
    font-size: 30px; font-weight: 800; letter-spacing: .02em; margin: 10px 0 4px;
    font-variant-numeric: tabular-nums; color: var(--buld-ink-1); overflow-wrap: anywhere;
}

/* ---------- buttons (prototype .btn premium controls) ---------- */
html[data-buld-theme] #callMode .cmo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
html[data-buld-theme] #callMode .cmo-btn {
    height: 34px; padding: 0 13px; border-radius: 9px; display: inline-flex; align-items: center; gap: 7px;
    font: inherit; font-weight: 600; letter-spacing: -.005em; cursor: pointer; text-decoration: none; white-space: nowrap;
    border: 1px solid var(--cmo-line);
    background: linear-gradient(180deg, color-mix(in srgb, var(--buld-ink-1) 7%, transparent), color-mix(in srgb, var(--buld-ink-1) 2%, transparent)) var(--cmo-card);
    color: var(--buld-ink-1) !important;
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--buld-ink-1) 6%, transparent), 0 1px 2px color-mix(in srgb, var(--buld-page) 60%, transparent);
    transition: background-color .15s, border-color .15s, box-shadow .15s, transform .1s;
}
html[data-buld-theme] #callMode .cmo-btn:hover { background-color: var(--buld-hover); border-color: color-mix(in srgb, var(--buld-ink-1) 16%, transparent); }
html[data-buld-theme] #callMode .cmo-btn:active { transform: scale(.98); }
html[data-buld-theme] #callMode .cmo-btn:focus-visible { outline: 2px solid var(--cmo-cta); outline-offset: 2px; }
html[data-buld-theme] #callMode .cmo-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
html[data-buld-theme] #callMode .cmo-btn.is-p {
    background: linear-gradient(180deg, color-mix(in srgb, var(--cmo-cta) 80%, var(--buld-ink-1)), var(--cmo-cta)) !important;
    border-color: var(--cmo-cta); color: var(--buld-elevated-2) !important;
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--buld-ink-1) 25%, transparent), 0 6px 14px -8px var(--cmo-cta);
}
html[data-buld-theme="dark"] #callMode .cmo-btn.is-p { color: var(--buld-ink-1) !important; }
html[data-buld-theme] #callMode .cmo-btn.is-p:hover { filter: brightness(1.08); }
html[data-buld-theme] #callMode .cmo-btn.is-ok {
    background: linear-gradient(180deg, color-mix(in srgb, var(--cmo-ok) 82%, var(--buld-ink-1)), var(--cmo-ok));
    border-color: var(--cmo-ok); color: var(--cmo-on-accent) !important;
}
html[data-buld-theme] #callMode .cmo-btn.is-ok:hover { filter: brightness(1.06); }
html[data-buld-theme] #callMode .cmo-btn.is-bad { color: var(--cmo-bad) !important; }
html[data-buld-theme] #callMode .cmo-btn.is-bad:hover { background-color: color-mix(in srgb, var(--cmo-bad) 12%, transparent); border-color: color-mix(in srgb, var(--cmo-bad) 35%, transparent); }
html[data-buld-theme] #callMode .cmo-btn.is-ghost { background: transparent; box-shadow: none; border-color: transparent; }
html[data-buld-theme] #callMode .cmo-btn.is-ghost:hover { background: var(--buld-hover); }
html[data-buld-theme] #callMode .cmo-ico { width: 16px; height: 16px; flex: none; }

/* shortcut hints: discreet, right-aligned inside the big buttons */
html[data-buld-theme] #callMode .cmo-kbd {
    display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 5px; border: 1px solid currentColor; opacity: .38;
    font: 600 10.5px/1 inherit; font-family: inherit; background: transparent; color: inherit; box-shadow: none;
}
html[data-buld-theme] #callMode .cmo-acts .cmo-kbd, html[data-buld-theme] #callMode .cmo-nav .cmo-kbd { margin-inline-start: 4px; }
html[data-buld-theme] #callMode .cmo-count { font-variant-numeric: tabular-nums; opacity: .75; font-weight: 600; }

/* call script */
html[data-buld-theme] #callMode .cmo-script {
    background: var(--cmo-s2); border-radius: 12px; padding: 12px 14px; margin-top: 14px; color: var(--buld-ink-2);
    overflow-wrap: anywhere;
}
html[data-buld-theme] #callMode .cmo-script b { color: var(--buld-ink-1); }
html[data-buld-theme] #callMode .cmo-warn { color: var(--cmo-warn); }
html[data-buld-theme] #callMode .cmo-note { color: var(--buld-ink-3); }

/* the four decisions */
html[data-buld-theme] #callMode .cmo-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
html[data-buld-theme] #callMode .cmo-acts .cmo-btn { justify-content: center; height: auto; min-height: 48px; padding: 14px; font-size: 14px; white-space: normal; text-align: center; }
html[data-buld-theme] #callMode .cmo-nav { justify-content: space-between; margin-top: 14px; }
html[data-buld-theme] #callMode .cmo-keys {
    margin: 12px 0 0; font-size: 11px; color: var(--buld-ink-4); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px;
}
html[data-buld-theme] #callMode .cmo-keys .cmo-kbd { opacity: .6; }

/* ---------- queue ---------- */
html[data-buld-theme] #callMode .cmo-queue {
    background: var(--cmo-card); border: 1px solid var(--cmo-hair); border-radius: 14px; overflow: hidden;
    position: sticky; top: 84px;
}
html[data-buld-theme] #callMode .cmo-qh {
    margin: 0; padding: 12px 14px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: var(--buld-ink-3); border-bottom: 1px solid var(--cmo-hair); background: transparent;
}
html[data-buld-theme] #callMode .cmo-ql { max-height: calc(100vh - 200px); overflow: auto; scrollbar-width: thin; }
html[data-buld-theme] #callMode .cmo-qi {
    display: flex; width: 100%; gap: 10px; padding: 11px 12px; align-items: center; text-align: left;
    border: 0; border-bottom: 1px solid var(--cmo-hair); border-radius: 0; background: transparent; color: var(--buld-ink-1);
    font: inherit; cursor: pointer; box-shadow: none;
}
html[data-buld-theme] #callMode .cmo-qi:last-child { border-bottom: 0; }
html[data-buld-theme] #callMode .cmo-qi:hover { background: color-mix(in srgb, var(--buld-ink-1) 3.5%, transparent); }
html[data-buld-theme] #callMode .cmo-qi:focus-visible { outline: 2px solid var(--cmo-cta); outline-offset: -2px; }
html[data-buld-theme] #callMode .cmo-qi.is-sel { background: color-mix(in srgb, var(--cmo-cta) 18%, transparent); box-shadow: inset 3px 0 0 var(--cmo-cta); }
html[data-buld-theme] #callMode .cmo-qm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
html[data-buld-theme] #callMode .cmo-qm b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
html[data-buld-theme] #callMode .cmo-qm .cmo-muted { font-size: 12px; }

/* ---------- empty ---------- */
html[data-buld-theme] #callMode .cmo-empty {
    padding: 40px; text-align: center; color: var(--buld-ink-3); border: 1px dashed var(--cmo-line); border-radius: 14px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
html[data-buld-theme] #callMode .cmo-empty b { color: var(--buld-ink-1); font-size: 14px; }
html[data-buld-theme] #callMode .cmo-empty .cmo-ico { width: 22px; height: 22px; color: var(--buld-ink-3); margin-bottom: 4px; }
.cmo-hidden { position: fixed; left: -9999px; opacity: 0; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
    html[data-buld-theme] #callMode .cmo-grid { grid-template-columns: minmax(0, 1fr); }
    html[data-buld-theme] #callMode .cmo-queue { position: static; }
    html[data-buld-theme] #callMode .cmo-ql { max-height: 360px; }
    html[data-buld-theme] #callMode .cmo-keys { display: none; }
}
@media (max-width: 520px) {
    html[data-buld-theme] #callMode .cmo-main { padding: 18px 16px; border-radius: 16px; }
    html[data-buld-theme] #callMode .cmo-ph { font-size: 26px; }
    html[data-buld-theme] #callMode .cmo-row:not(.cmo-nav) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    html[data-buld-theme] #callMode .cmo-row:not(.cmo-nav) > .cmo-btn { justify-content: center; min-width: 0; }
    html[data-buld-theme] #callMode .cmo-kbd { display: none; }
    html[data-buld-theme] #callMode .cmo-acts { gap: 8px; }
    html[data-buld-theme] #callMode .cmo-acts .cmo-btn { padding: 12px 8px; font-size: 13px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
    html[data-buld-theme] #callMode .cmo-btn { transition: none; }
    html[data-buld-theme] #callMode .cmo-btn:active { transform: none; }
}
