/* ═══════════════════════════════════════════════════════════════════
   PaycometGYM — Design System v2
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Palette — warm neutrals matching NTR Fitness brand */
    --bg: #f7f7f8;
    --bg-subtle: #f1f1f3;
    --card: #ffffff;
    --text: #1a1a1e;
    --text-secondary: #555560;
    --muted: #7a7a85;

    /* Brand — NTR Fitness granate/red */
    --accent: #B3002A;
    --accent-hover: #912730;
    --accent-light: #fdf2f4;
    --accent-subtle: #fce4e8;

    /* Semantic */
    --success: #059669;
    --success-light: #ecfdf5;
    --success-hover: #047857;
    --success-bg: #d1fae5;
    --success-btn: #059669;
    --success-btn-dark: #047857;

    --danger: #dc2626;
    --danger-light: #fef2f2;
    --danger-hover: #b91c1c;

    --warn-bg: #fffbeb;
    --warn-text: #92400e;
    --warn-border: #fde68a;

    --border: #e4e4e7;
    --border-strong: #d1d1d6;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -4px rgba(0,0,0,0.04);

    /* Radius */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;

    /* Transitions */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}


/* ─── Reset & Base ───────────────────────────────────────────────── */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--accent-subtle);
    color: var(--accent);
}


/* ─── Layout ─────────────────────────────────────────────────────── */

.wrap {
    width: min(1360px, 95vw);
    margin: 0 auto;
    padding-bottom: 40px;
}


/* ─── Top Bar ────────────────────────────────────────────────────── */

.topbar {
    background: #111111;
    color: #fff;
    padding: 0;
    margin-bottom: 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 56px;
    padding-bottom: 0;
}

.brand {
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    height: 28px;
    width: auto;
    display: block;
    transition: opacity 0.2s var(--ease);
}

.brand:hover .brand-logo {
    opacity: 0.85;
}

.main-nav {
    display: flex;
    gap: 2px;
}

.main-nav a {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease);
    position: relative;
}

.main-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.topbar .btn-light {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.85);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    transition: all 0.2s var(--ease);
}

.topbar .btn-light:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
}


/* ─── Typography ─────────────────────────────────────────────────── */

h1 {
    margin: 0 0 20px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

h2 {
    margin-top: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
}


/* ─── Cards ──────────────────────────────────────────────────────── */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s var(--ease);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.narrow {
    max-width: 480px;
    margin: 40px auto;
}


/* ─── Title Row ──────────────────────────────────────────────────── */

.title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}


/* ─── Stat Cards (Dashboard) ─────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--ease);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #FF003B);
    opacity: 0;
    transition: opacity 0.3s var(--ease);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card h2 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: 600;
}

.stat-card p {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text) 0%, #4a4e5e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ─── Stat card links ────────────────────────────────────────────── */

a.stat-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.stat-card-link:hover {
    border-color: var(--accent);
}

/* ─── Alert list ─────────────────────────────────────────────────── */

.alert-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alert-list li {
    border-bottom: 1px solid var(--border);
}

.alert-list li:last-child {
    border-bottom: none;
}

.alert-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text);
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.alert-list a:hover {
    background: var(--bg-subtle);
}

.alert-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.alert-dot-red { background: var(--danger); }
.alert-dot-orange { background: #f59e0b; }

/* ─── Badges ─────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-activa { background: var(--success-bg); color: var(--success); }
.badge-pausada { background: var(--warn-bg); color: var(--warn-text); }
.badge-suspendida { background: #fee2e2; color: var(--danger); }
.badge-cancelada { background: var(--bg-subtle); color: var(--muted); }

.text-muted { color: var(--muted); }

/* ─── Buttons ────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius);
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    font-family: inherit;
    line-height: 1.4;
}

.btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(179, 0, 42, 0.25);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-light {
    background: var(--card);
    color: var(--text);
    border-color: var(--border);
}

.btn-light:hover {
    background: var(--bg-subtle);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: var(--success-hover);
    border-color: var(--success-hover);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: var(--danger-hover);
    border-color: var(--danger-hover);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-inline {
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.2;
    border-radius: var(--radius-sm);
}

.link-btn {
    border: 0;
    background: transparent;
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.15s var(--ease);
}

.link-btn:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}


/* ─── Sync Card ──────────────────────────────────────────────────── */

.pay-sync-card {
    padding: 16px;
    background: var(--accent-light);
    border-color: var(--accent-subtle);
}

.pay-sync-form {
    display: flex;
    justify-content: center;
    align-items: center;
}

.pay-sync-btn {
    min-width: 300px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 12px 24px;
    font-size: 14px;
}


/* ─── Forms ──────────────────────────────────────────────────────── */

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--card);
    transition: all 0.2s var(--ease);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(179, 0, 42, 0.1);
}

