/* ============================================================
   Vine v7 — UI refresh layer (v707)
   Approved redesign (docs/design/ui-redesign-proposal) ported to
   production as an ADDITIVE layer: it only styles pages that opt
   in with .v7-page. No aurora/admin.css rule is removed or
   rewritten, and every existing behavior hook (data-agent-*,
   data-aurora-filter-panel, data-v4-mobile-table, stackable
   tables) stays untouched.

   Scope:
     - .v7-page on the page root (admin + agent pages)
     - v7 components that render outside the page root (agent catalog
       modal/panel — Bootstrap modals are appended to <body>, not to the page)
     - [data-bs-theme="dark"] for dark mode
   ============================================================ */

/* ---------- 1) tokens ---------- */
/* v729: tokens must reach every v7 root, not only .v7-page. The agent catalog
   modal lives outside .v7-page, so an unresolved var(--v7-*) there is invalid at
   computed-value time and silently drops the surface, radii and separators
   (the transparent catalog popup). Keep this list in sync with v7 roots. */
.v7-page,
.agent-products-modal,
.v7-catmodal {
    --v7-bg: #f3f5f8;
    --v7-surface: #ffffff;
    --v7-s2: #f6f8fa;
    --v7-s3: #eceff3;
    --v7-text: #131b24;
    --v7-text-2: #4a5563;
    --v7-muted: #6b7684;
    --v7-border: #e0e5eb;
    --v7-border-2: #cdd5de;
    --v7-brand: #4f46e5;
    --v7-brand-2: #6366f1;
    --v7-brand-soft: #eef0fe;
    --v7-brand-ring: rgba(79, 70, 229, .22);
    --v7-ok: #15803d;
    --v7-ok-soft: #e8f5ee;
    --v7-ok-line: #b8e0c8;
    --v7-warn: #a16207;
    --v7-warn-soft: #fdf3e3;
    --v7-warn-line: #ecd9a8;
    --v7-dgr: #b42330;
    --v7-dgr-soft: #fdecee;
    --v7-dgr-line: #f3c2c8;
    --v7-info: #1d5fbf;
    --v7-info-soft: #e9f1fd;
    --v7-info-line: #bcd4f3;
    --v7-neu: #526272;
    --v7-neu-soft: #eef1f4;
    --v7-neu-line: #d8dee5;
    --v7-r-sm: 8px;
    --v7-r-md: 12px;
    --v7-r-lg: 16px;
    --v7-sh-1: 0 1px 2px rgba(19, 27, 36, .05);
    --v7-sh-2: 0 4px 14px rgba(19, 27, 36, .07);
    color: var(--v7-text);
}

[data-bs-theme="dark"] .v7-page,
[data-bs-theme="dark"] .agent-products-modal,
[data-bs-theme="dark"] .v7-catmodal {
    --v7-bg: #0f1520;
    --v7-surface: #171e2b;
    --v7-s2: #1c2432;
    --v7-s3: #232c3d;
    --v7-text: #e6eaf0;
    --v7-text-2: #b7c0cd;
    --v7-muted: #8b95a3;
    --v7-border: #2a3446;
    --v7-border-2: #38445a;
    --v7-brand: #8b83f7;
    --v7-brand-2: #a29bff;
    --v7-brand-soft: rgba(99, 102, 241, .16);
    --v7-brand-ring: rgba(139, 131, 247, .3);
    --v7-ok: #4ade80;
    --v7-ok-soft: rgba(34, 197, 94, .13);
    --v7-ok-line: rgba(34, 197, 94, .38);
    --v7-warn: #eab308;
    --v7-warn-soft: rgba(234, 179, 8, .12);
    --v7-warn-line: rgba(234, 179, 8, .35);
    --v7-dgr: #f87171;
    --v7-dgr-soft: rgba(239, 68, 68, .13);
    --v7-dgr-line: rgba(239, 68, 68, .38);
    --v7-info: #60a5fa;
    --v7-info-soft: rgba(59, 130, 246, .13);
    --v7-info-line: rgba(59, 130, 246, .38);
    --v7-neu: #9aa4b0;
    --v7-neu-soft: rgba(148, 163, 184, .12);
    --v7-neu-line: rgba(148, 163, 184, .3);
    --v7-sh-1: 0 1px 2px rgba(0, 0, 0, .3);
    --v7-sh-2: 0 4px 14px rgba(0, 0, 0, .35);
}

