/* =========================================================================
   Privix DPO -  v16  estilo base, dark, limpio.
   Backoffice DPO + portal público + superadmin.
   ========================================================================= */

:root {
    --bg: #ffffff;
    --bg-2: #f8f9fa;
    --surface: #ffffff;
    --surface-2: #f8f9fa;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-soft: #475569;
    --accent: #3b82f6;
    --accent-2: #2563eb;
    --accent-strong: #1d4ed8;
    --danger: #dc2626;
    --warning: #f59e0b;
    --success: #059669;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 14px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: radial-gradient(1200px 600px at 20% -10%, rgba(59, 130, 246, 0.03), transparent 60%),
                radial-gradient(900px 500px at 110% 10%, rgba(96, 165, 250, 0.02), transparent 60%),
                var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

h1, h2, h3, h4 { color: var(--text); margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 1.9rem; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: .4em 0; color: var(--text-soft); }
small { color: var(--text-muted); }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px 80px;
}

.container-sm {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 20px 80px;
}

/* ---------- Header ---------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
    gap: 10px;
}

.app-header .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
}

.app-header .brand .dot {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: transparent url("/logo_privix.png") center/contain no-repeat;
    border: 0;
    box-shadow: none;
}

.app-header .meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---------- Cards ---------- */
.card {
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.card h2, .card h3 { margin-top: 0; }

.card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-small { font-size: .9rem; }
.text-mono { font-family: "JetBrains Mono", "SF Mono", Menlo, monospace; }
.text-center { text-align: center; }

.divider {
    height: 1px;
    background: var(--border);
    margin: 18px 0;
}

.tag {
    display: inline-block;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text-soft);
    font-size: 0.78rem;
    padding: 3px 9px;
    border-radius: 999px;
}

.tag.success { border-color: rgba(5, 150, 105, 0.3); color: var(--success); background: rgba(5, 150, 105, 0.06); }
.tag.warning { border-color: rgba(245, 158, 11, 0.3); color: var(--warning); background: rgba(245, 158, 11, 0.06); }
.tag.danger  { border-color: rgba(220, 38, 38, 0.3); color: var(--danger); background: rgba(220, 38, 38, 0.06); }
.tag.info    { border-color: rgba(59, 130, 246, 0.3); color: var(--accent); background: rgba(59, 130, 246, 0.06); }

/* ---------- Forms ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.form-grid .full { grid-column: 1 / -1; }

label.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--text-soft);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
input[type="date"],
input[type="search"],
select,
textarea {
    background: #ffffff;
    border: 1px solid var(--border-strong);
    color: #1e293b;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}

textarea { min-height: 90px; resize: vertical; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Inputs solo-lectura: claramente diferenciados visualmente */
input[readonly], textarea[readonly] {
    background: #f1f5f9;
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: var(--border);
}
input[readonly]:focus, textarea[readonly]:focus {
    border-color: var(--border);
    box-shadow: none;
}

.checkbox {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text-soft);
}

.checkbox input { margin-top: 3px; accent-color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
    appearance: none;
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #ffffff;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    transition: transform .08s ease, filter .15s ease;
}

.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; filter: grayscale(0.4); }

.btn.secondary {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn.ghost {
    background: transparent;
    color: var(--text-soft);
    border-color: var(--border-strong);
}

.btn.danger { background: linear-gradient(135deg, #f87171, #ef4444); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Tabs ---------- */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 18px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 9px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 500;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
    background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(37,99,232,.12));
    color: var(--accent);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(59,130,246,0.3);
}

.tab-btn.locked {
    opacity: 0.45;
    cursor: not-allowed;
    color: var(--text-muted);
    position: relative;
}
.tab-btn.locked:hover { color: var(--text-muted); }
.tab-btn.locked::after {
    content: "🔒";
    margin-left: 6px;
    font-size: 0.7em;
}

/* ---------- Suscripción Privix DPO ---------- */
.subscription-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    padding: 18px 22px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    box-shadow: var(--shadow);
    transition: border-color .2s, background .2s;
}

