* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #5b5fc7;
    --primary-dark: #4a4eb5;
    --secondary: #1a1a1a;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #dc2626;
    --info: #5b5fc7;
    --bg: #f5f5f5;
    --card: #ffffff;
    --text: #1a1a1a;
    --text-light: #666;
    --border: #e5e5e5;
    --sidebar-bg: #1a1a1a;
    --sidebar-text: #999;
    --sidebar-active: #5b5fc7;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-header i {
    font-size: 28px;
    color: #5b5fc7;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.nav-menu {
    list-style: none;
    padding: 16px 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all .2s;
    font-size: 15px;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,.05);
    color: #fff;
}

.nav-item.active {
    background: rgba(91,95,199,.1);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: 13px;
}

.date-display {
    color: var(--sidebar-text);
}

/* Content */
.content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    max-width: calc(100vw - 260px);
}

.page { display: none; }
.page.active { display: block; }

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

.page-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

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

.stats-grid.small {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stat-card {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .2s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-card.mini { padding: 16px; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-card.revenue .stat-icon { background: rgba(91,95,199,.08); color: var(--primary); }
.stat-card.pending .stat-icon { background: rgba(26,26,26,.06); color: #1a1a1a; }
.stat-card.failed .stat-icon { background: rgba(91,95,199,.08); color: var(--primary); }
.stat-card.refunded .stat-icon { background: rgba(26,26,26,.06); color: #666; }

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

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

/* Period Selector */
.period-selector {
    display: flex;
    gap: 4px;
    background: var(--card);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.period-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    transition: all .2s;
}

.period-btn.active {
    background: #1a1a1a;
    color: #fff;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    margin-bottom: 24px;
}

.card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.card h3 i { color: #5b5fc7; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.chart-container {
    position: relative;
    height: 280px;
}

/* Tables */
.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    white-space: nowrap;
}

.table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    background: #fafafa;
}

.table tbody tr:hover { background: #f8f9fa; }

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-paid { background: #e8f5e9; color: #2e7d32; }
.badge-pending { background: #fff3e0; color: #e65100; }
.badge-failed { background: #fce4ec; color: #c62828; }
.badge-refunded { background: #e3f2fd; color: #1565c0; }
.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #f5f5f5; color: #999; }
.badge-one_time { background: #e3f2fd; color: #1565c0; }
.badge-subscription { background: #f3e5f5; color: #7b1fa2; }
.badge-installments { background: #fff3e0; color: #e65100; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

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

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(91,95,199,.3); }
.btn-secondary { background: #f0f0f0; color: var(--text); }
.btn-secondary:hover { background: #e0e0e0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 6px 10px; }

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filters select {
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--card);
    cursor: pointer;
}

/* Payment methods checkboxes */
.payment-methods-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all .2s;
}

.checkbox-label:hover {
    border-color: var(--primary);
    background: #f8f9ff;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked + i,
.checkbox-label input[type="checkbox"]:checked + span {
    opacity: 1;
}

/* Methods badges in table */
.methods-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.method-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.method-badge.card { background: #e3f2fd; color: #1565c0; }
.method-badge.klarna { background: #FFB3C7; color: #0A0B09; }
.method-badge.bancontact { background: #e8f5e9; color: #2e7d32; }
.method-badge.ideal { background: #fff3e0; color: #e65100; }
.method-badge.giropay { background: #fce4ec; color: #c62828; }
.method-badge.sepa_debit { background: #f3e5f5; color: #7b1fa2; }

/* Product templates */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.template-card {
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all .2s;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
}

.template-card input[type="checkbox"] {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.template-card:hover {
    border-color: var(--primary);
    background: #f8f9ff;
    transform: translateY(-1px);
}

.template-card.active {
    border-color: var(--primary);
    background: rgba(91,95,199,.04);
    box-shadow: 0 0 0 3px rgba(91,95,199,.1);
}

.template-card .tpl-icon {
    font-size: 22px;
    display: block;
}

.template-card .tpl-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

/* Maintenance toggle */
.maintenance-toggle {
    margin-top: 12px;
}

.maintenance-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    cursor: pointer;
    background: linear-gradient(135deg, #667eea08, #764ba208);
    transition: all .2s;
    flex-wrap: wrap;
}

.maintenance-label:hover {
    background: linear-gradient(135deg, #667eea15, #764ba215);
}

.maintenance-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.maintenance-label span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.maintenance-label small {
    width: 100%;
    margin-left: 28px;
    font-size: 12px;
    color: var(--text-light);
    font-weight: 400;
}

/* Items builder */
.item-row {
    position: relative;
    margin-bottom: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid var(--border);
    transition: border-color .2s;
}

.item-row:hover { border-color: var(--primary); }

.item-row .item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.item-row .item-number {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: var(--primary);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-row .btn-remove-item {
    padding: 4px 8px;
    background: none;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all .2s;
}

.item-row .btn-remove-item:hover {
    background: var(--danger);
    color: #fff;
}

.item-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.item-fields .form-group { margin-bottom: 0; }

.item-fields .item-full { grid-column: 1 / -1; }

.item-recurring-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
}

.item-recurring-fields .item-start-group {
    display: flex;
    flex-direction: column;
}

.item-start-options {
    display: flex;
    gap: 8px;
    align-items: center;
}

.item-start-options label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    transition: all .2s;
}

.item-start-options label:has(input:checked) {
    border-color: var(--primary);
    background: #f0f2ff;
    color: var(--primary);
}

.item-start-options input[type="radio"] {
    display: none;
}

.items-total-preview {
    background: linear-gradient(135deg, #667eea15, #764ba215);
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.items-total-preview .total-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

@media (max-width: 768px) {
    .item-fields { grid-template-columns: 1fr; }
    .item-recurring-fields { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .item-row { flex-wrap: wrap; }
    .item-row .form-group { min-width: 45%; }
}

/* Contracts list */
.contracts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contract-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: all .2s;
}

.contract-item:hover {
    border-color: var(--primary);
    background: #f0f7ff;
}

.contract-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contract-ref {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.contract-date {
    font-size: 12px;
    color: var(--text-light);
}

/* Drag & drop */
.item-row.drag-over {
    border-color: var(--primary);
    background: rgba(91, 95, 199, .04);
    box-shadow: 0 0 0 2px rgba(91, 95, 199, .15);
}

.drag-handle:active {
    cursor: grabbing;
}

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--card);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .3s ease;
}

.modal-lg { max-width: 720px; }

@keyframes modalIn {
    from { transform: scale(.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 18px; font-weight: 600; }

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal form,
.modal .modal-body { padding: 24px; }

/* Forms */
.form-group {
    margin-bottom: 16px;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border .2s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 8px;
}

/* Providers Grid */
.providers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.provider-card {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    border-left: 4px solid var(--primary);
}

.provider-card.inactive { opacity: .6; border-left-color: #ccc; }

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

.provider-card h4 { font-size: 16px; font-weight: 600; }

.provider-card .provider-type {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.provider-card .provider-actions {
    display: flex;
    gap: 8px;
}

/* Top links */
.top-links-list .top-link-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.top-link-item:last-child { border-bottom: none; }

.top-link-info h4 { font-size: 14px; font-weight: 600; }
.top-link-info span { font-size: 12px; color: var(--text-light); }

.top-link-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--success);
}

/* Link copy */
.link-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0f2f5;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background .2s;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-copy:hover { background: #e0e2e5; }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    animation: toastIn .3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes toastIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    /* App layout mobile */
    .app {
        flex-direction: column;
    }

    /* Sidebar hidden */
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        width: 260px;
        height: 100%;
        transition: transform .3s ease;
    }
    .sidebar.open { transform: translateX(0); }

    /* Content full width */
    .content {
        margin-left: 0 !important;
        padding: 16px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Mobile header */
    .mobile-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        background: var(--sidebar-bg);
        position: sticky;
        top: 0;
        z-index: 999;
    }
    .mobile-header h2 { color: #fff; font-size: 16px; margin: 0; }
    .hamburger {
        background: none;
        border: none;
        color: #fff;
        font-size: 22px;
        cursor: pointer;
        padding: 6px;
    }
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(0,0,0,.5);
        z-index: 999;
    }
    .mobile-overlay.active { display: block; }

    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .page-header h2 { font-size: 20px; }
    .page-header .btn { width: 100%; justify-content: center; }

    /* Period selector */
    .period-selector {
        flex-wrap: wrap;
        width: 100%;
    }
    .period-btn { padding: 6px 10px; font-size: 11px; flex: 1; text-align: center; min-width: 0; }

    /* Stat cards */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stats-grid.small { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .stat-card { padding: 12px; gap: 10px; }
    .stat-icon { width: 36px; height: 36px; font-size: 15px; }
    .stat-value { font-size: 16px; }
    .stat-label { font-size: 11px; }
    .stat-card.mini { padding: 10px; }
    .stat-card.mini .stat-value { font-size: 15px; }

    /* Cards */
    .card { padding: 14px; margin-bottom: 14px; border-radius: 10px; }

    /* Dashboard */
    .dashboard-grid { grid-template-columns: 1fr; gap: 14px; }
    .chart-container { height: 180px; }
    .top-link-item { padding: 10px 0; }
    .top-link-amount { font-size: 14px; }

    /* Form */
    .form-row { flex-direction: column; gap: 0; }

    /* Tables → Cards */
    .table-responsive { overflow-x: visible; }
    .table thead { display: none; }
    .table, .table tbody { display: block; width: 100%; }
    .table tr {
        display: block;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 14px 16px;
        margin-bottom: 10px;
    }
    .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
        border: none;
        font-size: 13px;
    }
    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-light);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .3px;
        flex-shrink: 0;
        margin-right: 12px;
    }
    .table td:first-child {
        font-size: 14px;
        font-weight: 700;
        padding-bottom: 8px;
        margin-bottom: 6px;
        border-bottom: 1px solid var(--border);
    }
    .table td:last-child {
        padding-top: 8px;
        margin-top: 4px;
        border-top: 1px solid var(--border);
        justify-content: flex-end;
    }

    /* Modals */
    .modal-overlay { padding: 8px; align-items: flex-start; padding-top: 40px; }
    .modal { max-width: 100%; border-radius: 14px; max-height: 85vh; }
    .modal-lg { max-width: 100%; }
    .modal-header { padding: 14px 16px; }
    .modal form, .modal .modal-body { padding: 14px 16px; }

    /* Providers */
    .providers-grid { grid-template-columns: 1fr; }
    .provider-card { padding: 16px; }

    /* Link copy */
    .link-copy { font-size: 10px; max-width: 120px; padding: 3px 8px; }

    /* Buttons */
    .btn { font-size: 13px; }
    .btn-sm { padding: 5px 10px; font-size: 11px; }

    /* Filters */
    .filters { width: 100%; }
    .filters select { width: 100%; font-size: 13px; }

    /* Templates & themes */
    .templates-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .theme-selector { flex-direction: column; gap: 8px; }

    /* Items builder */
    .item-fields { grid-template-columns: 1fr; }
    .item-recurring-fields { grid-template-columns: 1fr; }
    .item-row { padding: 12px; }

    /* Contracts */
    .contract-item { flex-direction: column; gap: 8px; align-items: stretch; }
    .contract-item .btn { width: 100%; justify-content: center; }

    /* Detail stats */
    .link-detail-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .link-detail-stat .value { font-size: 16px; }
    .link-detail-stat .label { font-size: 10px; }
    .link-detail-url { flex-direction: column; gap: 8px; }
    .link-detail-url span { font-size: 12px; }
    .link-detail-url div { width: 100%; display: flex; gap: 6px; }
    .link-detail-url div .btn { flex: 1; justify-content: center; }

    /* Payment methods checkboxes */
    .payment-methods-checkboxes { grid-template-columns: 1fr; }

    /* Engagement */
    #engagementSection select { width: 100%; }
}

@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stats-grid.small { grid-template-columns: 1fr 1fr; }
    .templates-grid { grid-template-columns: 1fr; }
    .content { padding: 10px; }
    .page-header h2 { font-size: 18px; }
}

/* Theme selector */
.theme-selector {
    display: flex;
    gap: 10px;
}

.theme-option {
    flex: 1;
    cursor: pointer;
}

.theme-option input[type="radio"] {
    display: none;
}

.theme-preview {
    padding: 14px 10px;
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 2px solid transparent;
    transition: all .2s;
}

.theme-option input:checked + .theme-preview {
    box-shadow: 0 0 0 3px rgba(91,95,199,.2);
    transform: scale(1.02);
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header i { color: #5b5fc7 !important; }

.login-header h1 {
    font-size: 24px;
    margin-top: 12px;
    color: var(--text);
}

.login-header p {
    color: var(--text-light);
    font-size: 14px;
    margin-top: 4px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* Payment detail in modal */
.link-detail-url {
    background: #f0f2f5;
    padding: 12px 16px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 14px;
    margin: 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    word-break: break-all;
}

.link-detail-url button {
    white-space: nowrap;
    margin-left: 12px;
}

.link-detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.link-detail-stat {
    text-align: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.link-detail-stat .value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.link-detail-stat .label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}
