/* Card holds add-on (addons/cardholds) — the staff terminal: Authorization, Completion, Extension, Void and the
   Transactions log. Mobile-first (375 px first, wider on a phone in landscape and on a desktop), built on the
   app's own design tokens (--panel, --ink, --line, --primary …) so dark mode and company themes apply too.
   Loaded from public/index.html; the screens live in public/js/addon-cardholds.js. */
.ch-wrap { display: flex; flex-direction: column; gap: 12px; max-width: 520px; margin: 0 auto; }
.ch-wrap.ch-wide { max-width: 900px; }

/* ---------- header ---------- */
.ch-top { display: flex; align-items: center; gap: 10px; background: var(--primary); color: var(--primary-ink); border-radius: var(--radius); padding: 10px 14px; }
.ch-top .ch-titles { flex: 1; min-width: 0; text-align: center; line-height: 1.2; }
.ch-top .ch-ar { display: block; direction: rtl; font-size: 17px; font-weight: 600; }
.ch-top .ch-en { display: block; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; opacity: .9; }
.ch-top .ch-ic { background: none; border: 0; color: inherit; padding: 6px; border-radius: 8px; cursor: pointer; display: inline-flex; }
.ch-top .ch-ic:active { background: rgba(255, 255, 255, .22); }
.ch-top .ch-ic svg { width: 22px; height: 22px; }
.ch-test { align-self: center; background: #ffb02e; color: #3b2500; border-radius: 10px; padding: 2px 9px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- home tiles ---------- */
.ch-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ch-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 10px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-align: center; color: var(--ink-2); font: inherit; cursor: pointer; min-height: 128px; }
.ch-tile:hover, .ch-tile:focus-visible { border-color: var(--primary); background: var(--panel-2); }
.ch-tile svg { width: 38px; height: 38px; color: var(--primary); }
.ch-tile .ch-ar { direction: rtl; font-size: 15.5px; color: var(--ink); }
.ch-tile .ch-en { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
.ch-tile.ch-wide { grid-column: span 2; min-height: 78px; flex-direction: row; gap: 14px; }
.ch-count { background: var(--primary); color: var(--primary-ink); border-radius: 10px; padding: 1px 8px; font-size: 11px; }

/* ---------- amount / keypad ---------- */
.ch-label { text-align: center; color: var(--ink-2); }
.ch-label .ch-en { display: block; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.ch-label .ch-ar { display: block; direction: rtl; font-size: 16px; color: var(--ink); }
.ch-amount { border: 2px solid var(--primary); border-radius: 8px; background: var(--panel); padding: 12px; min-height: 68px; display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: clamp(28px, 9vw, 38px); font-variant-numeric: tabular-nums; color: var(--ink); }
.ch-amount .ch-cur { font-size: .5em; color: var(--ink-3); }
.ch-amount .ch-caret { width: 2px; height: 1.1em; background: var(--primary); animation: ch-blink 1s steps(1) infinite; }
@keyframes ch-blink { 50% { opacity: 0; } }
.ch-hint { text-align: center; font-size: 12.5px; color: var(--ink-3); min-height: 18px; }
.ch-hint.ch-err { color: var(--bad); }
.ch-ref { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; font: inherit; font-size: 15px; background: var(--panel); color: var(--ink); }
.ch-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ch-key { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 13px 0; font: inherit; font-size: 24px; color: var(--ink); cursor: pointer; }
.ch-key:active { background: var(--panel-2); }
.ch-key.ch-fn { font-size: 15px; color: var(--ink-2); }
.ch-btn { border: 0; border-radius: 12px; padding: 14px; width: 100%; font: inherit; font-size: 15.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ch-btn.ch-primary { background: var(--primary); color: var(--primary-ink); }
.ch-btn.ch-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.ch-btn.ch-danger { background: var(--bad); color: #fff; }
.ch-btn:disabled { opacity: .55; cursor: default; }
.ch-btn .ch-ar { direction: rtl; font-weight: 500; opacity: .9; }

/* ---------- QR / result ---------- */
.ch-qr { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; width: min(290px, 80vw); margin: 0 auto; }
.ch-qr svg { width: 100%; height: auto; display: block; }
.ch-big { text-align: center; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ch-big small { font-size: 15px; color: var(--ink-3); font-weight: 500; }
.ch-steps { text-align: center; color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.ch-steps .ch-ar { display: block; direction: rtl; color: var(--ink-3); }
.ch-pulse { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--primary); font-size: 13.5px; }
.ch-pulse i { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: ch-p 1.2s infinite; }
@keyframes ch-p { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.ch-result { text-align: center; }
.ch-badge { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; font-size: 38px; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.ch-badge.ch-warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.ch-badge.ch-bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.ch-result h2 { margin: 0; font-size: 20px; }
.ch-result .ch-ar { direction: rtl; color: var(--ink-2); font-size: 17px; margin: 2px 0 8px; }
.ch-receipt { background: var(--panel); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.ch-receipt > div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.ch-receipt > div:last-child { border-bottom: 0; }
.ch-receipt span:first-child { color: var(--ink-3); }
.ch-receipt span:last-child { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ch-note { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.45; }
.ch-body { display: flex; flex-direction: column; gap: 12px; }

/* ---------- lists ---------- */
.ch-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.ch-toolbar input, .ch-toolbar select { flex: 1 1 140px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 14px; background: var(--panel); color: var(--ink); }
.ch-list { display: flex; flex-direction: column; gap: 10px; }
.ch-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; font: inherit; color: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; cursor: pointer; }
.ch-item.ch-static { cursor: default; }
.ch-item:hover { border-color: var(--primary); }
.ch-item .ch-amt { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ch-item .ch-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.45; }
.ch-pill { font-size: 11px; border-radius: 10px; padding: 2px 8px; white-space: nowrap; background: var(--panel-2); color: var(--ink-2); }
.ch-pill.ch-ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.ch-pill.ch-info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.ch-pill.ch-warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.ch-pill.ch-bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.ch-apple { display: inline-flex; align-items: center; background: #000; color: #fff; border-radius: 6px; padding: 1px 7px; font-size: 11px; }
.ch-empty { text-align: center; color: var(--ink-3); padding: 28px 10px; font-size: 14px; }
.ch-empty .ch-ar { display: block; direction: rtl; margin-top: 4px; }
.ch-spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: ch-spin .8s linear infinite; margin: 26px auto; }
@keyframes ch-spin { to { transform: rotate(360deg); } }

/* ---------- settings ---------- */
.ch-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; }
.ch-settings label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.ch-settings input, .ch-settings select { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 14px; background: var(--panel); color: var(--ink); }
.ch-settings .ch-check { flex-direction: row; align-items: center; gap: 8px; }
.ch-settings .ch-check input { width: 18px; height: 18px; }
.ch-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ch-actions .ch-btn { width: auto; padding: 10px 14px; font-size: 14px; }
.ch-status { font-size: 12.5px; color: var(--ink-2); }
.ch-status.ch-ok { color: var(--ok); }
.ch-status.ch-err { color: var(--bad); }

@media (min-width: 720px) {
  .ch-tiles { grid-template-columns: repeat(3, 1fr); }
  .ch-tile.ch-wide { grid-column: span 3; }
  .ch-keypad { gap: 10px; }
}
@media (max-width: 380px) {
  .ch-tile { min-height: 112px; padding: 14px 8px 12px; }
  .ch-key { padding: 11px 0; font-size: 22px; }
}
a.ch-btn { text-decoration: none; box-sizing: border-box; }
