/* atheer-ux-fixes.css — 25/11/2026 · CSS-only fixes from the Impeccable trial on «التحويلات» (owner: «ابدأ بالإصلاحات الآمنة»).
 * Loaded LAST in index.html. Display-only: no element is hidden, no action removed, no JS touched.
 * Rollback = delete the <link> line (or this file). */

/* 1 · Metric cards with no click action are <button disabled> (metric-card.js) and inherit
 *     base.css `button:disabled{opacity:.55}` ⇒ whole card faded (label ≈2.9:1). They are information, not
 *     disabled controls: full opacity, normal cursor. Hover rules already use :not(:disabled), so no hover appears. */
.at-metric-card:disabled { opacity: 1; cursor: default; }

/* 2 · Arabic labels: no letter-spacing / uppercase (spacing breaks Arabic letter joining), and the 11px
 *     table header gets one step up to stay readable. English keeps its current style. */
[dir="rtl"] .at-metric-card__label,
[lang="ar"] .at-metric-card__label,
[dir="rtl"] .at-grid__th,
[lang="ar"] .at-grid__th { letter-spacing: 0; text-transform: none; }
[dir="rtl"] .at-grid__th,
[lang="ar"] .at-grid__th { font-size: 12px; }

/* 3 · Keyboard focus ring: the old one is a pale 18% blue glow (≈1.3:1). Now a 2px gap in the surface colour
 *     + 2px solid accent ring (≥3:1). Only :focus-visible (keyboard), so mouse clicks look as before.
 *     Inputs keep their own focus style (border colour), untouched. */