/* ---------- 2) page header: flat, crisp, no gradient banner ---------- */
.v7-pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.v7-crumb { color: var(--v7-muted); font-size: 12px; margin-bottom: 3px; font-weight: 600; }
.v7-crumb a { color: var(--v7-muted); text-decoration: none; }
.v7-crumb a:hover { color: var(--v7-brand); text-decoration: underline; }
.v7-title { margin: 0 0 3px; font-size: 20px; font-weight: 700; letter-spacing: -.015em; color: var(--v7-text); }
.v7-sub { margin: 0; color: var(--v7-muted); font-size: 13px; }
.v7-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- 3) buttons ---------- */
.v7-btn { min-height: 34px; padding: 0 13px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--v7-border-2); border-radius: var(--v7-r-sm); background: var(--v7-surface); color: var(--v7-text); font-weight: 600; font-size: 13.5px; box-shadow: var(--v7-sh-1); text-decoration: none; cursor: pointer; }
.v7-btn:hover { background: var(--v7-s2); color: var(--v7-text); text-decoration: none; }
.v7-btn:focus-visible { outline: 2px solid var(--v7-brand); outline-offset: 2px; }
.v7-btn.primary { color: #fff; border-color: var(--v7-brand); background: var(--v7-brand); }
.v7-btn.primary:hover { background: var(--v7-brand-2); color: #fff; }
.v7-btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--v7-text-2); }
.v7-btn.danger { color: var(--v7-dgr); border-color: var(--v7-dgr-line); background: var(--v7-dgr-soft); }
.v7-btn.sm { min-height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.v7-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
[data-bs-theme="dark"] .v7-btn.primary { color: #10131a; }

/* ---------- 4) KPI row ---------- */
.v7-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.v7-kpi { padding: 12px 14px; border: 1px solid var(--v7-border); border-radius: var(--v7-r-md); background: var(--v7-surface); box-shadow: var(--v7-sh-1); position: relative; overflow: hidden; min-width: 0; }
.v7-kpi .h { display: flex; justify-content: space-between; align-items: center; color: var(--v7-muted); font-size: 12px; font-weight: 600; gap: 8px; }
.v7-kpi .h .bi { color: var(--v7-muted); font-size: 15px; flex: 0 0 auto; }
.v7-kpi .v { margin-top: 8px; font-size: 22px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; color: var(--v7-text); }
.v7-kpi .f { margin-top: 5px; color: var(--v7-muted); font-size: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.v7-kpi.tone-ok .v { color: var(--v7-ok); } .v7-kpi.tone-warn .v { color: var(--v7-warn); }
.v7-kpi.tone-dgr .v { color: var(--v7-dgr); } .v7-kpi.tone-info .v { color: var(--v7-info); }
.v7-kpi.tone-ok { border-color: var(--v7-ok-line); } .v7-kpi.tone-warn { border-color: var(--v7-warn-line); }
.v7-kpi.tone-dgr { border-color: var(--v7-dgr-line); } .v7-kpi.tone-info { border-color: var(--v7-info-line); }

/* ---------- 5) panels/sections ---------- */
.v7-panel { border: 1px solid var(--v7-border); border-radius: var(--v7-r-lg); background: var(--v7-surface); box-shadow: var(--v7-sh-1); margin-bottom: 14px; overflow: hidden; min-width: 0; }
.v7-panel-head { padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--v7-border); flex-wrap: wrap; }
.v7-panel-head h2, .v7-panel-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--v7-text); }
.v7-panel-head .hint { color: var(--v7-muted); font-size: 12.5px; margin: 2px 0 0; }
.v7-panel-body { padding: 14px 16px 16px; }
.v7-panel-body.flush, .v7-panel-body--flush { padding: 0; }
.v7-panel-foot { padding: 10px 12px; border-top: 1px solid var(--v7-border); }

/* ---------- 6) tabs: underline style ---------- */
.v7-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--v7-border); margin-bottom: 14px; overflow: auto; }
.v7-tab { padding: 9px 13px; color: var(--v7-text-2); font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; white-space: nowrap; }
.v7-tab:hover { color: var(--v7-text); text-decoration: none; }
.v7-tab.active { color: var(--v7-brand); border-bottom-color: var(--v7-brand); }
.v7-tab .n { min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 999px; background: var(--v7-s3); color: var(--v7-text-2); font-size: 10.5px; font-weight: 800; }
.v7-tab.active .n { background: var(--v7-brand-soft); color: var(--v7-brand); }

/* ---------- 7) filter toolbar ---------- */
.v7-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--v7-border); border-radius: var(--v7-r-md); background: var(--v7-surface); margin-bottom: 14px; }
.v7-filters--bare { margin: 0; padding: 0; border: 0; background: transparent; }
.v7-finput { display: flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 10px; border: 1px solid var(--v7-border-2); border-radius: var(--v7-r-sm); background: var(--v7-s2); }
.v7-finput:focus-within { border-color: var(--v7-brand); box-shadow: 0 0 0 3px var(--v7-brand-ring); }
.v7-finput .bi { color: var(--v7-muted); font-size: 13.5px; flex: 0 0 auto; }
.v7-finput input, .v7-finput select { border: 0; background: transparent; outline: 0; font-size: 13px; min-width: 110px; color: var(--v7-text); width: auto; flex: 1 1 auto; }
.v7-finput select { appearance: auto; }
.v7-finput input:focus, .v7-finput select:focus { outline: 0; }
.v7-flabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.v7-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--v7-brand-soft); color: var(--v7-brand); font-size: 12.5px; font-weight: 650; text-decoration: none; }
.v7-chip:hover { color: var(--v7-brand); text-decoration: none; filter: brightness(.97); }
.v7-chip .v7-chip-x { width: 20px; height: 20px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 11px; cursor: pointer; }
.v7-chip .v7-chip-x:hover { background: rgba(79, 70, 229, .15); }
.v7-chip--label { background: var(--v7-s3); color: var(--v7-text-2); }

