/* ==========================================================================
   Udeyou OTP: app shell (views/dashboard.php, views/admin.php)
   Builds on style.css tokens (light + [data-theme="dark"]).
   Shared components used here and defined in style.css: .btn, .badge, .tag,
   .alert(.banner/.has-icon), .table-wrap, .icon-tile, .code-window, .chart-card,
   .empty, .eyebrow, forms. Everything below is app-specific.
   ========================================================================== */

/* ---------- 1. Page ---------- */
.page-dashboard .site-main,
.page-admin .site-main {
  background:
    radial-gradient(900px 320px at 85% -120px, rgba(51, 88, 255, .09), transparent 70%),
    radial-gradient(700px 280px at 0% -140px, rgba(34, 199, 232, .07), transparent 70%),
    var(--bg);
}
[data-theme="dark"] .page-dashboard .site-main,
[data-theme="dark"] .page-admin .site-main { background: transparent; }
.page-dashboard .page-body,
.page-admin .page-body { padding-block: 28px 72px; }

/* ---------- 2. Shell: sidebar + content ---------- */
.shell {
  display: grid; grid-template-columns: 236px minmax(0, 1fr);
  gap: 28px; align-items: start;
}
.shell-main { min-width: 0; }

.side-nav {
  position: sticky; top: calc(var(--header-h) + 20px);
  display: flex; flex-direction: column; gap: 2px;
  max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto;
  padding: 14px 12px 12px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
}
.side-account {
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 10px; padding: 6px 6px 14px;
  border-bottom: 1px solid var(--line);
}
.side-account > div { min-width: 0; line-height: 1.45; }
.side-account b {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14.5px; color: var(--heading);
}
.side-account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--muted); }
.side-avatar {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 11px;
  font-size: 17px; font-weight: 700; color: #fff;
  background: var(--grad);
  box-shadow: 0 8px 18px -10px rgba(51, 88, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.side-avatar.is-admin { color: var(--cyan-300); background: linear-gradient(145deg, var(--ink-800), var(--ink-950)); }
.side-avatar svg { width: 20px; height: 20px; }
.side-label {
  padding: 6px 12px 6px;
  font-size: 12px; font-weight: 600; color: var(--subtle);
}
.side-link {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  min-height: 42px; padding: 8px 12px; border-radius: 10px;
  color: var(--text); font-size: 14.5px; font-weight: 500;
  transition: background-color .15s, color .15s;
}
.side-link > svg { width: 19px; height: 19px; flex: none; color: var(--subtle); transition: color .15s; }
.side-link > span { min-width: 0; }
.side-link:hover { background: var(--hover); color: var(--heading); text-decoration: none; }
.side-link:hover > svg { color: var(--brand); }
.side-link.on {
  background: var(--brand-50); color: var(--brand-700); font-weight: 600;
}
.side-link.on > svg { color: var(--brand); }
.side-link.on::before {
  content: ""; position: absolute; inset-block: 9px; inset-inline-start: -12px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--grad);
}
.side-count {
  margin-inline-start: auto; min-width: 22px; padding: 0 7px;
  border-radius: var(--radius-pill);
  font: 600 12px/22px var(--font-sans); font-style: normal; text-align: center;
  color: var(--warn-text); background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line);
}
.side-foot {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--line);
}
.side-foot form { margin: 0; }
.side-mini {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 9px;
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  transition: background-color .15s, color .15s;
}
.side-mini svg { width: 16px; height: 16px; flex: none; }
.side-mini:hover { background: var(--hover); color: var(--heading); text-decoration: none; }
button.side-mini.as-btn {
  width: 100%; border: 0; background: none; cursor: pointer;
  font: 500 13.5px/1.6 var(--font-sans); text-align: start;
}
[data-theme="dark"] .side-nav { background: rgba(10, 16, 48, .82); }
[data-theme="dark"] .side-link.on { color: #DCE4FF; background: rgba(51, 88, 255, .18); }
[data-theme="dark"] .side-link.on > svg, [data-theme="dark"] .side-link:hover > svg { color: var(--brand-300); }

.app-section { scroll-margin-top: 8px; }

/* ---------- 3. Flash toasts ---------- */
.app-flash {
  position: fixed; z-index: 150; bottom: 20px; inset-inline-end: 20px;
  display: flex; flex-direction: column; gap: 10px;
  width: min(440px, calc(100vw - 32px));
}
.app-flash .alert {
  margin: 0; padding-inline-end: 46px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.app-flash .alert.ok { background: var(--ok-bg); }
.app-flash .alert.error { background: var(--danger-bg); }
[data-theme="dark"] .app-flash .alert.ok { background: #0B2A2A; }
[data-theme="dark"] .app-flash .alert.error { background: #2A1020; }
.flash-close {
  position: absolute; top: 9px; inset-inline-end: 9px;
  display: grid; place-items: center; width: 30px; height: 30px;
  border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; opacity: .7;
  transition: opacity .15s, background-color .15s;
}
.flash-close:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
[data-theme="dark"] .flash-close:hover { background: rgba(255, 255, 255, .08); }
.flash-close svg { width: 16px; height: 16px; }
@media (prefers-reduced-motion: no-preference) {
  .app-flash .alert { animation: app-toast .38s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes app-toast { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}

/* ---------- 4. Banners (suspension, trial, zero balance) ---------- */
.app-banner { margin-bottom: 16px; flex-wrap: nowrap; align-items: center; }
.app-banner .banner-ic {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.app-banner .banner-ic svg { width: 19px; height: 19px; }
[data-theme="dark"] .app-banner .banner-ic { background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.app-banner .banner-copy { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.85; }
.app-banner > .btn { flex: none; }
.alert.banner.info.trial-banner { color: var(--text); }
.trial-banner .banner-ic { color: var(--brand); }
[data-theme="dark"] .trial-banner .banner-ic { color: var(--brand-300); }
.trial-banner b { color: var(--heading); }
.trial-meter {
  display: block; height: 5px; margin-top: 10px; max-width: 360px;
  border-radius: 99px; background: rgba(51, 88, 255, .14); overflow: hidden;
}
.trial-meter i { display: block; height: 100%; border-radius: inherit; background: var(--grad); }

/* ---------- 5. Page head ---------- */
.dash-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 18px 28px; margin: 6px 0 22px;
}
.dash-head .who { display: flex; align-items: center; gap: 16px; min-width: 0; }
.who-copy { min-width: 0; }
.dash-head .eyebrow { margin-bottom: 4px; font-size: 13.5px; }
.dash-head h1 { font-size: clamp(23px, 2.4vw, 29px); line-height: 1.35; overflow-wrap: anywhere; }
.dash-head .sub {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 4px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere;
}
.dash-avatar {
  display: grid; place-items: center; flex: none;
  width: 60px; height: 60px; border-radius: 18px;
  font-size: 26px; font-weight: 700; color: #fff;
  background: var(--grad);
  box-shadow: 0 14px 30px -14px rgba(51, 88, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.dash-avatar-admin {
  color: var(--cyan-300);
  background:
    radial-gradient(60px 60px at 30% 20%, rgba(51, 88, 255, .55), transparent 70%),
    linear-gradient(145deg, var(--ink-800), var(--ink-950));
  box-shadow: 0 14px 30px -14px rgba(10, 16, 48, .8), inset 0 0 0 1px rgba(138, 162, 255, .2);
}
.dash-avatar svg { width: 28px; height: 28px; }
.state-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 1px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; line-height: 1.7;
}
.state-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state-chip.on { color: var(--ok-text); background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--ok-line); }
.state-chip.off { color: var(--danger-text); background: var(--danger-bg); box-shadow: inset 0 0 0 1px var(--danger-line); }
.dash-head-side { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dash-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.credits-pill {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 36px; padding: 4px 14px 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 500; color: var(--brand-700);
  background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand-100);
}
.credits-pill svg { width: 18px; height: 18px; color: var(--brand); }
.credits-pill b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
a.credits-pill:hover { text-decoration: none; filter: saturate(1.15); }
.credits-pill.is-warn { color: var(--warn-text); background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); }
.credits-pill.is-warn svg { color: currentColor; }
[data-theme="dark"] .credits-pill:not(.is-warn) { color: #DCE4FF; }
[data-theme="dark"] .credits-pill:not(.is-warn) svg { color: var(--brand-300); }

/* ---------- 6. Panels ---------- */
.panel {
  container: panel / inline-size;
  position: relative; margin-bottom: 20px; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .panel { box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .03); }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 20px; padding: 22px 24px 20px;
}
.panel-head > div { min-width: 0; flex: 1 1 320px; }
.panel-head h2 { font-size: 19px; line-height: 1.4; margin: 0; }
.panel-head p { margin-top: 5px; max-width: 760px; font-size: 14px; line-height: 1.8; color: var(--muted); }
.panel-head > .badge, .panel-head > .btn, .panel-head > .panel-note { flex: none; }
.panel-eyebrow {
  display: block; margin-bottom: 4px;
  font: 600 12px/1.6 var(--font-sans); letter-spacing: .01em; color: var(--brand);
}
[data-theme="dark"] .panel-eyebrow { color: var(--brand-300); }
.panel-note {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--subtle);
}
.panel-note svg { width: 15px; height: 15px; }
.panel-body { padding: 0 24px 24px; }
.panel-body .chart-card { margin-top: 16px; }
.panel > .table-wrap {
  border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; background: transparent;
}
.panel-empty { margin: 0 24px 24px; padding: 34px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
.panel .empty .icon-tile { display: grid; margin: 0 auto 12px; }
.sub-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 18px 24px 12px; border-top: 1px solid var(--line);
}
.sub-head h3 { font-size: 15.5px; margin: 0; }

/* ---------- 7. Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-grid.stat-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; min-width: 0;
  padding: 18px 20px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.stat-card:not(.is-feature):hover { border-color: var(--brand-200); box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.stat-value {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  margin-top: 10px;
  font: 700 32px/1.15 var(--font-sans); letter-spacing: -.015em;
  color: var(--heading); font-variant-numeric: tabular-nums;
}
.stat-rate {
  padding: 1px 9px; border-radius: var(--radius-pill);
  font: 600 12.5px/1.7 var(--font-mono); letter-spacing: 0;
  color: var(--ok-text); background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--ok-line);
}
.stat-note { display: block; margin-top: 6px; font-size: 13px; line-height: 1.6; color: var(--subtle); }
.stat-meter { display: block; height: 4px; margin-top: 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.stat-meter i { display: block; height: 100%; border-radius: inherit; background: var(--grad); }
.stat-card.is-warn { border-color: var(--danger-line); }
.stat-card.is-feature {
  border-color: transparent; color: var(--on-dark-muted);
  background:
    radial-gradient(340px 200px at 0% 0%, rgba(51, 88, 255, .5), transparent 70%),
    radial-gradient(300px 180px at 100% 110%, rgba(34, 199, 232, .26), transparent 70%),
    var(--ink-900);
  box-shadow: 0 18px 40px -22px rgba(10, 16, 48, .65);
}
.stat-card.is-feature::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 80% 20%, #000, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 80% at 80% 20%, #000, transparent 75%);
}
.stat-card.is-feature > * { position: relative; z-index: 1; }
.stat-card.is-feature .stat-label { color: rgba(222, 229, 255, .82); }
.stat-card.is-feature .stat-value { color: #fff; }
.stat-card.is-feature .stat-note { color: var(--on-dark-muted); }
.stat-card.is-feature .icon-tile { color: #fff; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
[data-theme="dark"] .stat-card:not(.is-feature) { background: linear-gradient(180deg, #0D1438 0%, #0A1030 100%); }
[data-theme="dark"] .stat-card:not(.is-feature):hover { border-color: rgba(138, 162, 255, .3); }
[data-theme="dark"] .stat-card.is-feature {
  background:
    radial-gradient(340px 200px at 0% 0%, rgba(51, 88, 255, .55), transparent 70%),
    radial-gradient(300px 180px at 100% 110%, rgba(34, 199, 232, .25), transparent 70%),
    #121A44;
  box-shadow: inset 0 0 0 1px rgba(138, 162, 255, .22), 0 18px 40px -22px rgba(0, 0, 0, .8);
}
[data-theme="dark"] .stat-card.is-feature .icon-tile { color: #fff; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }

/* ---------- 8. Data tables inside panels ---------- */
.data-table th { padding: 11px 16px; }
.data-table td { padding: 13px 16px; }
.data-table th:first-child, .data-table td:first-child { padding-inline-start: 24px; }
.data-table th:last-child, .data-table td:last-child { padding-inline-end: 24px; }
.data-table td { white-space: nowrap; }
.data-table .note-cell { white-space: normal; min-width: 140px; max-width: 260px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.data-table .num-cell { font-variant-numeric: tabular-nums; }
.data-table .mono-cell { font: 600 13px/1.5 var(--font-mono); color: var(--subtle); }
.data-table .cell-action { text-align: end; }
.data-table .cell-action form { display: inline; margin: 0; }
.data-table tr.empty-row td { padding: 0; white-space: normal; }
.data-table tr.empty-row:hover td { background: none; box-shadow: none; }
.data-table .empty { padding: 36px 20px; }
.data-table .email-cell .c-email { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
code.key-prefix { font-size: 12.5px; padding: .2em .55em; white-space: nowrap; }
code.tid { font-size: 12.5px; padding: .2em .55em; }
tr.revoked td.cell-action, tr.revoked td.cell-form { opacity: 1; }
tr.revoked .key-prefix { text-decoration: line-through; text-decoration-color: currentColor; }
.client-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.5; }
.client-cell b { font-weight: 600; color: var(--heading); white-space: normal; }
.client-mail { font-size: 12.5px; color: var(--muted); text-align: start; unicode-bidi: plaintext; overflow-wrap: anywhere; white-space: normal; }
.data-table td > .client-cell { min-width: 180px; }
.admin-chip {
  display: inline-flex; align-items: center; margin-inline-start: 6px; padding: 0 8px;
  border-radius: var(--radius-pill); vertical-align: 1px;
  font-size: 11.5px; font-weight: 600; line-height: 20px;
  color: var(--brand-700); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand-100);
}
[data-theme="dark"] .admin-chip { color: #DCE4FF; }
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.receipt-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 600;
}
.receipt-link svg { width: 15px; height: 15px; }
.admin-note { margin-top: 4px; font-size: 12.5px; color: var(--text); }
.due { margin-top: 3px; font-size: 12px; color: var(--subtle); }
.due.late { color: var(--danger-text); font-weight: 600; }
.orders-table tr.is-review td:first-child { box-shadow: inset -3px 0 0 var(--brand); }
.orders-table tr.is-open:not(.is-review) td:first-child { box-shadow: inset -3px 0 0 var(--warn); }
[data-theme="dark"] .orders-table tr.is-review td:first-child { box-shadow: inset -3px 0 0 var(--brand-300); }

/* Approve / reject */
.order-actions { display: inline-flex; align-items: flex-start; gap: 6px; text-align: start; }
.order-actions .btn.small { min-height: 34px; }
/* Reject reason: a native popover dialog (top layer, light-dismiss, no clipping) */
.reject-pop {
  inset: 0; margin: auto; width: min(400px, calc(100vw - 32px)); height: fit-content; max-height: calc(100vh - 32px);
  padding: 0; overflow: auto;
  color: var(--text); text-align: start; white-space: normal;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}
.reject-pop::backdrop { background: rgba(6, 10, 28, .45); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.data-table .cell-action .reject-form { display: block; padding: 20px; }
.reject-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.reject-head h3 { margin: 0; font-size: 17px; }
.reject-head p { margin-top: 2px; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.reject-form label { margin-bottom: 16px; font-size: 13.5px; }
.reject-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.reject-actions .btn { flex: 1 1 auto; }
[data-theme="dark"] .reject-pop { background: var(--surface-3); }
/* Browsers without the popover API show the form inline under the buttons */
@supports not selector(:popover-open) {
  .reject-pop { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
}

/* Credits form (admin clients) */
.credit-form { flex-wrap: nowrap; }
.panel .data-table .credit-form.row > input.short:not([type="hidden"]) { flex: 0 0 auto; height: 36px; min-height: 36px; max-width: none; padding: 0 10px; font-size: 14px; }
.panel .data-table .credit-form.row > input[type="number"].short:not([type="hidden"]) { width: 100px; }
.panel .data-table .credit-form.row > input:not([type="number"]).short:not([type="hidden"]) { width: 140px; }

/* ---------- 9. API keys ---------- */
.key-form {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto; align-items: end; gap: 12px;
  margin: 0; padding: 18px 24px 20px;
  background: var(--surface-2); border-top: 1px solid var(--line);
}
.key-form label { margin: 0; font-size: 13px; }
.key-form input, .key-form select { background-color: var(--input-bg); }
.key-form .btn { min-height: 46px; }

.new-key {
  margin: 0 24px 20px; padding: 18px;
  background: linear-gradient(180deg, var(--ok-bg) 0%, var(--surface) 100%);
  border: 1px solid var(--ok-line); border-radius: var(--radius);
  box-shadow: 0 0 0 4px rgba(18, 185, 129, .06);
}
.new-key-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.new-key-head b { display: block; font-size: 15px; color: var(--ok-text); }
.new-key-head span:not(.icon-tile) { display: block; margin-top: 2px; font-size: 13.5px; color: var(--muted); }
.copy-field { display: flex; gap: 8px; }
.copy-field input {
  flex: 1; min-width: 0; margin-top: 0;
  font: 500 14px/1.5 var(--font-mono); color: var(--heading);
}
.app-copy { flex: none; min-height: 46px; }
.app-copy.is-copied, .app-copy.is-copied:hover { background: var(--ok); box-shadow: 0 8px 18px -8px rgba(18, 185, 129, .7); }

/* ---------- 10. Quick start ---------- */
.qs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 0 24px 24px; }
.qs-step { min-width: 0; }
.qs-label { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14.5px; font-weight: 600; color: var(--heading); }
.qs-num {
  display: grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 7px;
  font: 600 12px/1 var(--font-mono); color: #fff; background: var(--grad);
  box-shadow: 0 6px 14px -6px rgba(51, 88, 255, .8);
}
.qs-code { border-radius: 14px; box-shadow: 0 0 0 1px rgba(3, 8, 30, .3), 0 20px 44px -26px rgba(3, 8, 30, .7); }
.qs-code .code-window-bar { min-height: 42px; padding: 0 8px 0 14px; gap: 12px; }
.qs-file { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px var(--font-mono); color: rgba(201, 212, 245, .66); }
.qs-pre {
  margin: 0; padding: 16px 18px 18px; overflow-x: auto;
  background: none; border: 0; border-radius: 0;
  font: 13px/1.85 var(--font-mono); color: #C9D4F5; white-space: pre;
}
[data-theme="dark"] .qs-pre { background: none; }
.qs-copy {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 28px; margin-left: auto; padding: 0 10px;
  font: 500 12.5px/1 var(--font-sans); color: rgba(201, 212, 245, .82);
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .12); border-radius: 7px;
  cursor: pointer; transition: background-color .15s, color .15s, border-color .15s;
}
.qs-copy svg { width: 14px; height: 14px; }
.qs-copy:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.qs-copy.is-copied { color: #4BE3A4; border-color: rgba(18, 185, 129, .4); background: rgba(18, 185, 129, .12); }

/* ---------- 11. Orders: request form ---------- */
.order-form {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; align-items: end; gap: 12px;
  margin: 0; padding: 18px 24px 20px;
  background: var(--surface-2); border-top: 1px solid var(--line);
}
.order-form label { margin: 0; font-size: 13px; }
.order-form input, .order-form select { background-color: var(--input-bg); }
.order-form .btn { min-height: 46px; }
.order-form:has(#order-credits-wrap:not([style*="none"])) { grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr) minmax(0, 1fr) auto; }

/* ---------- 12. Orders: bank-transfer payment card ---------- */
.pay-card {
  margin: 0 24px 18px; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.order-form + .pay-card { margin-top: 20px; }
.pay-card.overdue { border-color: var(--danger-line); background: linear-gradient(180deg, var(--danger-bg), var(--surface) 140px); }
.pay-card.review { border-color: var(--ok-line); }
.pay-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 18px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.pay-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pay-title h3 { margin: 0 0 2px; font-size: 16px; }
.pay-title .muted { font-size: 13px; }
.pay-amount { text-align: end; white-space: nowrap; font-size: 14px; color: var(--muted); }
.pay-amount b { font: 700 26px/1.2 var(--font-sans); color: var(--heading); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.pay-amount small { display: block; font-size: 12px; color: var(--subtle); }
.pay-steps {
  display: flex; flex-wrap: wrap; gap: 6px 22px;
  margin: 0; padding: 12px 20px; list-style: none;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.pay-steps li { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--subtle); }
.pay-steps li span {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font: 600 11.5px/1 var(--font-mono); color: var(--subtle);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.pay-steps li.done { color: var(--ok-text); }
.pay-steps li.done span { color: #fff; background: var(--ok); box-shadow: none; }
.pay-steps li.now { color: var(--heading); font-weight: 600; }
.pay-steps li.now span { color: #fff; background: var(--grad); box-shadow: 0 6px 14px -6px rgba(51, 88, 255, .8); }
.pay-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.pay-info { padding: 18px 20px; border-inline-end: 1px solid var(--line); }
.pay-info h4, .pay-action h4 {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.pay-info h4 svg { width: 17px; height: 17px; color: var(--brand); }
[data-theme="dark"] .pay-info h4 svg { color: var(--brand-300); }
.pay-info dl { margin: 0; display: grid; gap: 2px; }
.pay-info dl > div {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.pay-info dl > div:last-child { border-bottom: 0; }
.pay-info dt { flex: none; min-width: 64px; color: var(--muted); }
.pay-info dd { margin: 0; font-weight: 600; color: var(--heading); min-width: 0; }
.pay-info .iban { font: 600 14px/1.5 var(--font-mono); letter-spacing: .02em; overflow-wrap: anywhere; }
.pay-info .ref { display: inline-flex; align-items: center; gap: 8px; }
.pay-info .ref code { font-size: 13.5px; font-weight: 600; }
.mini-copy {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px; padding: 0 9px;
  border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface);
  font: 600 12px/1 var(--font-sans); color: var(--muted); cursor: pointer;
  transition: color .15s, border-color .15s, background-color .15s;
}
.mini-copy svg { width: 14px; height: 14px; }
.mini-copy:hover { color: var(--brand); border-color: var(--brand-200); }
.mini-copy.is-copied { color: var(--ok-text); border-color: var(--ok-line); background: var(--ok-bg); }
[data-theme="dark"] .mini-copy { background: var(--surface-3); }
[data-theme="dark"] .mini-copy:hover { color: var(--brand-300); }
.pay-fine { margin-top: 10px; font-size: 12.5px; line-height: 1.8; color: var(--subtle); }
.pay-action { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 18px 20px; }
.pay-status {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  background: var(--info-bg); border: 1px solid var(--info-line); color: var(--info-text);
}
.pay-status > svg { flex: none; width: 19px; height: 19px; margin-top: 2px; }
.pay-status b { display: block; font-size: 14px; color: var(--heading); }
.pay-status span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.75; color: var(--muted); }
.pay-status.late { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-text); }
.pay-status.late b { color: var(--danger-text); }
.pay-status.sent { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-text); }
.pay-status.sent b { color: var(--ok-text); }
.pay-meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.pay-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3358FF, #22C7E8); }
.pay-due { margin-top: -6px; font-size: 12.5px; color: var(--subtle); }
.receipt-form { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin: 0; }
.receipt-file {
  position: relative; flex: 1 1 230px; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  margin: 0; padding: 10px 14px;
  border: 1.5px dashed var(--line-strong); border-radius: 12px;
  background: var(--surface-2); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.receipt-file:hover, .receipt-file:focus-within { border-color: var(--brand); background: var(--brand-50); }
.receipt-file:focus-within { box-shadow: var(--ring); }
.receipt-file.has-file { border-style: solid; border-color: var(--ok-line); background: var(--ok-bg); }
.receipt-ic {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 10px;
  color: var(--brand); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
}
.receipt-ic svg { width: 18px; height: 18px; }
[data-theme="dark"] .receipt-ic { color: var(--brand-300); background: var(--surface-3); }
.receipt-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.5; }
.receipt-copy b { font-size: 13.5px; font-weight: 600; color: var(--heading); }
.receipt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.receipt-file.has-file .receipt-name { color: var(--ok-text); font-weight: 600; }
/* With JS the native input sits invisibly over the whole drop area (click + drag-and-drop) */
.js .receipt-file input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer;
}
html:not(.js) .receipt-name { display: none; }
.receipt-form .btn { align-self: center; }

/* ---------- 13. Admin: order stats + SMTP tool ---------- */
.order-stats { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.smtp-row { display: flex; align-items: center; gap: 18px; padding: 22px 24px; }
.smtp-copy { flex: 1; min-width: 0; }
.smtp-copy h2 { font-size: 19px; line-height: 1.4; margin: 0; }
.smtp-copy p { margin-top: 5px; font-size: 14px; line-height: 1.8; color: var(--muted); overflow-wrap: anywhere; }
.smtp-action { flex: none; margin: 0; }

/* ---------- 14. Stacked tables (rows become labelled cards in narrow panels) ----------
   Container queries on .panel. One class per table picks its threshold:
   .stack-sm (<= 640px: keys, ledger) · .stack-table (<= 820px: messages, order history)
   · .stack-wide (<= 1000px: admin clients) · .stack-xl (<= 1100px: admin orders, a card list on most screens).
   First line: the title cell (.stack-title) plus the action (.cell-action) or a status (.cell-aside).
   Phones: two labelled fields per line (flex); wider panels: a 3-4 column grid.
   Full-width fields: .cell-form, .note-cell, .email-cell, .wide-cell.
   Generated block: keep the variants identical when editing. */

@container panel (max-width: 640px) {
  .data-table.stack-sm { min-width: 0; }
  .data-table.stack-sm, .data-table.stack-sm tbody { display: block; width: 100%; }
  .data-table.stack-sm thead { display: none; }
  .data-table.stack-sm tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; padding: 14px 20px 12px; border-bottom: 1px solid var(--line); }
  .data-table.stack-sm tr:last-child { border-bottom: 0; }
  .data-table.stack-sm tbody tr:hover td { background: none; }
  .data-table.stack-sm tbody tr:hover td:first-child, .data-table.stack-sm tr td:first-child { box-shadow: none !important; }
  .data-table.stack-sm tr.is-open { box-shadow: inset -3px 0 0 var(--warn); }
  .data-table.stack-sm tr.is-review { box-shadow: inset -3px 0 0 var(--brand); }
  .data-table.stack-sm td, .data-table.stack-sm td:first-child, .data-table.stack-sm td:last-child {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 2px 8px;
    flex: 1 1 calc(50% - 8px); min-width: 0; min-height: 32px; padding: 3px 0;
    border: 0; white-space: normal; text-align: start;
  }
  .data-table.stack-sm td[data-label]::before { content: attr(data-label); flex: none; font: 500 12.5px/1.6 var(--font-sans); color: var(--muted); }
  .data-table.stack-sm td > * { min-width: 0; }
  .data-table.stack-sm td.stack-title { order: -2; flex: 1 1 60%; padding-bottom: 6px; font-size: 15px; }
  .data-table.stack-sm td.stack-title::before, .data-table.stack-sm td.cell-action::before, .data-table.stack-sm td.cell-aside::before { display: none; }
  .data-table.stack-sm td.cell-action, .data-table.stack-sm td.cell-aside { order: -1; flex: none; margin-inline-start: auto; align-self: flex-start; padding-bottom: 6px; }
  .data-table.stack-sm td.cell-action:not(:has(*)) { display: none; }
  .data-table.stack-sm td.cell-form, .data-table.stack-sm td.note-cell, .data-table.stack-sm td.email-cell, .data-table.stack-sm td.wide-cell { flex-basis: 100%; }
  .data-table.stack-sm td.cell-form { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 8px; }
  .data-table.stack-sm td.note-cell { order: 50; max-width: none; }
  .data-table.stack-sm td.note-cell.is-empty { display: none; }
  .data-table.stack-sm .email-cell .c-email { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .data-table.stack-sm .credit-form.row > input.short:not([type="hidden"]) { flex: 1 1 0; width: auto; min-width: 0; }
  .data-table.stack-sm .credit-form.row > input[type="number"].short:not([type="hidden"]) { flex: 0 0 96px; width: 96px; }
  .data-table.stack-sm tr.empty-row { display: block; padding: 0; }
  .data-table.stack-sm tr.empty-row td { display: block; padding: 0; }
  .data-table.stack-sm .status-cell { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
}

@container panel (max-width: 820px) {
  .data-table.stack-table { min-width: 0; }
  .data-table.stack-table, .data-table.stack-table tbody { display: block; width: 100%; }
  .data-table.stack-table thead { display: none; }
  .data-table.stack-table tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; padding: 14px 20px 12px; border-bottom: 1px solid var(--line); }
  .data-table.stack-table tr:last-child { border-bottom: 0; }
  .data-table.stack-table tbody tr:hover td { background: none; }
  .data-table.stack-table tbody tr:hover td:first-child, .data-table.stack-table tr td:first-child { box-shadow: none !important; }
  .data-table.stack-table tr.is-open { box-shadow: inset -3px 0 0 var(--warn); }
  .data-table.stack-table tr.is-review { box-shadow: inset -3px 0 0 var(--brand); }
  .data-table.stack-table td, .data-table.stack-table td:first-child, .data-table.stack-table td:last-child {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 2px 8px;
    flex: 1 1 calc(50% - 8px); min-width: 0; min-height: 32px; padding: 3px 0;
    border: 0; white-space: normal; text-align: start;
  }
  .data-table.stack-table td[data-label]::before { content: attr(data-label); flex: none; font: 500 12.5px/1.6 var(--font-sans); color: var(--muted); }
  .data-table.stack-table td > * { min-width: 0; }
  .data-table.stack-table td.stack-title { order: -2; flex: 1 1 60%; padding-bottom: 6px; font-size: 15px; }
  .data-table.stack-table td.stack-title::before, .data-table.stack-table td.cell-action::before, .data-table.stack-table td.cell-aside::before { display: none; }
  .data-table.stack-table td.cell-action, .data-table.stack-table td.cell-aside { order: -1; flex: none; margin-inline-start: auto; align-self: flex-start; padding-bottom: 6px; }
  .data-table.stack-table td.cell-action:not(:has(*)) { display: none; }
  .data-table.stack-table td.cell-form, .data-table.stack-table td.note-cell, .data-table.stack-table td.email-cell, .data-table.stack-table td.wide-cell { flex-basis: 100%; }
  .data-table.stack-table td.cell-form { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 8px; }
  .data-table.stack-table td.note-cell { order: 50; max-width: none; }
  .data-table.stack-table td.note-cell.is-empty { display: none; }
  .data-table.stack-table .email-cell .c-email { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .data-table.stack-table .credit-form.row > input.short:not([type="hidden"]) { flex: 1 1 0; width: auto; min-width: 0; }
  .data-table.stack-table .credit-form.row > input[type="number"].short:not([type="hidden"]) { flex: 0 0 96px; width: 96px; }
  .data-table.stack-table tr.empty-row { display: block; padding: 0; }
  .data-table.stack-table tr.empty-row td { display: block; padding: 0; }
  .data-table.stack-table .status-cell { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
}

@container panel (max-width: 1000px) {
  .data-table.stack-wide { min-width: 0; }
  .data-table.stack-wide, .data-table.stack-wide tbody { display: block; width: 100%; }
  .data-table.stack-wide thead { display: none; }
  .data-table.stack-wide tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; padding: 14px 20px 12px; border-bottom: 1px solid var(--line); }
  .data-table.stack-wide tr:last-child { border-bottom: 0; }
  .data-table.stack-wide tbody tr:hover td { background: none; }
  .data-table.stack-wide tbody tr:hover td:first-child, .data-table.stack-wide tr td:first-child { box-shadow: none !important; }
  .data-table.stack-wide tr.is-open { box-shadow: inset -3px 0 0 var(--warn); }
  .data-table.stack-wide tr.is-review { box-shadow: inset -3px 0 0 var(--brand); }
  .data-table.stack-wide td, .data-table.stack-wide td:first-child, .data-table.stack-wide td:last-child {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 2px 8px;
    flex: 1 1 calc(50% - 8px); min-width: 0; min-height: 32px; padding: 3px 0;
    border: 0; white-space: normal; text-align: start;
  }
  .data-table.stack-wide td[data-label]::before { content: attr(data-label); flex: none; font: 500 12.5px/1.6 var(--font-sans); color: var(--muted); }
  .data-table.stack-wide td > * { min-width: 0; }
  .data-table.stack-wide td.stack-title { order: -2; flex: 1 1 60%; padding-bottom: 6px; font-size: 15px; }
  .data-table.stack-wide td.stack-title::before, .data-table.stack-wide td.cell-action::before, .data-table.stack-wide td.cell-aside::before { display: none; }
  .data-table.stack-wide td.cell-action, .data-table.stack-wide td.cell-aside { order: -1; flex: none; margin-inline-start: auto; align-self: flex-start; padding-bottom: 6px; }
  .data-table.stack-wide td.cell-action:not(:has(*)) { display: none; }
  .data-table.stack-wide td.cell-form, .data-table.stack-wide td.note-cell, .data-table.stack-wide td.email-cell, .data-table.stack-wide td.wide-cell { flex-basis: 100%; }
  .data-table.stack-wide td.cell-form { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 8px; }
  .data-table.stack-wide td.note-cell { order: 50; max-width: none; }
  .data-table.stack-wide td.note-cell.is-empty { display: none; }
  .data-table.stack-wide .email-cell .c-email { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .data-table.stack-wide .credit-form.row > input.short:not([type="hidden"]) { flex: 1 1 0; width: auto; min-width: 0; }
  .data-table.stack-wide .credit-form.row > input[type="number"].short:not([type="hidden"]) { flex: 0 0 96px; width: 96px; }
  .data-table.stack-wide tr.empty-row { display: block; padding: 0; }
  .data-table.stack-wide tr.empty-row td { display: block; padding: 0; }
  .data-table.stack-wide .status-cell { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
}

@container panel (max-width: 1100px) {
  .data-table.stack-xl { min-width: 0; }
  .data-table.stack-xl, .data-table.stack-xl tbody { display: block; width: 100%; }
  .data-table.stack-xl thead { display: none; }
  .data-table.stack-xl tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; padding: 14px 20px 12px; border-bottom: 1px solid var(--line); }
  .data-table.stack-xl tr:last-child { border-bottom: 0; }
  .data-table.stack-xl tbody tr:hover td { background: none; }
  .data-table.stack-xl tbody tr:hover td:first-child, .data-table.stack-xl tr td:first-child { box-shadow: none !important; }
  .data-table.stack-xl tr.is-open { box-shadow: inset -3px 0 0 var(--warn); }
  .data-table.stack-xl tr.is-review { box-shadow: inset -3px 0 0 var(--brand); }
  .data-table.stack-xl td, .data-table.stack-xl td:first-child, .data-table.stack-xl td:last-child {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 2px 8px;
    flex: 1 1 calc(50% - 8px); min-width: 0; min-height: 32px; padding: 3px 0;
    border: 0; white-space: normal; text-align: start;
  }
  .data-table.stack-xl td[data-label]::before { content: attr(data-label); flex: none; font: 500 12.5px/1.6 var(--font-sans); color: var(--muted); }
  .data-table.stack-xl td > * { min-width: 0; }
  .data-table.stack-xl td.stack-title { order: -2; flex: 1 1 60%; padding-bottom: 6px; font-size: 15px; }
  .data-table.stack-xl td.stack-title::before, .data-table.stack-xl td.cell-action::before, .data-table.stack-xl td.cell-aside::before { display: none; }
  .data-table.stack-xl td.cell-action, .data-table.stack-xl td.cell-aside { order: -1; flex: none; margin-inline-start: auto; align-self: flex-start; padding-bottom: 6px; }
  .data-table.stack-xl td.cell-action:not(:has(*)) { display: none; }
  .data-table.stack-xl td.cell-form, .data-table.stack-xl td.note-cell, .data-table.stack-xl td.email-cell, .data-table.stack-xl td.wide-cell { flex-basis: 100%; }
  .data-table.stack-xl td.cell-form { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 8px; }
  .data-table.stack-xl td.note-cell { order: 50; max-width: none; }
  .data-table.stack-xl td.note-cell.is-empty { display: none; }
  .data-table.stack-xl .email-cell .c-email { max-width: none; white-space: normal; overflow-wrap: anywhere; }
  .data-table.stack-xl .credit-form.row > input.short:not([type="hidden"]) { flex: 1 1 0; width: auto; min-width: 0; }
  .data-table.stack-xl .credit-form.row > input[type="number"].short:not([type="hidden"]) { flex: 0 0 96px; width: 96px; }
  .data-table.stack-xl tr.empty-row { display: block; padding: 0; }
  .data-table.stack-xl tr.empty-row td { display: block; padding: 0; }
  .data-table.stack-xl .status-cell { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
}

@container panel (min-width: 561px) and (max-width: 640px) {
  .data-table.stack-sm tr:not(.empty-row) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; row-gap: 2px; padding: 14px 24px; }
  .data-table.stack-sm td:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: auto; }
  .data-table.stack-sm td.stack-title { grid-row: 1; grid-column: 1 / span 1; }
  .data-table.stack-sm tr:not(:has(td.cell-action > *, td.cell-aside > *)) td.stack-title { grid-column: 1 / -1; }
  .data-table.stack-sm td.cell-action, .data-table.stack-sm td.cell-aside { grid-row: 1; grid-column: 2; justify-content: flex-end; margin: 0; }
  .data-table.stack-sm td.cell-form:not(.stack-title):not(.cell-action):not(.cell-aside),
  .data-table.stack-sm td.note-cell:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: 1 / -1; }
  .data-table.stack-sm td.cell-form { flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 16px; }
  .data-table.stack-sm td.cell-form .credit-form { flex: 1 1 auto; max-width: 460px; }
}

@container panel (min-width: 561px) and (max-width: 820px) {
  .data-table.stack-table tr:not(.empty-row) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 28px; row-gap: 2px; padding: 14px 24px; }
  .data-table.stack-table td:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: auto; }
  .data-table.stack-table td.stack-title { grid-row: 1; grid-column: 1 / span 2; }
  .data-table.stack-table tr:not(:has(td.cell-action > *, td.cell-aside > *)) td.stack-title { grid-column: 1 / -1; }
  .data-table.stack-table td.cell-action, .data-table.stack-table td.cell-aside { grid-row: 1; grid-column: 3; justify-content: flex-end; margin: 0; }
  .data-table.stack-table td.cell-form:not(.stack-title):not(.cell-action):not(.cell-aside),
  .data-table.stack-table td.note-cell:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: 1 / -1; }
  .data-table.stack-table td.cell-form { flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 16px; }
  .data-table.stack-table td.cell-form .credit-form { flex: 1 1 auto; max-width: 460px; }
}

@container panel (min-width: 561px) and (max-width: 820px) {
  .data-table.stack-wide tr:not(.empty-row) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 28px; row-gap: 2px; padding: 14px 24px; }
  .data-table.stack-wide td:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: auto; }
  .data-table.stack-wide td.stack-title { grid-row: 1; grid-column: 1 / span 2; }
  .data-table.stack-wide tr:not(:has(td.cell-action > *, td.cell-aside > *)) td.stack-title { grid-column: 1 / -1; }
  .data-table.stack-wide td.cell-action, .data-table.stack-wide td.cell-aside { grid-row: 1; grid-column: 3; justify-content: flex-end; margin: 0; }
  .data-table.stack-wide td.cell-form:not(.stack-title):not(.cell-action):not(.cell-aside),
  .data-table.stack-wide td.note-cell:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: 1 / -1; }
  .data-table.stack-wide td.cell-form { flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 16px; }
  .data-table.stack-wide td.cell-form .credit-form { flex: 1 1 auto; max-width: 460px; }
}

@container panel (min-width: 821px) and (max-width: 1000px) {
  .data-table.stack-wide tr:not(.empty-row) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 28px; row-gap: 2px; padding: 14px 24px; }
  .data-table.stack-wide td:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: auto; }
  .data-table.stack-wide td.stack-title { grid-row: 1; grid-column: 1 / span 3; }
  .data-table.stack-wide tr:not(:has(td.cell-action > *, td.cell-aside > *)) td.stack-title { grid-column: 1 / -1; }
  .data-table.stack-wide td.cell-action, .data-table.stack-wide td.cell-aside { grid-row: 1; grid-column: 4; justify-content: flex-end; margin: 0; }
  .data-table.stack-wide td.cell-form:not(.stack-title):not(.cell-action):not(.cell-aside),
  .data-table.stack-wide td.note-cell:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: 1 / -1; }
  .data-table.stack-wide td.cell-form { flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 16px; }
  .data-table.stack-wide td.cell-form .credit-form { flex: 1 1 auto; max-width: 460px; }
}

@container panel (min-width: 561px) and (max-width: 820px) {
  .data-table.stack-xl tr:not(.empty-row) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 28px; row-gap: 2px; padding: 14px 24px; }
  .data-table.stack-xl td:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: auto; }
  .data-table.stack-xl td.stack-title { grid-row: 1; grid-column: 1 / span 2; }
  .data-table.stack-xl tr:not(:has(td.cell-action > *, td.cell-aside > *)) td.stack-title { grid-column: 1 / -1; }
  .data-table.stack-xl td.cell-action, .data-table.stack-xl td.cell-aside { grid-row: 1; grid-column: 3; justify-content: flex-end; margin: 0; }
  .data-table.stack-xl td.cell-form:not(.stack-title):not(.cell-action):not(.cell-aside),
  .data-table.stack-xl td.note-cell:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: 1 / -1; }
  .data-table.stack-xl td.cell-form { flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 16px; }
  .data-table.stack-xl td.cell-form .credit-form { flex: 1 1 auto; max-width: 460px; }
}