input::placeholder {
    color: var(--muted);
}


/* ─── Tables ─────────────────────────────────────────────────────── */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
    background: var(--bg-subtle);
    white-space: nowrap;
}

thead th:first-child {
    border-radius: var(--radius) 0 0 0;
}

thead th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

td {
    text-align: left;
    padding: 12px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    font-size: 13px;
}

tbody tr {
    transition: background 0.15s var(--ease);
}

tbody tr:hover {
    background: var(--bg-subtle);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ─── Client row status colors ───────────────────────────────────── */
tbody tr.row-activo {
    background-color: #ecfdf5;
}
tbody tr.row-activo:hover {
    background-color: #d1fae5;
}
tbody tr.row-problema {
    background-color: #fef2f2;
}
tbody tr.row-problema:hover {
    background-color: #fee2e2;
}

/* ─── Actions ────────────────────────────────────────────────────── */

.actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}


/* ─── Subscription Actions ───────────────────────────────────────── */

.subscription-actions {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.subscription-actions-main {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.subscription-actions-main form {
    margin: 0;
}

.subscription-actions-link {
    display: grid;
    gap: 6px;
}

.subscription-link-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.subscription-link-form {
    display: grid;
    grid-template-columns: minmax(120px, 160px) max-content max-content;
    gap: 6px;
    align-items: center;
}

.subscription-link-copy {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) max-content max-content;
    gap: 6px;
    align-items: center;
}

.subscription-link-copy input[type="text"] {
    height: 30px;
    padding: 5px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
}

.subscription-link-form input[type="text"] {
    height: 30px;
    padding: 5px 10px;
    min-width: 0;
}

.subscription-link-form .btn {
    white-space: nowrap;
}


/* ─── Subscription Table ─────────────────────────────────────────── */

.subscriptions-table .col-id { width: 56px; }
.subscriptions-table .col-plan { width: 120px; }
.subscriptions-table .col-next { width: 115px; }
.subscriptions-table .col-state { width: 90px; }
.subscriptions-table .col-paycomet { width: 230px; }
.subscriptions-table .col-fails { width: 120px; }
.subscriptions-table .col-actions { width: 330px; }
.subscriptions-table .col-card { width: 140px; }

.subscriptions-table td {
    padding-top: 14px;
    padding-bottom: 14px;
}

.subscriptions-table .paycomet-order {
    margin-top: 6px;
    word-break: break-word;
}

.subscriptions-table .col-card-cell {
    text-align: right;
    white-space: nowrap;
}


/* ─── Plan Links Table ───────────────────────────────────────────── */

.plan-links-table td,
.plan-links-table th {
    vertical-align: middle;
}

.plan-link-copy {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) max-content max-content;
    gap: 6px;
    align-items: center;
}

.plan-link-copy input[type="text"] {
    height: 32px;
    padding: 6px 10px;
    min-width: 0;
    font-size: 12px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
}

.plan-link-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.link-green { color: var(--success); }
.link-danger { color: var(--danger); }
.cell-right { text-align: right; }


/* ─── Tags ───────────────────────────────────────────────────────── */

.tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.tag-ok {
    color: var(--success);
    background: var(--success-light);
}

.tag-warn {
    color: var(--warn-text);
    background: var(--warn-bg);
}


/* ─── Alerts ─────────────────────────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 500;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: alertSlideIn 0.35s var(--ease);
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-success::before {
    content: '\2713';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--success);
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    flex-shrink: 0;
}

.alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-error::before {
    content: '!';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.error {
    color: var(--danger);
}

.small {
    color: var(--muted);
    margin-top: 8px;
    font-size: 13px;
}


/* ─── Subscription Form ──────────────────────────────────────────── */

.subscription-form-card {
    padding: 24px;
}

.subscription-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 16px;
}

.field-block {
    display: grid;
    gap: 6px;
}

.field-block-wide {
    grid-column: 1 / -1;
}

.field-title {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
}

.field-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}


/* ─── Tokenization (Admin JET) ───────────────────────────────────── */

.paycomet-card-form {
    max-width: 920px;
}

.pay-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.paycomet-slot {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px;
    min-height: 40px;
    background: #fff;
    transition: border-color 0.2s var(--ease);
}

.paycomet-slot:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(179, 0, 42, 0.1);
}

.tokenization-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.tokenization-subtitle { margin: 0; }

.tokenization-side h2,
.tokenization-main h2 {
    margin-bottom: 14px;
}

.tokenization-side h3 {
    margin: 20px 0 10px;
    font-size: 14px;
}

.tokenization-meta {
    display: grid;
    gap: 14px;
}

.meta-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
}