/* ---------- 8) tables ---------- */
.v7-table-wrap { overflow: auto; border: 1px solid var(--v7-border); border-radius: var(--v7-r-md); }
.v7-panel-body--flush .v7-table-wrap, .v7-panel > .v7-table-wrap { border: 0; border-radius: 0; }
.v7-table { width: 100%; min-width: 700px; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.v7-table th { position: sticky; top: 0; z-index: 2; height: 36px; padding: 0 12px; text-align: left; color: var(--v7-muted); background: var(--v7-s2); border-bottom: 1px solid var(--v7-border); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.v7-table td { padding: 10px 12px; border-bottom: 1px solid var(--v7-border); vertical-align: middle; color: var(--v7-text); background: var(--v7-surface); }
.v7-table tbody tr:last-child td { border-bottom: 0; }
.v7-table tbody tr:hover td { background: var(--v7-s2); }
.v7-table .id { font-weight: 650; }
.v7-table .num, .v7-table th.num { text-align: right; }
.v7-table td.num { font-weight: 650; }
.v7-table .sub { color: var(--v7-muted); font-size: 12px; display: block; margin-top: 2px; }
.v7-table .trunc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v7-empty { padding: 34px 20px; text-align: center; color: var(--v7-muted); }
.v7-empty .bi { font-size: 26px; display: block; margin-bottom: 8px; color: var(--v7-border-2); }
.v7-empty strong { display: block; color: var(--v7-text-2); font-size: 14px; margin-bottom: 3px; }
.v7-empty p { margin: 0; font-size: 12.5px; }

/* stackable behavior (mobile) mirrors table-stackable but scoped */
@media (max-width: 767.98px) {
    .v7-table.v7-table--stack { min-width: 0; }
    .v7-table.v7-table--stack thead { display: none; }
    .v7-table.v7-table--stack, .v7-table.v7-table--stack tbody { display: block; }
    .v7-table.v7-table--stack tr { display: block; border: 1px solid var(--v7-border); border-radius: var(--v7-r-sm); background: var(--v7-surface); padding: 6px 10px; margin-bottom: 8px; }
    .v7-table.v7-table--stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px dashed var(--v7-border); padding: 7px 2px; }
    .v7-table.v7-table--stack td:last-child { border-bottom: 0; }
    .v7-table.v7-table--stack td::before { content: attr(data-label); color: var(--v7-muted); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; flex: 0 0 auto; }
    .v7-table.v7-table--stack td[data-label=""]::before, .v7-table.v7-table--stack td:not([data-label])::before { content: ""; }
}

/* ---------- 9) status pills: one semantic shape everywhere ---------- */
.v7-status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid transparent; font-size: 12px; font-weight: 700; white-space: nowrap; }
.v7-status i, .v7-status .v7-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.v7-status.ok { color: var(--v7-ok); background: var(--v7-ok-soft); border-color: var(--v7-ok-line); }
.v7-status.warn { color: var(--v7-warn); background: var(--v7-warn-soft); border-color: var(--v7-warn-line); }
.v7-status.dgr { color: var(--v7-dgr); background: var(--v7-dgr-soft); border-color: var(--v7-dgr-line); }
.v7-status.info, .v7-status.proc { color: var(--v7-info); background: var(--v7-info-soft); border-color: var(--v7-info-line); }
.v7-status.mut { color: var(--v7-neu); background: var(--v7-neu-soft); border-color: var(--v7-neu-line); }
.v7-status.sm { height: 20px; padding: 0 7px; font-size: 11px; }
.v7-status.sm i, .v7-status.sm .v7-dot { width: 6px; height: 6px; }
.v7-status .ring { position: relative; width: 12px; height: 12px; flex: 0 0 auto; }
.v7-status .ring::before { content: ""; position: absolute; inset: 0; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: v7ringspin 1s linear infinite; }
@keyframes v7ringspin { to { transform: rotate(360deg); } }

/* helper for existing helpers (agent-panel-status-*, agent-panel-payment-*, agent-panel-wallet-*) to adopt the pill look inside v7 pages */
.v7-page .agent-panel-status-badge, .v7-page .agent-panel-payment-badge, .v7-page .agent-panel-wallet-badge { border-radius: 999px; font-size: 12px; }

/* ---------- 10) row actions with tooltip ---------- */
.v7-acts { display: inline-flex; gap: 4px; }
.v7-act { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--v7-border); border-radius: 7px; background: var(--v7-surface); color: var(--v7-text-2); position: relative; text-decoration: none; font-size: 13px; }
.v7-act:hover { color: var(--v7-brand); border-color: var(--v7-brand); background: var(--v7-brand-soft); text-decoration: none; }
.v7-act[data-tip]:hover::after, .v7-act[title]:hover::after {
    content: attr(data-tip); position: absolute; top: calc(100% + 5px); right: 0; z-index: 30;
    padding: 4px 9px; border-radius: 6px; background: #1d2733; color: #fff; font-size: 11.5px; font-weight: 600;
    white-space: nowrap; box-shadow: var(--v7-sh-2);
}
.v7-act[title]:hover::after { content: attr(title); }