:root { --at-focus-ring: 0 0 0 2px var(--at-surface-1, #fff), 0 0 0 4px var(--at-accent, #1278e0); }
/* the toolbar's own `.at-listpage__toolbar .at-btn[data-variant=…]` (0,3,0, cells.css) set box-shadow and silently
 * erased ANY focus ring there — the extra selectors below outrank it (0,4,0). */
.at-btn:focus-visible,
.at-btn[data-variant]:focus-visible,
.at-listpage__toolbar .at-btn[data-variant]:focus-visible,
.btn:focus-visible,
.at-metric-card:focus-visible,
.at-grid__th:focus-visible,
a:focus-visible,
button:focus-visible:not(.at-input) { outline: none; box-shadow: var(--at-focus-ring); }
.at-btn[data-variant="danger"]:focus-visible,
.at-listpage__toolbar .at-btn[data-variant="danger"]:focus-visible {
  box-shadow: 0 0 0 2px var(--at-surface-1, #fff), 0 0 0 4px var(--at-danger, #dc2626);
}

/* 4 · uxfix3 (25/11): the extension metric cards are filters now — the active one shows an accent ring
 *     and tinted surface; aria-pressed is the single source of the look (set by extensions.js). */
.at-listpage__metrics .at-metric-card[aria-pressed] { cursor: pointer; }
.at-listpage__metrics .at-metric-card[aria-pressed="true"] {
  border-color: var(--at-accent, #1278e0);
  box-shadow: inset 0 0 0 1px var(--at-accent, #1278e0);
  background: color-mix(in srgb, var(--at-accent, #1278e0) 7%, var(--at-surface-1, #fff));
}
.at-listpage__metrics .at-metric-card[aria-pressed="true"]:focus-visible {
  box-shadow: inset 0 0 0 1px var(--at-accent, #1278e0), var(--at-focus-ring);
}

/* 5 · uxfix5 (25/11): «التحويلات» toolbar — three groups that wrap as whole units (no orphaned «حذف»),
 *     a wider gap between groups than inside them (no divider line: it would dangle at the start of a wrapped row),
 *     a live selection count, and «حذف» turns danger-coloured only once it can act.
 *     Classes are new (.at-tb-*) ⇒ no other page is affected. */
.at-tb-group { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.at-listpage__toolbar-left:has(> .at-tb-group) { column-gap: 20px; row-gap: 8px; }
.at-tb-selcount {
  font-size: 12.5px; color: var(--at-text-muted, #64748b); white-space: nowrap;
  font-variant-numeric: tabular-nums; padding-inline: 2px 4px; min-inline-size: 5.5em;
}
.at-tb-group--sel[data-active] .at-tb-selcount { color: var(--at-accent, #1278e0); font-weight: 600; }
.at-listpage__toolbar .at-btn[data-tb-delete]:not(:disabled) { color: var(--at-danger, #dc2626); }
.at-listpage__toolbar .at-btn[data-tb-delete]:not(:disabled):hover {
  border-color: var(--at-danger, #dc2626);
  background: color-mix(in srgb, var(--at-danger, #dc2626) 6%, var(--at-surface-1, #fff));
}

/* 6 · uxfix7 (26/11): the call bars — owner: «اريد شكل الموجود في المتصفح … بدل المربع».
 *     The incoming bar (.sip-overlay) is a rounded capsule with round buttons (kept round on 22/10 by the owner's
 *     choice). The outgoing / in-call bar (.sip-incall) used the same capsule in softphone.js, but atheer-square.css
 *     squared it (its exception list only names sip-overlay) ⇒ square bar, square red hang-up, square quality button.
 *     Here both bars share the capsule look, on desktop and phone. The doubled class (0,2,0) outranks that rule (0,1,0).
 *     The quality pop-up card stays square like the rest of the system. */
.sip-incall.sip-incall { border-radius: 9999px !important; }
.sip-incall__end.sip-incall__end,
.sip-quality.sip-quality { border-radius: 50% !important; }

/* Phone (same breakpoint as atheer-mobile.css): both bars span the screen with an equal 12px margin instead of a
 * fixed 320px block pinned 24px from one edge (off-centre, and a hair from the other edge on a 360px phone).
 * The top one clears the notch, the bottom one the home bar. Dragging still works: it writes inline left/top/right. */
@media (max-width: 768px) {
  /* softphone.js injects its <style> AFTER this file, so equal specificity would lose — classes are doubled. */
  .sip-overlay.sip-overlay, .sip-incall.sip-incall {
    inset-inline: 12px; min-width: 0; max-width: none; width: auto;
  }
  .sip-overlay.sip-overlay { inset-block-start: calc(12px + env(safe-area-inset-top, 0px)); }
  .sip-incall.sip-incall   { inset-block-end: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .sip-overlay__cli.sip-overlay__cli { max-width: none; }
  .sip-incall__who.sip-incall__who, .sip-incall__num.sip-incall__num { max-width: none; }
  /* the answer / reject / hang-up buttons get a thumb-sized target on a phone */
  .sip-overlay__btn.sip-overlay__btn { width: 48px; height: 48px; }
  .sip-incall__end.sip-incall__end   { width: 46px; height: 46px; }
}

/* 7 · uxfix10 (26/11): the «عمليات / Operations» column stays in view.
 *     Measured: «طوابير الاتصال» has 12 columns ⇒ the table is 1080px; on a 1280px laptop its box is 958px, so the
 *     column that holds Edit and Delete sat 97px past the edge (on a phone 715px past it) and the only way to edit a
 *     queue was to find and drag a horizontal scrollbar. 23 grids on 19 pages end with the same column (id "ops").
 *     data-grid.js puts data-col on the header cell only, so the body cells are reached as "the last cell of a table
 *     whose last header is ops" — a grid without that column is untouched.
 *     When the table fits, position: sticky does nothing — the only visible change is the thin separator line.
 *     The header keeps its sticky top (vireo-redesign) — both insets apply. Opaque background so scrolled cells
 *     pass UNDER the column. Logical inset ⇒ the left edge in Arabic, the right edge in English. */
.at-grid__th[data-col="ops"]:last-child,
.at-grid__table:has(.at-grid__th[data-col="ops"]:last-child) .at-grid__td:last-child {
  position: sticky;
  inset-inline-end: 0;
  border-inline-start: 1px solid var(--at-border, #e2e8f0);
}
.at-grid__th[data-col="ops"]:last-child { z-index: 3; }
.at-grid__table:has(.at-grid__th[data-col="ops"]:last-child) .at-grid__td:last-child { z-index: 1; }
/* The opaque fill sits at zero specificity (:where) so the row's own hover and selected colours — set on the cells
 * by cells.css and the selection rule — still win on this cell exactly as on its neighbours. */
:where(.at-grid__table:has(.at-grid__th[data-col="ops"]:last-child) .at-grid__td:last-child) {
  background: var(--at-surface-1, #fff);
}