.meta-inline {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

.tokenization-checklist {
    margin: 0;
    padding-left: 18px;
    color: var(--text);
    display: grid;
    gap: 8px;
}

.tokenization-warning {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
    font-size: 13px;
}

.tokenization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.tokenization-pill {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
}

.tokenization-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 12px;
}

.tokenization-field {
    display: grid;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
}

.tokenization-field-full {
    grid-column: 1 / -1;
}

.tokenization-slot {
    border-radius: var(--radius);
    background: #fff;
}

.tokenization-error {
    margin-top: 10px;
    min-height: 18px;
    color: var(--danger);
    font-weight: 600;
    font-size: 13px;
}

.tokenization-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.tokenization-submit {
    min-width: 180px;
}


/* ─── Token Minimal Card ─────────────────────────────────────────── */

.token-minimal {
    max-width: 700px;
    margin: 0 auto 20px;
    border-radius: var(--radius-xl);
    padding: 22px;
}

.token-minimal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.token-kicker {
    margin: 0 0 4px;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

.token-client {
    margin: 0;
    font-weight: 700;
    font-size: 15px;
}

.token-price {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--accent);
}

.token-brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.token-brand-label {
    color: var(--muted);
    font-size: 12px;
}

.token-brand-badge {
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

.token-brand-badge[data-brand="visa"],
.token-brand-badge[data-brand="mastercard"],
.token-brand-badge[data-brand="amex"],
.token-brand-badge[data-brand="maestro"],
.token-brand-badge[data-brand="diners"],
.token-brand-badge[data-brand="jcb"] {
    background: var(--success-light);
    color: #065f46;
}

.token-brand-logos {
    display: inline-flex;
    gap: 6px;
}

.brand-pill {
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 999px;
    font-size: 11px;
    padding: 3px 9px;
    font-weight: 600;
    transition: all 0.2s var(--ease);
}

.brand-pill.is-active {
    border-color: var(--success);
    color: #065f46;
    background: var(--success-light);
}

.token-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.token-field {
    display: grid;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
}

.token-field-full {
    grid-column: 1 / -1;
}

.token-slot {
    height: 30px;
    min-height: 30px;
    border-radius: var(--radius);
    background: #fff;
    padding: 2px 8px;
    border: 1px solid var(--border);
    transition: border-color 0.2s var(--ease);
}

.token-slot:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(179, 0, 42, 0.1);
}

.token-inline-row {
    display: grid;
    grid-template-columns: 92px 92px minmax(120px, 170px);
    gap: 10px;
    align-items: start;
}

.token-inline-item {
    margin: 0;
}

.token-inline-month select,
.token-inline-year select {
    min-width: 0;
    height: 30px;
    min-height: 30px;
    padding-top: 2px;
    padding-bottom: 2px;
}

.token-slot-cvc {
    height: 30px;
    min-height: 30px;
}

.token-error {
    grid-column: 1 / -1;
    color: var(--danger);
    min-height: 18px;
    font-weight: 600;
    font-size: 13px;
}

.token-note {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.token-note-warn { color: var(--danger); }
.token-note-strong { font-weight: 600; }

.is-hidden {
    display: none !important;
}

.token-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
}

.token-submit {
    min-width: 180px;
}


/* ─── Public Enrollment ──────────────────────────────────────────── */

.public-wrap {
    max-width: 760px;
    margin: 22px auto;
}

.public-card {
    padding: 28px;
    border-radius: var(--radius-xl);
}

.public-card h1 {
    margin-top: 0;
    font-size: 22px;
}

.public-head p {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-weight: 600;
}

.public-subtitle {
    margin-top: 0;
    color: var(--text-secondary);
}

.public-form {
    display: grid;
    gap: 14px;
}

.public-inline-grid {
    display: grid;
    grid-template-columns: 95px 95px 140px;
    gap: 10px;
    align-items: end;
}

.public-inline-grid-customer {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.public-legal {
    display: grid;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--bg-subtle);
}

.check-line {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    color: var(--text);
    font-size: 13px;
}

.check-line input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
    accent-color: var(--accent);
}

.public-card-done {
    text-align: center;
    padding: 32px;
}


/* ─── Code blocks ────────────────────────────────────────────────── */

pre {
    background: #111111;
    color: #f5f5f5;
    padding: 14px 16px;
    border-radius: var(--radius);
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.7;
}


/* ─── Dashboard Alerts Section ───────────────────────────────────── */

.card ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.card ul li {
    padding: 8px 12px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card ul li::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}