/* ---------- 11) pagination ---------- */
.v7-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--v7-border); color: var(--v7-muted); font-size: 12.5px; flex-wrap: wrap; background: var(--v7-surface); }
.v7-pager .pages { display: flex; gap: 3px; flex-wrap: wrap; }
.v7-pager .p { min-width: 30px; height: 28px; display: grid; place-items: center; padding: 0 8px; border: 1px solid var(--v7-border); border-radius: 7px; background: var(--v7-surface); color: var(--v7-text-2); font-size: 12.5px; text-decoration: none; }
.v7-pager .p.cur { color: #fff; background: var(--v7-brand); border-color: var(--v7-brand); font-weight: 700; }
.v7-pager .p:hover:not(.cur):not(.disabled) { border-color: var(--v7-brand-2); color: var(--v7-brand); text-decoration: none; }
.v7-pager .p.disabled { opacity: .5; pointer-events: none; }
[data-bs-theme="dark"] .v7-pager .p.cur { color: #10131a; }

/* numbered pagination wrapper restyle inside v7 pages (shared _Pagination partial) */
.v7-page .pagination-shell { border: 1px solid var(--v7-border); border-radius: var(--v7-r-md); background: var(--v7-surface); box-shadow: none; padding: 8px 10px; }
.v7-page .pagination-shell .page-link { border: 1px solid var(--v7-border); border-radius: 7px; color: var(--v7-text-2); margin: 0 1px; font-size: 13px; }
.v7-page .pagination-shell .page-item.active .page-link { background: var(--v7-brand); border-color: var(--v7-brand); color: #fff; }
.v7-page .pagination-shell .page-item.disabled .page-link { opacity: .5; }
.v7-page .pagination-shell .page-link:hover { color: var(--v7-brand); border-color: var(--v7-brand-2); }

/* ---------- 12) alerts ---------- */
.v7-alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border: 1px solid var(--v7-border); border-inline-start: 3px solid var(--v7-info); border-radius: var(--v7-r-sm); background: var(--v7-surface); margin-bottom: 12px; font-size: 13px; color: var(--v7-text); }
.v7-alert .bi { margin-top: 1px; color: var(--v7-info); }
.v7-alert.warn { border-inline-start-color: var(--v7-warn); } .v7-alert.warn .bi { color: var(--v7-warn); }
.v7-alert.dgr { border-inline-start-color: var(--v7-dgr); } .v7-alert.dgr .bi { color: var(--v7-dgr); }
.v7-alert.info { border-inline-start-color: var(--v7-info); } .v7-alert.info .bi { color: var(--v7-info); }
.v7-alert.ok { border-inline-start-color: var(--v7-ok); } .v7-alert.ok .bi { color: var(--v7-ok); }
.v7-alert strong { display: block; font-size: 13px; }
.v7-alert p { margin: 2px 0 0; color: var(--v7-text-2); font-size: 12.5px; }

/* ---------- 13) segmented control ---------- */
.v7-seg { display: inline-flex; padding: 3px; border: 1px solid var(--v7-border); border-radius: 9px; background: var(--v7-s2); gap: 2px; }
.v7-seg button, .v7-seg .v7-seg-btn { padding: 5px 11px; border: 0; border-radius: 7px; background: transparent; color: var(--v7-text-2); font-weight: 600; font-size: 12.5px; }
.v7-seg button.active, .v7-seg .v7-seg-btn.active { background: var(--v7-surface); color: var(--v7-brand); box-shadow: var(--v7-sh-1); }

/* ---------- 14) attention strip (dashboard action center) ---------- */
.v7-attention { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.v7-att { flex: 1 1 200px; display: flex; gap: 10px; align-items: center; padding: 10px 14px; border: 1px solid var(--v7-border); border-radius: var(--v7-r-md); background: var(--v7-surface); text-decoration: none; color: var(--v7-text); box-shadow: var(--v7-sh-1); min-width: 0; }
.v7-att:hover { border-color: var(--v7-brand-2); text-decoration: none; }
.v7-att .bi { font-size: 17px; color: var(--v7-muted); flex: 0 0 auto; }
.v7-att .v7-att-count { font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.v7-att .v7-att-copy { min-width: 0; }
.v7-att .v7-att-copy span { display: block; font-weight: 650; font-size: 13px; }
.v7-att .v7-att-copy small { display: block; color: var(--v7-muted); font-size: 11.5px; }
.v7-att.warn { border-color: var(--v7-warn-line); background: var(--v7-warn-soft); }
.v7-att.warn .bi { color: var(--v7-warn); }
.v7-att.dgr { border-color: var(--v7-dgr-line); background: var(--v7-dgr-soft); }
.v7-att.dgr .bi { color: var(--v7-dgr); }

/* ---------- 15) wallet strip (agent) ---------- */
.v7-wallet-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.v7-wallet-strip .v7-card-w { padding: 12px 14px; border: 1px solid var(--v7-border); border-radius: var(--v7-r-md); background: var(--v7-surface); min-width: 0; }
.v7-wallet-strip .v7-card-w.balance { color: #fff; border: 0; background: linear-gradient(135deg, #3730a3, #4f46e5 60%, #0d9488); }
.v7-wallet-strip .v7-card-w.balance .v { font-size: 23px; }
.v7-wallet-strip .l { color: inherit; opacity: .75; font-size: 11.5px; font-weight: 600; }
.v7-wallet-strip .v { margin-top: 6px; font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--v7-text); }
.v7-wallet-strip .v7-card-w.balance .v { color: #fff; }
.v7-wallet-strip .f { margin-top: 4px; opacity: .75; font-size: 11.5px; color: var(--v7-muted); }
.v7-wallet-strip .v7-card-w.balance .f { color: rgba(255, 255, 255, .8); }
.v7-wallet-strip .pos { color: var(--v7-ok); }
.v7-wallet-strip .neg { color: var(--v7-dgr); }

/* ---------- 16) catalog cards ---------- */
/* ---------- 16b) agent catalog (v721 compact redesign) ---------- */
/* Capped at six cards per row. `auto-fill` with a 198px minimum produced seven columns on a wide
   desktop viewport, which made each card narrow enough that the group name and the footer price
   competed for the same line. Six is the widest row that keeps the card readable; the media queries
   below step it down for narrower viewports. */
.v7-catalog { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.v7-cat { display: flex; gap: 11px; align-items: center; border: 1px solid var(--v7-border); border-radius: var(--v7-r-md); background: var(--v7-surface); padding: 11px 13px; text-decoration: none; color: var(--v7-text); box-shadow: var(--v7-sh-1); transition: border-color .13s, box-shadow .13s, transform .13s; }
.v7-cat:hover { border-color: var(--v7-brand-2); transform: translateY(-1px); box-shadow: var(--v7-sh-2); text-decoration: none; color: var(--v7-text); }
.v7-cat.is-active { border-color: var(--v7-brand); box-shadow: 0 0 0 3px var(--v7-brand-ring); }
.v7-cat .th { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; background: linear-gradient(135deg, var(--v7-brand), #6366f1 55%, #20a8a3); overflow: hidden; }
.v7-cat .th img { width: 100%; height: 100%; object-fit: cover; }
.v7-cat .th > span { font-size: 15px; font-weight: 800; }
.v7-cat .bd { min-width: 0; flex: 1 1 auto; }
.v7-cat h3 { margin: 0; font-size: 13.5px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v7-cat .meta { margin: 1px 0 0; color: var(--v7-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v7-cat .foot { margin-top: 3px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.v7-cat .price { font-weight: 800; font-size: 12.5px; color: var(--v7-ok); white-space: nowrap; }
.v7-cat .price.v7-muted-c { color: var(--v7-muted); font-weight: 650; font-size: 11.5px; }
.v7-cat.unavailable { opacity: .72; }
.v7-cat.unavailable .th { background: linear-gradient(135deg, var(--v7-s3), var(--v7-neu-soft)); color: var(--v7-muted); }
/* The narrow-viewport step-downs for .v7-catalog live with the other responsive rules in section 20,
   so this grid has exactly one place that decides its column count. */

/* ---------- 17) checkout summary (sticky, agent order create) ---------- */
.v7-checkout { border: 1px solid var(--v7-border); border-radius: var(--v7-r-lg); background: var(--v7-surface); overflow: hidden; }
.v7-checkout .row { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; font-size: 13px; }
.v7-checkout .row + .row { border-top: 1px solid var(--v7-border); }
.v7-checkout .row.total { background: var(--v7-s2); font-weight: 700; font-size: 14px; }
.v7-checkout .row .l { color: var(--v7-muted); }
.v7-checkout .row .r { font-variant-numeric: tabular-nums; font-weight: 650; }
.v7-checkout .bar { padding: 12px 14px; border-top: 1px solid var(--v7-border); display: flex; gap: 8px; align-items: center; justify-content: space-between; background: var(--v7-surface); flex-wrap: wrap; }
.v7-checkout .bar .v7-btn.primary { min-height: 44px; flex: 1 1 100%; justify-content: center; font-size: 15px; }
.v7-sticky { position: sticky; top: 12px; }
.agent-main .v7-sticky { top: 84px; }
.v7-hintlist { margin-top: 10px; padding: 11px 14px; border: 1px dashed var(--v7-border-2); border-radius: 12px; color: var(--v7-muted); font-size: 12px; display: grid; gap: 6px; }
.v7-hintlist .bi { color: var(--v7-brand); }

/* ---------- 18) form fields (agent order create) ---------- */
.v7-order-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.v7-order-grid > .v7-order-main { grid-column: 1; grid-row: 1; min-width: 0; }
.v7-order-grid > .v7-checkout { grid-column: 2; grid-row: 1; min-width: 0; }
.v7-order-grid > .agent-mobile-checkout { grid-column: 1 / -1; grid-row: 2; }
.v7-order-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.v7-order-input--wide { grid-column: 1 / -1; }
.v7-form-grid { display: grid; gap: 14px; }
.v7-field label { display: block; margin: 0 0 5px; color: var(--v7-muted); font-size: 12px; font-weight: 650; }
.v7-field .form-text { color: var(--v7-muted); font-size: 11.5px; margin-top: 4px; }
.v7-field input, .v7-field select, .v7-field textarea { border: 1px solid var(--v7-border-2); border-radius: var(--v7-r-sm); background: var(--v7-s2); font-size: 13px; padding: .5rem .65rem; color: var(--v7-text); width: 100%; }
.v7-field input:focus, .v7-field select:focus, .v7-field textarea:focus { border-color: var(--v7-brand); box-shadow: 0 0 0 3px var(--v7-brand-ring); background: var(--v7-surface); outline: 0; }
.v7-field .input-group { border: 1px solid var(--v7-border-2); border-radius: var(--v7-r-sm); background: var(--v7-s2); overflow: hidden; display: flex; align-items: stretch; }
.v7-field .input-group input { border: 0; box-shadow: none; background: transparent; flex: 1 1 auto; min-width: 0; }
.v7-field .input-group input:focus { box-shadow: none; background: transparent; border: 0; }
.v7-field .input-group .btn { border: 0; border-inline-start: 1px solid var(--v7-border-2); border-radius: 0; background: var(--v7-surface); color: var(--v7-text-2); font-weight: 650; font-size: 12.5px; }
.v7-field .input-group .btn:hover { background: var(--v7-s2); color: var(--v7-brand); }
.v7-field .text-danger { color: var(--v7-dgr); }
.v7-field .v7-required { color: var(--v7-dgr); font-weight: 700; }

/* ---------- 18b) anonymized supplier options (agent order form) ---------- */
.v7-supplier-options { margin-top: 14px; border: 1px solid var(--v7-border); border-radius: var(--v7-r-md); background: var(--v7-surface); overflow: hidden; }
.v7-supplier-options__head { padding: 10px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--v7-s2); border-bottom: 1px solid var(--v7-border); }
.v7-supplier-options__title { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 13px; color: var(--v7-text); }
.v7-supplier-options__count { min-width: 22px; text-align: center; padding: 1px 7px; border: 1px solid var(--v7-brand); border-radius: 999px; background: var(--v7-brand-soft); color: var(--v7-brand); font-size: 11.5px; font-weight: 800; }
.v7-supplier-options__hint { color: var(--v7-muted); font-size: 11.5px; }
.v7-supplier-options__list { display: grid; gap: 8px; padding: 12px; }
.v7-supplier-options__foot { padding: 8px 13px; border-top: 1px solid var(--v7-border); background: var(--v7-s2); color: var(--v7-muted); font-size: 11.5px; }

.v7-supplier-option { position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 1.5px solid var(--v7-border-2); border-radius: var(--v7-r-md); background: var(--v7-surface); cursor: pointer; transition: border-color .14s, background .14s, box-shadow .14s; }
.v7-supplier-option:hover { border-color: var(--v7-brand-2); }
.v7-supplier-option input { position: absolute; opacity: 0; pointer-events: none; }
.v7-supplier-option:focus-within { border-color: var(--v7-brand); box-shadow: 0 0 0 3px var(--v7-brand-ring); }
.v7-supplier-option__radio { width: 17px; height: 17px; flex: 0 0 auto; border: 2px solid var(--v7-border-2); border-radius: 50%; position: relative; }
.v7-supplier-option.is-selected { border-color: var(--v7-brand); background: var(--v7-brand-soft); box-shadow: 0 0 0 3px var(--v7-brand-ring); }
.v7-supplier-option.is-selected .v7-supplier-option__radio { border-color: var(--v7-brand); }
.v7-supplier-option.is-selected .v7-supplier-option__radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--v7-brand); }
.v7-supplier-option__alias { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--v7-border-2); border-radius: 11px; background: var(--v7-s2); color: var(--v7-text-2); font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
.v7-supplier-option.is-selected .v7-supplier-option__alias { border-color: var(--v7-brand); background: var(--v7-surface); color: var(--v7-brand); }
.v7-supplier-option__meta { flex: 1 1 auto; min-width: 0; }
.v7-supplier-option__name { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-weight: 750; font-size: 13px; color: var(--v7-text); }
.v7-supplier-option__desc { display: block; margin-top: 2px; color: var(--v7-muted); font-size: 11.5px; }
.v7-supplier-option__price { flex: 0 0 auto; text-align: end; display: grid; gap: 1px; }
.v7-supplier-option__price .u { font-weight: 800; font-size: 14.5px; color: var(--v7-text); font-variant-numeric: tabular-nums; }
.v7-supplier-option__price .c { color: var(--v7-muted); font-size: 11px; }
.v7-supplier-option__price .delta { color: var(--v7-warn); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }

.v7-supplier-option.is-on-hold { cursor: not-allowed; border-style: dashed; background: var(--v7-s2); }
.v7-supplier-option.is-on-hold:hover { border-color: var(--v7-border-2); }
.v7-supplier-option.is-on-hold .v7-supplier-option__alias { color: var(--v7-muted); }
.v7-supplier-option.is-on-hold .v7-supplier-option__name { color: var(--v7-text-2); }
.v7-supplier-option.is-on-hold .v7-supplier-option__price .u { color: var(--v7-text-2); }
.v7-supplier-option.is-on-hold .v7-supplier-option__price .c::after { content: " · reference"; }

.v7-supplier-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1.5px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 800; letter-spacing: .02em; }
.v7-supplier-badge .bi { font-size: 10px; }
.v7-supplier-badge--cheapest { background: var(--v7-ok-soft); color: var(--v7-ok); border: 1px solid var(--v7-ok-line); }
.v7-supplier-badge--hold { background: var(--v7-warn-soft); color: var(--v7-warn); border: 1px solid var(--v7-warn-line); }
.v7-supplier-badge--selected { background: var(--v7-brand-soft); color: var(--v7-brand); border: 1px solid var(--v7-brand); }

.v7-supplier-delta-note { border: 1px solid var(--v7-warn-line); border-radius: var(--v7-r-sm); background: var(--v7-warn-soft); color: var(--v7-warn); padding: 7px 11px; font-size: 12px; font-weight: 650; margin-bottom: 8px; }

@media (max-width: 640px) {
    .v7-supplier-option { flex-wrap: wrap; }
    .v7-supplier-option__price { flex: 1 1 100%; text-align: start; display: flex; align-items: baseline; gap: 8px; }
    .v7-supplier-option__price .c { order: 3; }
}

/* ---------- 18c) agent catalog modal (v721: products ⟷ order-details, mutually exclusive) ---------- */
.agent-products-modal .modal-content { border: 0; border-radius: var(--v7-r-lg); background: var(--v7-surface); overflow: hidden; }
.agent-products-modal .modal-body { padding: 0; }
.v7-catmodal { border: 0; border-radius: 0; box-shadow: none; margin: 0; overflow: visible; min-width: 0; background: var(--v7-surface); }

.v7-catbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--v7-surface); border-bottom: 1px solid var(--v7-border); flex-wrap: wrap; }
.v7-catback { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--v7-border-2); border-radius: 999px; background: var(--v7-surface); color: var(--v7-text-2); font-weight: 750; font-size: 12px; padding: 6px 13px; cursor: pointer; white-space: nowrap; }
.v7-catback:hover { color: var(--v7-brand); border-color: var(--v7-brand); }
.v7-catback .bi { font-size: 12px; }
.v7-catbar__id { display: flex; align-items: center; gap: 10px; flex: 1 1 140px; min-width: 0; }
.v7-catbar__av { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; background: linear-gradient(135deg, var(--v7-brand), #20a8a3); overflow: hidden; }
.v7-catbar__av img { width: 100%; height: 100%; object-fit: cover; }
.v7-catbar__av i { font-size: 16px; }
.v7-catbar__tt { min-width: 0; }
.v7-catbar__tt b { display: block; font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v7-catbar__tt span { color: var(--v7-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.v7-catbar__x { border: 0; background: transparent; color: var(--v7-muted); cursor: pointer; font-size: 15px; padding: 6px; border-radius: 8px; }
.v7-catbar__x:hover { background: var(--v7-s3); color: var(--v7-text); }

/* exclusive modes — a scoped [hidden] guard keeps author display rules from
   resurrecting a hidden mode (the bug the v721 prototype surfaced) */
.v7-catmode[hidden] { display: none !important; }
.v7-catmode--products { display: flex; flex-direction: column; }
.v7-catmode--order { display: block; }

.v7-catfilters { padding: 10px 12px; border-bottom: 1px solid var(--v7-border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.v7-fsearch { flex: 1 1 150px; min-width: 0; display: flex; align-items: center; gap: 7px; border: 1px solid var(--v7-border-2); border-radius: var(--v7-r-sm); background: var(--v7-s2); padding: 0 10px; color: var(--v7-muted); position: relative; }
.v7-fsearch .bi { font-size: 13px; }
.v7-fsearch input { border: 0; background: transparent; outline: 0; padding: 8px 0; font-size: 12.5px; color: var(--v7-text); flex: 1; min-width: 0; }
.v7-fsearch input:focus { outline: 0; }
.v7-fsearch:focus-within { border-color: var(--v7-brand); box-shadow: 0 0 0 3px var(--v7-brand-ring); background: var(--v7-surface); }
.v7-fsort { border: 1px solid var(--v7-border-2); border-radius: var(--v7-r-sm); background: var(--v7-s2); color: var(--v7-text); font-size: 12.5px; font-weight: 650; padding: 8px 9px; outline: 0; max-width: 170px; }
.v7-fsort:focus { border-color: var(--v7-brand); box-shadow: 0 0 0 3px var(--v7-brand-ring); }
.v7-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--v7-border-2); border-radius: 999px; background: var(--v7-surface); padding: 7px 13px; font-size: 12px; font-weight: 700; color: var(--v7-text-2); cursor: pointer; user-select: none; position: relative; }
.v7-pill input { position: absolute; opacity: 0; pointer-events: none; }
.v7-pill .pd { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--v7-muted); }
.v7-pill:has(input:checked) { border-color: var(--v7-ok); color: var(--v7-ok); background: var(--v7-ok-soft); }
.v7-pill:has(input:checked) .pd { background: var(--v7-ok); }
.v7-pill:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--v7-brand-ring); }
.v7-fstatus { color: var(--v7-muted); font-size: 11px; margin: 0; padding: 0 4px; }

/* compact product rows (v7 layer must beat aurora's !important row chrome) */
.v7-catmodal .agent-product-list { display: block; grid-template-columns: none; }
.v7-catmodal .agent-product-row { display: flex; gap: 10px; align-items: center; padding: 9px 13px !important; border: 0 !important; border-bottom: 1px solid var(--v7-border) !important; border-radius: 0 !important; background: var(--v7-surface); cursor: pointer; transition: background .1s; text-align: start; width: 100%; }
.v7-catmodal .agent-product-row:hover { background: var(--v7-s2); }
.v7-catmodal .agent-product-row.is-selected { background: var(--v7-brand-soft); box-shadow: inset 3px 0 0 var(--v7-brand) !important; }
.v7-catmodal .agent-product-row--unavailable { cursor: default; opacity: .62; }
.v7-catmodal .agent-product-row--unavailable:hover { background: var(--v7-surface); }
.v7-prow__av { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 11px; display: grid; place-items: center; background: var(--v7-s3); color: var(--v7-text-2); font-weight: 800; font-size: 13px; overflow: hidden; }
.v7-prow__av img { width: 100%; height: 100%; object-fit: cover; }
.v7-prow__meta { flex: 1 1 auto; min-width: 0; }
.v7-prow__name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.v7-prow__name b { font-size: 13px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v7-prow__dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--v7-ok); }
.v7-prow__dot--off { background: var(--v7-muted); }
.v7-prow__sub { color: var(--v7-muted); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v7-prow__opts { display: inline-block; margin-inline-start: 6px; padding: 1px 7px; border-radius: 999px; font-size: 9.5px; font-weight: 800; background: var(--v7-info-soft); color: var(--v7-info); }
.v7-prow__price { flex: 0 0 auto; text-align: end; font-weight: 800; font-size: 13.5px; color: var(--v7-text); font-variant-numeric: tabular-nums; }
.v7-prow__price--na { font-weight: 650; font-size: 11px; color: var(--v7-muted); }
.v7-catmodal .agent-empty-list { margin: 12px; }

/* order-details mode hosts the v720 order panel without double framing */
.v7-catmode--order .agent-order-panel-host { display: block; }
.v7-catmodal .agent-inline-order-panel { border: 0; border-radius: 0; margin: 0; box-shadow: none; }

@media (max-width: 991.98px) {
    .agent-products-modal .modal-content { border-radius: 0; }
    .v7-catbar { padding: 8px 10px; gap: 8px; }
    .v7-catbar__tt b { font-size: 13.5px; }
    .v7-catback { padding: 6px 11px; font-size: 11.5px; }
}

/* ---------- 19) misc ---------- */
.v7-num { font-variant-numeric: tabular-nums; }
.v7-mono { font-family: Consolas, "SF Mono", monospace; direction: ltr; unicode-bidi: embed; }
.v7-section-gap { height: 14px; }
.v7-summary-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0; font-size: 13px; }
.v7-summary-dl dt { color: var(--v7-muted); font-weight: 600; }
.v7-summary-dl dd { margin: 0; text-align: end; font-weight: 650; font-variant-numeric: tabular-nums; }
.v7-health-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.v7-health-grid > div { padding: 11px 14px; border: 1px solid var(--v7-border); border-radius: var(--v7-r-sm); background: var(--v7-surface); }
.v7-health-grid strong { display: block; font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; }
.v7-health-grid span { display: block; margin-top: 2px; color: var(--v7-muted); font-size: 12px; }
.v7-freshness { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 14px; border: 1px dashed var(--v7-border-2); border-radius: 12px; color: var(--v7-muted); font-size: 12px; background: var(--v7-surface); }
.v7-freshness .bi { color: var(--v7-brand); }
.v7-freshness span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.v7-kpi-split { display: grid; grid-template-columns: 1.7fr 1fr; gap: 12px; align-items: start; }
.v7-stack { display: grid; gap: 14px; align-content: start; }
.v7-att .v7-att-copy small, .v7-table .sub { overflow-wrap: anywhere; }
.v7-chart-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.v7-chart-head h2, .v7-chart-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.v7-chart-badge { padding: 2px 10px; border-radius: 999px; background: var(--v7-brand-soft); color: var(--v7-brand); font-size: 11.5px; font-weight: 650; }
.v7-rail { display: grid; gap: 12px; align-content: start; }
.v7-balance-amount { font-variant-numeric: tabular-nums; font-weight: 650; }

/* ---------- 20) responsive ---------- */
/* .v7-catalog is capped at six columns by its base rule. A card needs ~198px to stay readable (below
   that the group name and the footer price compete for the same line and both truncate), so a
   six-column row needs 6 x 198 + 5 x 10 gap = 1238px of container width. The agent shell is
   min(100%, 1580px) with 28px side padding, so container = viewport - 56px and 6 columns hold down to
   a ~1294px viewport. Bands below that step 5 -> 4 -> 3 -> 2 -> 1 rather than dropping straight to one. */
@media (max-width: 1300px) {
    .v7-catalog { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 1250px) {
    .v7-kpis { grid-template-columns: repeat(2, 1fr); }
    .v7-wallet-strip { grid-template-columns: repeat(2, 1fr); }
    .v7-catalog { grid-template-columns: repeat(4, 1fr); }
    .v7-health-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 991.98px) {
    .v7-kpi-split { grid-template-columns: 1fr; }
    .v7-catalog { grid-template-columns: repeat(3, 1fr); }
    .v7-order-grid { grid-template-columns: 1fr; }
    .v7-order-grid > .v7-order-main, .v7-order-grid > .v7-checkout, .v7-order-grid > .agent-mobile-checkout { grid-column: 1 / -1; grid-row: auto; }
    .v7-order-grid .v7-sticky { position: static; }
}
@media (max-width: 767.98px) {
    .v7-kpis { grid-template-columns: 1fr; }
    .v7-wallet-strip { grid-template-columns: 1fr 1fr; }
    .v7-catalog { grid-template-columns: repeat(2, 1fr); }
    .v7-pagehead { flex-direction: column; align-items: stretch; }
    .v7-actions { justify-content: flex-start; }
    .v7-actions .v7-filters--bare { width: 100%; }
    .v7-sticky { position: static; }
    .v7-health-grid { grid-template-columns: 1fr; }
    .v7-finput { flex: 1 1 100%; }
    .v7-order-inputs { grid-template-columns: 1fr; }
}
@media (max-width: 425px) {
    .v7-wallet-strip { grid-template-columns: 1fr; }
    .v7-catalog { grid-template-columns: 1fr; }
}

/* print */
@media print {
    .v7-actions, .v7-filters, .v7-pager, .v7-att .bi { display: none !important; }
}