.subscription-card[data-state="active"] {
    border: 1px solid rgba(52, 211, 153, 0.45);
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.10), rgba(56, 189, 248, 0.06));
}

.subscription-card[data-state="inactive"],
.subscription-card[data-state="suspended"],
.subscription-card[data-state="cancel"],
.subscription-card[data-state="finish"],
.subscription-card[data-state="delete"] {
    border: 1px solid rgba(248, 113, 113, 0.4);
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.08), rgba(251, 191, 36, 0.04));
}

.subscription-card[data-state="register"] {
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.10), rgba(251, 191, 36, 0.03));
}

.subscription-card .subscription-info {
    flex: 1 1 320px;
    min-width: 0;
}

.subscription-card .subscription-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.subscription-card .subscription-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.subscription-card .subscription-title::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--text-muted);
    box-shadow: 0 0 0 4px rgba(255,255,255,0.04);
}

.subscription-card[data-state="active"] .subscription-title::before {
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
}

.subscription-card[data-state="register"] .subscription-title::before {
    background: var(--warning);
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.18);
}

.subscription-card[data-state="inactive"] .subscription-title::before,
.subscription-card[data-state="suspended"] .subscription-title::before,
.subscription-card[data-state="cancel"] .subscription-title::before,
.subscription-card[data-state="finish"] .subscription-title::before,
.subscription-card[data-state="delete"] .subscription-title::before {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.18);
}

.subscription-card .subscription-msg {
    color: var(--text-soft);
    font-size: 0.92rem;
    margin: 6px 0 0;
}

.subscription-card .subscription-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.subscription-card .subscription-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-soft);
}
.subscription-card .subscription-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.subscription-card .subscription-meta .meta-item:empty { display: none; }
.subscription-card .subscription-meta .meta-item.error { color: var(--danger); }
.subscription-card .subscription-meta .meta-item.ok { color: var(--success); }

/* ---------- Desglose de precio (suscripción) ---------- */
.price-breakdown {
    margin-top: 14px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(34, 197, 94, 0.06));
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.price-breakdown .price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
    color: var(--muted);
    padding: 4px 0;
}
.price-breakdown .price-row.discount {
    color: var(--success);
    font-weight: 600;
}
.price-breakdown .price-row.total {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 6px;
    padding-top: 12px;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
}
.price-breakdown .price-row.total {
    color: var(--text);
}
.price-breakdown .price-row.total .price-value {
    font-size: 1.35rem;
    color: var(--text);
    font-weight: 700;
}
.price-breakdown .price-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.price-coupon-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}
.price-coupon-tag:empty { display: none; }
.price-note {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--muted);
    text-align: right;
}

/* ---------- Cupón de descuento ---------- */
.coupon-block {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.coupon-toggle {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    transition: all 0.2s ease;
}
.coupon-toggle[open] {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.3);
}
.coupon-toggle summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.coupon-toggle summary::-webkit-details-marker { display: none; }
.coupon-toggle summary::after {
    content: "▾";
    margin-left: auto;
    color: var(--muted);
    transition: transform 0.2s ease;
    font-size: 0.85rem;
}
.coupon-toggle[open] summary::after { transform: rotate(180deg); }
.coupon-toggle .coupon-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    font-weight: 800;
    font-size: 0.75rem;
}
.coupon-form {
    padding: 0 14px 14px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.coupon-form input[type="text"] {
    flex: 1 1 200px;
    min-width: 160px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: 8px;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.coupon-form input[type="text"]:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.7);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.coupon-msg {
    width: 100%;
    margin-top: 4px;
    font-size: 0.82rem;
}
.coupon-msg.ok { color: var(--success); }
.coupon-msg.error { color: var(--danger); }
.coupon-applied-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- Tables ---------- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    min-width: 720px;
}

table.table th, table.table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

