:root {
  --cqr-ink: #17221c;
  --cqr-muted: #637067;
  --cqr-green: #176b45;
  --cqr-lime: #dff4c7;
  --cqr-cream: #f7f5ed;
  --cqr-line: #dfe5df;
  --cqr-danger: #a53030;
}

.cqr-wrap { max-width: 1180px; color: var(--cqr-ink); }
.cqr-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 24px 0; }
.cqr-heading h1 { margin: 0 0 6px; font-size: 30px; font-weight: 650; }
.cqr-heading p { margin: 0; color: var(--cqr-muted); }
.cqr-wrap .nav-tab-wrapper { margin-bottom: 22px; }
.cqr-card { background: #fff; border: 1px solid var(--cqr-line); border-radius: 14px; box-shadow: 0 4px 20px rgba(23,34,28,.05); padding: 24px; }
.cqr-narrow { max-width: 780px; display: grid; gap: 18px; }
.cqr-form { display: grid; gap: 10px; margin-top: 20px; }
.cqr-form input, .cqr-form select, .cqr-form textarea, #cqr-scan-method, #cqr-camera-device { width: 100%; max-width: none; min-height: 44px; }
.cqr-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cqr-field-row > div { display: grid; gap: 8px; }
.cqr-form-section { margin-top: 16px; border-top: 1px solid var(--cqr-line); padding-top: 20px; }
.cqr-step { display: inline-grid; place-items: center; width: 27px; height: 27px; margin: 0 8px 0 0; border-radius: 50%; color: #fff; background: var(--cqr-green); font-weight: 800; float: left; }
.cqr-form-actions { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.cqr-form-actions small { color: var(--cqr-muted); }
.cqr-secondary summary { cursor: pointer; font-size: 15px; font-weight: 700; }
.cqr-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.cqr-stats-wide { grid-template-columns: repeat(5, 1fr); }
.cqr-stats div { display: grid; padding: 20px; border: 1px solid var(--cqr-line); border-radius: 12px; background: #fff; }
.cqr-stats strong { font-size: 30px; line-height: 1; }
.cqr-stats span { margin-top: 8px; color: var(--cqr-muted); }
.cqr-action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.cqr-action-grid a { display: grid; grid-template-columns: 46px 1fr; column-gap: 14px; padding: 24px; border: 1px solid var(--cqr-line); border-radius: 14px; background: #fff; color: var(--cqr-ink); text-decoration: none; box-shadow: 0 4px 20px rgba(23,34,28,.04); }
.cqr-action-grid a:hover { border-color: var(--cqr-green); transform: translateY(-1px); }
.cqr-action-grid .dashicons { grid-row: 1 / 3; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 11px; background: var(--cqr-lime); color: var(--cqr-green); font-size: 25px; }
.cqr-action-grid strong { font-size: 17px; }
.cqr-action-grid small { margin-top: 3px; color: var(--cqr-muted); }
.cqr-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.cqr-section-heading h2 { margin-bottom: 4px; }
.cqr-section-heading p { margin-top: 0; color: var(--cqr-muted); }
.cqr-section-heading input[type="search"] { width: min(360px, 100%); min-height: 42px; }
.cqr-row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 280px; }
.cqr-ifx-form { display: inline-flex; margin: 0; }
.cqr-trash-form { display: inline-flex; align-items: center; margin: 0 5px; }
.cqr-trash-form .button-link-delete { cursor: pointer; }
.cqr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.cqr-grid-form form { display: grid; gap: 9px; margin-top: 22px; }
.cqr-grid-form input, .cqr-grid-form select, .cqr-grid-form textarea { width: 100%; max-width: none; }
.cqr-grid-form button { justify-self: start; margin-top: 12px; }
.cqr-list-card h2 { margin-top: 0; }
.cqr-table-scroll { overflow-x: auto; }
.cqr-list-card table { border: 0; }
.cqr-list-card th, .cqr-list-card td { padding: 14px 12px; vertical-align: middle; }
.cqr-list-card td small { display: block; margin-top: 3px; color: var(--cqr-muted); }
.cqr-code { display: block; font: 700 21px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .13em; color: var(--cqr-ink); }
.cqr-status { display: inline-block; border-radius: 999px; padding: 4px 10px; font-weight: 600; }
.cqr-status-active { color: #145c3c; background: #ddf5e9; }
.cqr-status-redeemed { color: #5f6670; background: #eceef0; }
.cqr-status-expired { color: #8a3030; background: #f9e2e2; }
.cqr-status-draft { color: #665a24; background: #fff4bf; }
.cqr-empty { padding: 50px 20px; text-align: center; color: var(--cqr-muted); background: var(--cqr-cream); border-radius: 10px; }
.cqr-modal[hidden] { display: none; }
.cqr-modal { position: fixed; inset: 0; z-index: 100100; display: grid; place-items: center; padding: 20px; background: rgba(9,18,13,.68); }
.cqr-modal-card { position: relative; width: min(420px, 100%); padding: 36px; border-radius: 20px; background: var(--cqr-cream); text-align: center; }
.cqr-delivery-modal { overflow-y: auto; align-items: start; }
.cqr-delivery-card { width: min(980px, 100%); margin: 28px auto; text-align: left; }
.cqr-template-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.cqr-template-picker label { cursor: pointer; }
.cqr-template-picker input { position: absolute; opacity: 0; pointer-events: none; }
.cqr-template-picker label > span { display: grid; gap: 8px; height: 100%; padding: 8px; border: 2px solid transparent; border-radius: 10px; background: #fff; }
.cqr-template-picker input:checked + span { border-color: var(--cqr-green); box-shadow: 0 0 0 2px rgba(23,107,69,.12); }
.cqr-template-picker img { width: 100%; aspect-ratio: 17/6; object-fit: cover; border-radius: 6px; }
.cqr-template-picker .dashicons { display: grid; place-items: center; width: 100%; height: 90px; background: #ecefea; color: var(--cqr-green); font-size: 34px; }
.cqr-email-builder { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin: 22px 0; padding-top: 22px; border-top: 1px solid var(--cqr-line); }
.cqr-email-fields { display: grid; gap: 8px; }
.cqr-email-fields input, .cqr-email-fields textarea { width: 100%; max-width: none; }
.cqr-email-preview { padding: 18px; border-radius: 12px; background: #e9ebed; }
.cqr-email-preview-card { overflow: hidden; padding: 24px; border-top: 7px solid #e21a22; border-radius: 10px; background: #fff; box-shadow: 0 5px 20px rgba(0,0,0,.08); }
.cqr-email-preview-card small { color: #e21a22; font-weight: 800; letter-spacing: .12em; }
.cqr-email-preview-card h3 { margin: 8px 0; font-size: 24px; }
.cqr-email-preview-gift { display: grid; gap: 9px; margin-top: 18px; padding: 18px; border-radius: 9px; background: #171717; color: #fff; }
.cqr-email-preview-gift b { color: #ff3434; font-size: 27px; }
.cqr-delivery-status { min-height: 20px; color: var(--cqr-green); font-weight: 700; }
.cqr-template-admin { display: grid; gap: 20px; }
.cqr-template-settings { display: grid; gap: 20px; margin-top: 22px; }
.cqr-template-manage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cqr-template-manage-card { overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--cqr-line); border-radius: 12px; background: #fff; }
.cqr-template-full-preview { position: relative; display: block; overflow: hidden; width: 100%; aspect-ratio: 17 / 6; background: #111; text-decoration: none; }
.cqr-template-full-preview > img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; background: #111; }
.cqr-template-placeholder { display: grid; place-content: center; justify-items: center; gap: 8px; width: 100%; height: 100%; background: #f1f2f3; color: var(--cqr-muted); }
.cqr-template-placeholder .dashicons { width: 38px; height: 38px; font-size: 38px; }
.cqr-template-open-label { position: absolute; right: 10px; bottom: 10px; padding: 7px 10px; border-radius: 7px; background: rgba(0,0,0,.76); color: #fff; font-size: 12px; font-weight: 700; }
.cqr-template-manage-fields { display: grid; align-content: center; gap: 8px; padding: 16px; }
.cqr-template-manage-fields > input[type="text"] { width: 100%; max-width: none; }
.cqr-template-check { display: flex !important; align-items: flex-start; gap: 8px; margin: 4px 0 !important; font-weight: 600; }
.cqr-template-check input { flex: 0 0 auto; width: auto !important; margin: 2px 0 0 !important; }
.cqr-template-manage-fields small { color: var(--cqr-muted); }
.cqr-template-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-top: 22px; }
.cqr-template-gallery > div { display: grid; gap: 8px; }
.cqr-template-gallery img { width: 100%; aspect-ratio: 17/6; object-fit: cover; border-radius: 8px; border: 1px solid var(--cqr-line); }
.cqr-upload-form { max-width: 600px; padding-top: 18px; }
.cqr-custom-list { margin-top: 26px; }
.cqr-custom-list > div { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--cqr-line); }
.cqr-custom-list form { margin-left: auto; }
.cqr-modal-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 30px; cursor: pointer; }
#cqr-qr-output { width: 260px; max-width: 100%; margin: 20px auto; }
#cqr-qr-output svg, .cqr-public-qr svg { display: block; width: 100%; height: auto; }
.cqr-modal-code { font: 800 30px/1 ui-monospace, monospace; letter-spacing: .16em; }
.cqr-eyebrow { margin: 0 0 8px; color: var(--cqr-green); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.cqr-scanner-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 22px; }
.cqr-camera { position: relative; overflow: hidden; aspect-ratio: 4/3; margin: 20px 0 14px; border-radius: 14px; background: #132019; }
.cqr-camera video { width: 100%; height: 100%; object-fit: cover; }
.cqr-scan-frame { position: absolute; inset: 20%; border: 3px solid var(--cqr-lime); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.16); }
.cqr-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 12px; color: var(--cqr-muted); }
.cqr-divider::before, .cqr-divider::after { content: ''; flex: 1; height: 1px; background: var(--cqr-line); }
#cqr-manual-form { display: flex; gap: 8px; }
#cqr-code-panel { margin-top: 22px; padding: 20px; border-radius: 12px; background: var(--cqr-cream); }
#cqr-manual-code { flex: 1; min-height: 46px; text-align: center; text-transform: uppercase; font: 800 23px/1 ui-monospace, monospace; letter-spacing: .15em; }
#cqr-scanner-message { min-height: 22px; color: var(--cqr-danger); font-weight: 600; }
.cqr-result[data-status="active"] { border-top: 5px solid var(--cqr-green); }
.cqr-result dl div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--cqr-line); }
.cqr-result dt { color: var(--cqr-muted); }
.cqr-result dd { margin: 0; text-align: right; font-weight: 650; }
.cqr-result label { display: block; margin: 22px 0 6px; }
.cqr-result input { width: 100%; margin-bottom: 12px; }
.cqr-result button { width: 100%; }
.cqr-redeem-choice { display: grid; gap: 10px; margin: 20px 0 8px; padding: 16px; border: 1px solid var(--cqr-line); border-radius: 12px; background: var(--cqr-cream); }
.cqr-redeem-choice legend { padding: 0 7px; font-weight: 750; }
.cqr-redeem-choice label { display: flex; align-items: center; gap: 9px; margin: 0; font-weight: 600; }
.cqr-redeem-choice input { width: auto; margin: 0; }
.cqr-balance-preview { min-height: 24px; margin: 12px 0; padding: 12px 14px; border-left: 4px solid var(--cqr-green); background: var(--cqr-lime); font-weight: 700; }
.cqr-oldest-card { margin-top: 20px; }
.cqr-oldest-card .widefat th, .cqr-oldest-card .widefat td { padding: 12px; vertical-align: middle; }
.cqr-public { display: grid; gap: 20px; }
.cqr-gift-card { display: grid; grid-template-columns: 1fr 180px; gap: 28px; align-items: center; padding: 28px; border: 1px solid #dfe5df; border-radius: 18px; background: linear-gradient(135deg, #f8f7ef, #eef6ea); color: var(--cqr-ink); }
.cqr-gift-card h3 { margin: 4px 0 12px; font-size: 34px; }
.cqr-gift-card small { display: block; margin-top: 7px; color: var(--cqr-muted); }
.cqr-copy-code { margin-top: 12px; padding: 8px 13px; border: 1px solid var(--cqr-green); border-radius: 7px; background: transparent; color: var(--cqr-green); font-weight: 700; cursor: pointer; }
.cqr-api-created { border: 2px solid #2d6749; background: #f1fbf5; }
.cqr-api-secret { width: 100%; margin: 12px 0 !important; padding: 16px !important; border: 2px dashed #2d6749 !important; background: #fff !important; color: #17231d !important; font: 700 20px/1.25 Consolas, monospace !important; text-align: center; cursor: pointer; }
.cqr-pos-connections .cqr-card { margin-bottom: 20px; }
.cqr-public-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cqr-public-actions button, .cqr-public-actions a { margin-top: 12px; padding: 8px 13px; border: 1px solid var(--cqr-green); border-radius: 7px; background: transparent; color: var(--cqr-green); font-weight: 700; cursor: pointer; text-decoration: none; }
.cqr-wallet-status { display: grid; gap: 12px; margin: 22px 0; }
.cqr-wallet-status div { display: grid; gap: 5px; padding: 16px; border: 1px solid var(--cqr-line); border-radius: 10px; }
.cqr-wallet-status span { color: var(--cqr-muted); }
.cqr-callout { padding: 14px 16px; border-left: 4px solid var(--cqr-green); background: var(--cqr-lime); }
.cqr-gift-card-redeemed, .cqr-gift-card-expired { filter: grayscale(1); opacity: .65; }
.cqr-public-qr { width: 180px; padding: 8px; background: #fff; border-radius: 9px; }
.cqr-standalone-page { margin: 0; background: #f0f1f2; color: #1d2327; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.cqr-standalone-main { width: min(1720px, calc(100% - 36px)); margin: 0 auto; padding: 36px 0 70px; }
.cqr-portal-wrap { max-width: none; margin: 0; }
.cqr-portal-wrap .nav-tab-wrapper { display: flex; flex-wrap: wrap; gap: 8px; margin: 30px 0 24px; border-bottom: 1px solid #c3c4c7; }
.cqr-portal-wrap .nav-tab { display: inline-block; margin: 0 0 -1px; padding: 11px 17px; border: 1px solid #c3c4c7; background: #dcdcde; color: #2c3338; font-weight: 600; text-decoration: none; }
.cqr-portal-wrap .nav-tab-active { border-bottom-color: #f0f1f2; background: #f0f1f2; }
.cqr-portal-wrap .button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 5px 14px; border: 1px solid #4b5eea; border-radius: 3px; background: #fff; color: #3f52e3; font-weight: 600; line-height: 1.3; text-decoration: none; cursor: pointer; }
.cqr-portal-wrap .button-primary { background: #4858df; color: #fff; }
.cqr-portal-wrap .button-hero { min-height: 48px; padding: 10px 25px; }
.cqr-portal-wrap .widefat { width: 100%; border-collapse: collapse; background: #fff; }
.cqr-portal-wrap .widefat th { text-align: left; }
.cqr-portal-wrap .widefat tr:nth-child(even) { background: #f6f7f7; }
.cqr-portal-wrap input, .cqr-portal-wrap select, .cqr-portal-wrap textarea { box-sizing: border-box; }
.cqr-product-fields { margin: 20px 0; padding: 20px; border: 1px solid #d8d8d8; border-radius: 10px; background: #fafafa; }
.cqr-product-fields h3 { margin-top: 0; }
.cqr-product-fields label { display: block; margin-bottom: 5px; font-weight: 700; }
.cqr-product-fields input, .cqr-product-fields select, .cqr-product-fields textarea { box-sizing: border-box; width: 100%; }
.cqr-design-field { display: grid; gap: 10px; margin-bottom: 18px; }
.cqr-open-designs { width: 100%; min-height: 48px; font-weight: 800 !important; }
.cqr-selected-design { display: grid; grid-template-columns: 108px 1fr; grid-template-rows: auto auto; gap: 2px 12px; align-items: center; padding: 9px; border: 1px solid #dedede; border-radius: 10px; background: #fff; }
.cqr-selected-design img { grid-row: 1 / 3; width: 108px; aspect-ratio: 17 / 6; object-fit: cover; border-radius: 6px; }
.cqr-selected-design strong { align-self: end; font-size: 15px; }
.cqr-selected-design span { align-self: start; color: #777; font-size: 12px; }
.cqr-design-modal[hidden] { display: none !important; }
.cqr-design-modal { position: fixed; z-index: 999999; inset: 0; display: grid; place-items: center; padding: 20px; }
.cqr-design-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(4px); }
.cqr-design-dialog { position: relative; display: flex; flex-direction: column; width: min(1080px, 100%); max-height: min(90vh, 900px); overflow: hidden; border-radius: 18px; background: #fff; box-shadow: 0 28px 90px rgba(0,0,0,.4); }
.cqr-design-heading { display: flex; justify-content: space-between; gap: 20px; padding: 24px 26px 18px; border-bottom: 1px solid #e7e7e7; }
.cqr-design-heading small { color: #e42c1a; font-weight: 900; letter-spacing: 1.5px; }
.cqr-design-heading h2 { margin: 3px 0; font-size: clamp(24px, 3vw, 34px); line-height: 1.15; }
.cqr-design-heading p { margin: 0; color: #666; }
.cqr-design-close { align-self: flex-start; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: #f0f0f0; color: #171717; font-size: 30px; line-height: 1; cursor: pointer; }
.cqr-design-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; overflow-y: auto; padding: 22px 26px; }
.cqr-design-card { display: grid; gap: 10px; min-width: 0; padding: 9px; border: 3px solid transparent; border-radius: 13px; background: #f5f5f5; color: #171717; text-align: left; cursor: pointer; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.cqr-design-card:hover { transform: translateY(-2px); box-shadow: 0 9px 24px rgba(0,0,0,.12); }
.cqr-design-card.is-selected { border-color: #ed321f; background: #fff; box-shadow: 0 0 0 2px rgba(237,50,31,.12); }
.cqr-design-card img { display: block; width: 100%; aspect-ratio: 17 / 6; object-fit: cover; border-radius: 8px; }
.cqr-design-card span { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 2px 3px 3px; }
.cqr-design-card strong { font-size: 16px; }
.cqr-design-card small { color: #777; font-size: 12px; }
.cqr-design-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 26px 22px; border-top: 1px solid #e7e7e7; }
.cqr-design-footer .button { min-height: 44px; padding-right: 22px !important; padding-left: 22px !important; }
.cqr-modal-open { overflow: hidden !important; }
.cqr-amount-label { box-sizing: border-box !important; display: inline-block !important; width: 62px !important; min-width: 62px !important; max-width: 62px !important; flex: 0 0 62px !important; overflow: visible !important; white-space: nowrap !important; font-size: 13px !important; font-weight: 800 !important; letter-spacing: -.4px !important; line-height: 1 !important; text-align: center !important; }
.cqr-store-user .cqr-ifx-form, .cqr-store-user .cqr-trash-form, .cqr-store-user .cqr-secondary { display: none !important; }
.cqr-store-user .cqr-form-actions small { font-size: 0; }
.cqr-store-user .cqr-form-actions small::after { content: "Se generarán el certificado y la cotización IFX con referencia CUP-CÓDIGO."; font-size: 12px; }

@media (max-width: 782px) {
  .cqr-grid, .cqr-scanner-layout, .cqr-field-row, .cqr-stats, .cqr-action-grid, .cqr-email-builder, .cqr-template-gallery, .cqr-template-picker, .cqr-template-manage-grid { grid-template-columns: 1fr; }
  .cqr-heading, .cqr-section-heading { align-items: flex-start; flex-direction: column; }
  .cqr-gift-card { grid-template-columns: 1fr; }
  .cqr-public-qr { width: min(220px, 100%); }
  .cqr-design-modal { align-items: end; padding: 0; }
  .cqr-design-dialog { width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .cqr-design-heading { padding: 18px 17px 14px; }
  .cqr-design-heading p { font-size: 13px; }
  .cqr-design-grid { grid-template-columns: 1fr; gap: 13px; padding: 16px; }
  .cqr-design-card span { align-items: flex-start; flex-direction: column; gap: 1px; }
  .cqr-design-footer { position: sticky; bottom: 0; padding: 13px 16px calc(13px + env(safe-area-inset-bottom)); background: #fff; }
  .cqr-design-footer .button { flex: 1; }
  .cqr-selected-design { grid-template-columns: 88px 1fr; }
  .cqr-selected-design img { width: 88px; }
  .cqr-amount-label { font-size: 12px !important; }
}

@media print {
  body * { visibility: hidden !important; }
  .cqr-modal, .cqr-modal * { visibility: visible !important; }
  .cqr-modal { position: absolute; background: #fff; }
  .cqr-modal-close, .cqr-print-qr { display: none !important; }
}