/* ─── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .topbar {
        margin-bottom: 16px;
    }

    .topbar-inner {
        flex-direction: column;
        align-items: center;
        height: auto;
        padding: 10px 0 0;
        gap: 0;
        position: relative;
    }

    .topbar-inner > div:first-child {
        margin-bottom: 8px;
    }

    .main-nav {
        display: flex;
        flex-wrap: nowrap;
        gap: 0;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        justify-content: center;
        padding: 0 8px;
    }

    .main-nav::-webkit-scrollbar {
        display: none;
    }

    .main-nav a {
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .topbar form[action*="logout"] {
        position: absolute;
        right: 8px;
        top: 8px;
    }

    .topbar form[action*="logout"] .btn {
        font-size: 11px;
        padding: 4px 10px;
    }

    .topbar-inner::after {
        content: '';
        display: block;
        width: 100%;
        height: 1px;
        background: rgba(255,255,255,0.08);
        margin-top: 0;
    }

    h1 {
        font-size: 20px;
        margin-bottom: 14px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card h2 {
        font-size: 10px;
        margin-bottom: 4px;
    }

    .stat-card p {
        font-size: 22px;
    }

    .stat-card:hover {
        transform: none;
    }

    .subscription-grid,
    .pay-grid,
    .tokenization-grid {
        grid-template-columns: 1fr;
    }

    .tokenization-layout {
        grid-template-columns: 1fr;
    }

    .tokenization-actions {
        justify-content: stretch;
    }

    .tokenization-submit {
        width: 100%;
    }

    .tokenization-header {
        align-items: flex-start;
        gap: 8px;
        flex-direction: column;
    }

    .token-minimal-head {
        flex-direction: column;
        gap: 8px;
    }

    .token-form {
        grid-template-columns: 1fr;
    }

    .token-inline-row {
        grid-template-columns: 1fr 1fr;
    }

    .token-inline-cvc {
        grid-column: 1 / -1;
    }

    .token-submit {
        width: 100%;
    }

    .token-actions {
        justify-content: stretch;
    }

    .field-actions {
        justify-content: stretch;
    }

    .subscription-actions {
        min-width: 0;
    }

    .subscription-link-form {
        grid-template-columns: 1fr;
    }

    .subscription-link-copy {
        grid-template-columns: 1fr;
    }

    .plan-link-copy {
        grid-template-columns: 1fr;
    }

    .plan-link-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .subscriptions-table {
        min-width: 1000px;
    }

    .card {
        overflow-x: auto;
        padding: 14px;
        border-radius: var(--radius);
        margin-bottom: 14px;
    }

    .card h2 {
        font-size: 14px;
    }

    table {
        font-size: 13px;
    }

    .alert-list li {
        padding: 10px 0;
    }

    .alert-list a {
        font-size: 13px;
    }

    .public-wrap {
        margin-top: 12px;
    }

    .public-card {
        padding: 18px;
    }

    .public-inline-grid {
        grid-template-columns: 1fr 1fr;
    }

    .public-inline-grid label:last-child {
        grid-column: 1 / -1;
    }

    .wrap {
        width: 94vw;
        padding-bottom: 24px;
    }

    .title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .pay-sync-btn {
        min-width: 0;
        width: 100%;
    }

    .form-grid {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .topbar-inner {
        padding: 8px 0 0;
    }

    .main-nav {
        justify-content: flex-start;
        padding: 0 4px;
    }

    .main-nav a {
        padding: 7px 8px;
        font-size: 11px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card h2 {
        font-size: 9px;
    }

    .stat-card p {
        font-size: 18px;
    }

    .filters {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 12px;
    }

    h1 {
        font-size: 18px;
    }
}


/* ─── Login ──────────────────────────────────────────────────────── */

.login-card {
    max-width: 420px;
    margin: 80px auto;
    padding: 36px 32px 32px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
    padding: 22px 24px;
    background: #111111;
    border-radius: var(--radius);
}

.login-logo-img {
    height: 40px;
    width: auto;
}

.login-title {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.login-card .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    text-align: left;
}

.login-btn {
    width: 100%;
    padding: 11px 18px;
    font-size: 14px;
    margin-top: 4px;
}


/* ─── Scrollbar ──────────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}


/* ─── Focus visible ──────────────────────────────────────────────── */

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(179, 0, 42, 0.15);
}


/* ─── Table link styles ──────────────────────────────────────────── */

td a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s var(--ease);
}

td a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}


/* ─── Searchable Select ─────────────────────────────────────────── */

.searchable-select {
    position: relative;
}

.searchable-select-input {
    width: 100%;
    cursor: text;
}

.searchable-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.searchable-select.open .searchable-select-dropdown {
    display: block;
}

.searchable-select-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: background 0.1s;
}

.searchable-select-option:hover,
.searchable-select-option.active {
    background: var(--accent);
    color: #fff;
}

.searchable-select-option.hidden {
    display: none;
}