table.table th {
    background: var(--surface-2);
    color: var(--text-soft);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

table.table tr:last-child td { border-bottom: none; }
table.table tr:hover td { background: rgba(255,255,255,0.015); }

/* ---------- KPIs ---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.kpi {
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.kpi .label {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi .value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 6px;
}

.kpi .hint { color: var(--text-soft); font-size: 0.85rem; margin-top: 4px; }

.progress {
    height: 8px;
    background: var(--bg-2);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 10px;
}
.progress > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---------- Notices ---------- */
.notice {
    border-left: 3px solid var(--accent);
    background: rgba(79, 209, 197, 0.06);
    color: var(--text-soft);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin: 12px 0;
}
.notice.warning {
    border-left-color: var(--warning);
    background: rgba(251, 191, 36, 0.06);
}
.notice.danger {
    border-left-color: var(--danger);
    background: rgba(248, 113, 113, 0.06);
}
.notice.success {
    border-left-color: var(--success);
    background: rgba(52, 211, 153, 0.06);
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 100;
    max-width: 360px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger);  }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 16, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
    width: 100%;
    max-width: 600px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    max-height: 90vh;
    overflow-y: auto;
}

/* ---------- Public portal hero ---------- */
.portal-hero {
    padding: 36px 28px;
    border-radius: var(--radius);
    background:
        radial-gradient(600px 200px at 0% 0%, rgba(59,130,246,.06), transparent 60%),
        radial-gradient(600px 200px at 100% 100%, rgba(37,99,232,.04), transparent 60%),
        linear-gradient(180deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border);
    margin-bottom: 18px;
}
.portal-hero h1 { font-size: 1.6rem; }
.portal-hero .lead { color: var(--text-soft); max-width: 680px; }

/* ---------- Login (index.html / superadmin.html) ---------- */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 460px;
}

/* Index Privix login/register tabs */
.auth-tabs {
    display: flex;
    gap: 6px;
    background: var(--surface-2);
    padding: 6px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}
.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.92rem;
}
.auth-tab.active {
    background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(37,99,232,.12));
    color: var(--accent);
    font-weight: 600;
}

.link-btn {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    text-decoration: underline;
}

/* ---------- Credits panel ---------- */
.credits-card {
    background: linear-gradient(135deg, rgba(59,130,246,.06), rgba(37,99,232,.04));
    border: 1px solid rgba(59,130,246,.2);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.credits-card .credits-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
}
.credits-card .credits-label {
    color: var(--text-soft);
    font-size: 0.88rem;
}
.credits-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.credits-controls input[type="number"] {
    max-width: 110px;
}

/* ---------- Utilities ---------- */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ---------- QR Download button (llamativo) ---------- */
.qr-download-btn {
    background: linear-gradient(135deg, #2563eb 0%, #22c55e 100%);
    color: #fff !important;
    border: none;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35), 0 2px 6px rgba(34, 197, 94, 0.25);
    font-weight: 700;
    letter-spacing: 0.2px;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
    position: relative;
    overflow: hidden;
}
.qr-download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.45), 0 4px 10px rgba(34, 197, 94, 0.35);
    filter: brightness(1.05);
}
.qr-download-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35);
}
.qr-download-btn::before {
    content: "";
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%);
    transition: left 0.6s ease;
    pointer-events: none;
}
.qr-download-btn:hover::before { left: 130%; }

/* ---------- QR Modal ---------- */
.qr-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.18s ease-out;
}
.qr-modal-backdrop.hidden { display: none; }
.qr-modal {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    max-height: 92vh;
    overflow: auto;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.15);
    animation: popIn 0.2s ease-out;
}
.qr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.qr-modal-close {
    background: transparent;
    border: none;
    color: var(--text-soft, #94a3b8);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
}
.qr-modal-close:hover {
    background: rgba(148, 163, 184, 0.12);
    color: #fff;
}
.qr-modal-body { padding: 22px; }
.qr-image-wrapper {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 14px 0 18px;
    min-height: 200px;
}
.qr-image-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
}
.qr-modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .form-grid { grid-template-columns: 1fr; }
    .app-header { padding: 14px 16px; }
    .container, .container-sm { padding: 18px 14px 80px; }
    h1 { font-size: 1.55rem; }
    .portal-hero { padding: 24px 18px; }
    table.table { font-size: 0.85rem; }
    .kpi .value { font-size: 1.5rem; }
    .credits-card { flex-direction: column; align-items: flex-start; }
}