@container panel (min-width: 821px) and (max-width: 1100px) {
  .data-table.stack-xl tr:not(.empty-row) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 28px; row-gap: 2px; padding: 14px 24px; }
  .data-table.stack-xl td:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: auto; }
  .data-table.stack-xl td.stack-title { grid-row: 1; grid-column: 1 / span 3; }
  .data-table.stack-xl tr:not(:has(td.cell-action > *, td.cell-aside > *)) td.stack-title { grid-column: 1 / -1; }
  .data-table.stack-xl td.cell-action, .data-table.stack-xl td.cell-aside { grid-row: 1; grid-column: 4; justify-content: flex-end; margin: 0; }
  .data-table.stack-xl td.cell-form:not(.stack-title):not(.cell-action):not(.cell-aside),
  .data-table.stack-xl td.note-cell:not(.stack-title):not(.cell-action):not(.cell-aside) { grid-column: 1 / -1; }
  .data-table.stack-xl td.cell-form { flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 16px; }
  .data-table.stack-xl td.cell-form .credit-form { flex: 1 1 auto; max-width: 460px; }
}

/* ---------- 15. Panel-width layouts (container queries) ---------- */
/* Admin orders on phones: approve / reject get their own full-width line */
@container panel (max-width: 560px) {
  .data-table.orders-table td.cell-action { order: 99; flex: 1 1 100%; margin: 0; padding-top: 10px; }
  .orders-table .order-actions { display: flex; width: 100%; }
  .orders-table .order-actions > form, .orders-table .order-actions > .btn { flex: 1 1 0; }
  .orders-table .order-actions > form .btn, .orders-table .order-actions > .btn { width: 100%; }
}
[data-theme="dark"] .data-table tr.is-review { box-shadow: inset -3px 0 0 var(--brand-300); }
/* Dark-theme fix inside the app shell: keep filled danger buttons filled */
[data-theme="dark"] .shell .btn.danger.solid { background: var(--danger); color: #fff; border-color: transparent; }
[data-theme="dark"] .shell .btn.danger.solid:hover { background: #CF3A3F; color: #fff; }
.app-banner > .btn { text-decoration: none; }
@container panel (max-width: 900px) {
  .stat-grid, .stat-grid.stat-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qs-grid { grid-template-columns: minmax(0, 1fr); }
}
@container panel (max-width: 760px) {
  .pay-grid { grid-template-columns: minmax(0, 1fr); }
  .pay-info { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .order-form,
  .order-form:has(#order-credits-wrap:not([style*="none"])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .order-form .of-package { grid-column: 1 / -1; }
  .order-form:has(#order-credits-wrap[style*="none"]) .of-note { grid-column: 1 / 3; }
}
@container panel (max-width: 640px) {
  .key-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .key-form .btn { grid-column: 1 / -1; }
}
@container panel (max-width: 520px) {
  .stat-grid, .stat-grid.stat-6 { gap: 10px; }
  .stat-grid > .stat-card.is-feature { grid-column: 1 / -1; }
  .stat-grid > .stat-card.is-feature ~ .stat-card:last-child:nth-child(even) { grid-column: 1 / -1; }
  .key-form, .order-form,
  .order-form:has(#order-credits-wrap:not([style*="none"])) { grid-template-columns: minmax(0, 1fr); }
  .order-form .of-package, .order-form .of-note, .order-form:has(#order-credits-wrap[style*="none"]) .of-note { grid-column: auto; }
  .pay-amount { width: 100%; text-align: start; padding-top: 10px; border-top: 1px dashed var(--line); }
  .pay-amount small { display: inline; margin-inline-start: 6px; }
  .pay-steps { flex-direction: column; }
  .receipt-form .btn { width: 100%; }
}
@container panel (max-width: 300px) {
  .stat-grid, .stat-grid.stat-6 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 16. Responsive (viewport) ---------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 212px minmax(0, 1fr); gap: 22px; }
}

/* Sidebar becomes a horizontal chip bar under the header */
@media (max-width: 1020px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .side-nav {
    position: sticky; top: var(--header-h); z-index: 30;
    flex-direction: row; align-items: center; gap: 6px;
    max-height: none; overflow-x: auto; overflow-y: hidden;
    margin-inline: calc(var(--gutter) * -1); padding: 8px var(--gutter);
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
    background: var(--header-bg);
    -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
    box-shadow: none;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-account, .side-label, .side-foot { display: none; }
  .side-link {
    flex: none; min-height: 36px; padding: 6px 13px; gap: 7px;
    border: 1px solid var(--line); border-radius: var(--radius-pill);
    background: var(--surface); font-size: 13.5px;
  }
  .side-link > svg { width: 16px; height: 16px; }
  .side-link > span { white-space: nowrap; }
  .side-link.on { border-color: var(--brand-200); }
  .side-link.on::before { display: none; }
  .side-count { min-width: 20px; padding: 0 6px; line-height: 20px; }
  [data-theme="dark"] .side-nav { background: var(--header-bg); }
  [data-theme="dark"] .side-link { background: var(--surface); }
  [data-theme="dark"] .side-link.on { background: rgba(51, 88, 255, .18); border-color: rgba(138, 162, 255, .35); }
  .app-section { scroll-margin-top: 62px; }
  .page-dashboard .page-body, .page-admin .page-body { padding-top: 0; }
  .shell-main { padding-top: 20px; }
}

@media (max-width: 600px) {
  .dash-head { margin-bottom: 18px; }
  .dash-head .who { gap: 12px; }
  .dash-avatar { width: 50px; height: 50px; border-radius: 15px; font-size: 22px; }
  .dash-head-side, .dash-actions { width: 100%; }
  .dash-actions .btn { flex: 1 1 0; }
  .credits-pill { width: 100%; justify-content: center; }
  .app-banner { flex-wrap: wrap; }
  .app-banner .banner-ic { display: none; }
  .app-banner > .btn { width: 100%; }

  .panel { border-radius: var(--radius); margin-bottom: 16px; }
  .panel-head { padding: 18px 16px 16px; }
  .panel-head > div { flex-basis: 100%; }
  .panel-head > .btn { width: 100%; }
  .panel-body { padding: 0 16px 18px; }
  .panel-empty { margin: 0 16px 18px; }
  .sub-head { padding: 16px 16px 10px; }

  .stat-card { padding: 14px; }
  .stat-label { font-size: 13px; }
  .stat-top .icon-tile.sm { width: 32px; height: 32px; border-radius: 9px; }
  .stat-top .icon-tile.sm svg { width: 17px; height: 17px; }
  .stat-value { font-size: 25px; margin-top: 8px; }
  .stat-card.is-feature .stat-value { font-size: 32px; }
  .stat-note { font-size: 12px; }

  .key-form, .order-form { padding: 16px; }
  .new-key { margin: 0 16px 18px; padding: 16px 14px; }
  .copy-field { flex-direction: column; }
  .copy-field input { flex: none; font-size: 13px; }
  .app-copy { width: 100%; }
  .qs-grid { padding: 0 16px 18px; }
  .qs-pre { font-size: 12px; padding: 14px 14px 16px; }

  .pay-card { margin: 0 16px 16px; }
  .order-form + .pay-card { margin-top: 16px; }
  .pay-head { padding: 14px 16px; }
  .pay-steps { padding: 12px 16px; }
  .pay-info, .pay-action { padding: 16px; }

  .data-table tr { padding-inline: 16px !important; }

  .smtp-row { flex-wrap: wrap; padding: 18px 16px; }
  .smtp-row > .icon-tile { display: none; }
  .smtp-action, .smtp-action .btn { width: 100%; }

  .app-flash { bottom: 12px; inset-inline-end: 12px; width: calc(100vw - 24px); }
}


/* ---------- Orders: إثبات التحويل الإلزامي داخل نموذج الطلب (PDF أو صورة) ---------- */
.order-form .receipt-file { grid-column: 1 / -1; }

/* ---------- الدعم: نموذج تواصل مع الدعم داخل اللوحة ---------- */
.support-form { display: grid; gap: 12px; margin: 0; padding: 18px 24px 20px; background: var(--surface-2); border-top: 1px solid var(--line); }
.support-form label { display: grid; gap: 6px; margin: 0; font-size: 13px; }
.support-form input, .support-form textarea { background-color: var(--input-bg); }
.support-form textarea { min-height: 120px; resize: vertical; }
.support-form .btn { justify-self: start; min-height: 46px; }


/* ---------- تذاكر الدعم: قائمة + محادثة + حالات + تقييم نجوم ---------- */
.ticket-list { display: grid; gap: 10px; padding: 16px 24px 20px; }
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.ticket[open] { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.ticket summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.ticket summary::-webkit-details-marker { display: none; }
.ticket summary:hover { background: var(--surface-2); }
.t-ic { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--brand); box-shadow: inset 0 0 0 1px var(--line); }
.t-ic svg { width: 17px; height: 17px; }
[data-theme="dark"] .t-ic { background: var(--surface-3); color: var(--brand-300); }
.t-subject { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.5; }
.t-subject b { font-size: 13.5px; font-weight: 600; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-subject span { font-size: 12px; color: var(--muted); }
.t-badge { flex: none; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.t-badge.st-new { background: rgba(51, 88, 255, .20); color: #B4C3FF; }
.t-badge.st-in_progress { background: rgba(245, 165, 36, .16); color: #F5C46B; }
.t-badge.st-done { background: rgba(18, 185, 129, .16); color: #5BE0B0; }
.t-badge.st-closed { background: var(--surface-2); color: var(--muted); }
[data-theme="dark"] .t-badge.st-new { background: rgba(51, 88, 255, .16); color: #9FB2FF; }
[data-theme="dark"] .t-badge.st-in_progress { background: rgba(198, 149, 89, .16); color: #E7C892; }
[data-theme="dark"] .t-badge.st-done { background: rgba(43, 171, 133, .16); color: #7BE0BC; }
.t-mini-rate { flex: none; font-size: 12px; font-weight: 700; color: #c99559; }
.t-thread { display: grid; gap: 10px; padding: 4px 16px 12px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.8; }
.msg-head { font-size: 11.5px; opacity: .7; margin-bottom: 4px; }
.msg-body { word-break: break-word; }
.from-client { justify-self: start; background: var(--brand-50); border: 1px solid var(--line); border-start-start-radius: 4px; }
.from-support { justify-self: end; background: var(--surface-2); border: 1px solid var(--line-strong); border-start-end-radius: 4px; }
.t-admin-actions { display: grid; gap: 10px; padding: 0 16px 14px; }
.t-reply { display: flex; gap: 10px; align-items: flex-start; }
.t-reply textarea { flex: 1; background-color: var(--input-bg); min-height: 56px; resize: vertical; }
.t-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.t-status-label { font-size: 12.5px; color: var(--muted); }
.t-close { padding: 0 16px 14px; }
.t-close.t-admin-actions .t-close, .ticket .t-close { margin: 0; }
.t-rating { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px dashed var(--line); }
.t-rate-label, .t-rated-text { font-size: 13px; color: var(--subtle); }
.stars, .stars-form { display: inline-flex; gap: 2px; }
.star svg, .star-btn svg { width: 20px; height: 20px; color: #c99559; }
.star:not(.on) svg { opacity: .3; fill: none; }
.star.on svg { fill: currentColor; }
.star-btn { display: inline-flex; padding: 2px; background: none; border: none; cursor: pointer; }
.star-btn svg { opacity: .3; fill: none; transition: opacity .1s; }
.star-btn.on svg, .star-btn:hover svg { opacity: 1; fill: currentColor; }
.btn.tiny { min-height: 30px; padding: 4px 12px; font-size: 12px; border-radius: 8px; }

/* ---------- طلب مخصص: حقول التواصل داخل نموذج الطلب ---------- */
.of-contact { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.of-contact label { margin: 0; font-size: 13px; }
.of-contact input { background-color: var(--input-bg); }
.of-contact-hint { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--muted); }
.ord-contact { font-size: 12.5px; color: var(--muted); }
