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

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

:root {
    --bg-main: #f8fafc;
    --bg-white: #ffffff;
    --accent: #4F46E5;
    --accent-hover: #4338CA;
    --accent-light: rgba(79, 70, 229, 0.08);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --pro-color: #4F46E5;
}

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

/* ============ HEADER ============ */

.admin-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    font-size: 1.1rem;
    font-weight: 700;
}

.header-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
    margin-left: 4px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============ BUTTONS ============ */

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* ============ MAIN CONTENT ============ */

.admin-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ============ STATS ============ */

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-pro .stat-value { color: var(--pro-color); }
.stat-active .stat-value { color: var(--success); }
.stat-videos .stat-value { color: var(--warning); }

/* ============ CONTROLS ============ */

.controls-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-box {
    flex: 1;
}

.search-box input {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s;
}

.search-box input:focus {
    border-color: var(--accent);
}

.filters {
    display: flex;
    gap: 0.5rem;
}

.filters select {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    background: var(--bg-white);
    cursor: pointer;
    outline: none;
}

/* ============ TABLE ============ */

.users-table-wrap {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.users-table thead {
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
}

.users-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    white-space: nowrap;
}

.users-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.users-table th.sortable:hover {
    color: var(--accent);
}

.users-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.users-table tr:last-child td {
    border-bottom: none;
}

.user-row:hover {
    background: var(--accent-light);
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    font-size: 0.7rem;
}

.user-name {
    font-weight: 500;
}

.email-cell {
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.usage-cell {
    font-family: monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 3rem !important;
    color: var(--text-muted);
}

/* ============ BADGES ============ */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-pro {
    background: rgba(79, 70, 229, 0.1);
    color: var(--pro-color);
}

.badge-free {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-secondary);
}

.badge-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Additional badge colors */
.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.badge-purple {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

.badge-muted {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
}

/* ============ ACTIONS DROPDOWN ============ */

.actions-cell {
    position: relative;
}

.actions-dropdown {
    position: relative;
    display: inline-block;
}

.actions-trigger {
    letter-spacing: 2px;
    font-weight: bold;
}

.actions-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 160px;
    z-index: 50;
    overflow: hidden;
}

.actions-menu.open {
    display: block;
}

.actions-menu button {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.78rem;
    cursor: pointer;
    color: var(--text-primary);
}

.actions-menu button:hover {
    background: var(--accent-light);
}

.actions-menu button.danger {
    color: var(--danger);
}

.actions-menu button.danger:hover {
    background: rgba(239, 68, 68, 0.08);
}

.actions-menu hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.25rem 0;
}

/* ============ DETAIL ROW ============ */

.detail-row td {
    padding: 0 !important;
    background: var(--bg-main);
}

.detail-content {
    padding: 1.25rem 1.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.detail-section h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.detail-item {
    font-size: 0.78rem;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}

.detail-item label {
    color: var(--text-secondary);
    margin-right: 0.25rem;
}

.muted {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ============ PAGINATION ============ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding: 0 0.5rem;
}

.pagination-info {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    gap: 0.25rem;
}

/* ============ NOTIFICATIONS ============ */

.notification-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

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

.notification-error {
    background: var(--danger);
    color: #fff;
}

.notification-info {
    background: var(--accent);
    color: #fff;
}

/* ============ LOADING / ERROR ============ */

.loading-screen, .error-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: var(--text-secondary);
}

.error-screen h1 {
    font-size: 1.5rem;
    color: var(--danger);
    margin-bottom: 0.5rem;
}

.error-screen a {
    color: var(--accent);
    margin-top: 1rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ CREATE USER MODAL ============ */

#modalOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    align-items: center;
    justify-content: center;
}

#modalOverlay.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.modal-dialog {
    position: relative;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

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

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 1.25rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s;
}

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

.form-error {
    font-size: 0.78rem;
    color: var(--danger);
    min-height: 1.2em;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

/* ============ RESPONSIVE ============ */

@media (max-width: 900px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .controls-row {
        flex-direction: column;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .users-table-wrap {
        overflow-x: auto;
    }
}

/* ============ ADMIN TABS ============ */

.admin-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.35rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.tab-btn.active {
    background: var(--accent);
    color: #fff;
}

.tab-btn svg {
    width: 18px;
    height: 18px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============ SUBSCRIPTION TIERS ============ */

.tiers-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.tiers-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.tiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.tier-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    padding-top: 2.5rem;
    position: relative;
    transition: box-shadow 0.15s;
}

.tier-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.tier-card.inactive {
    opacity: 0.6;
}

.tier-card.default {
    border-color: var(--accent);
    border-width: 2px;
}

.tier-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.tier-name {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.tier-slug {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
}

.tier-badges {
    display: flex;
    gap: 0.35rem;
}

.tier-pricing {
    margin-bottom: 1rem;
}

.tier-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent);
}

.tier-price span {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.tier-price-yearly {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.tier-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.tier-features {
    list-style: none;
    margin-bottom: 1.25rem;
}

.tier-features li {
    font-size: 0.8rem;
    padding: 0.35rem 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tier-features li::before {
    content: '✓';
    color: var(--success);
    font-weight: bold;
}

.tier-features li.unlimited::before {
    content: '∞';
    color: var(--accent);
}

.tier-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.tier-actions .btn {
    flex: 1;
}

/* Add Tier Card */
.tier-card.add-tier {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    border-style: dashed;
    cursor: pointer;
    color: var(--text-secondary);
}

.tier-card.add-tier:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.tier-card.add-tier svg {
    width: 40px;
    height: 40px;
    margin-bottom: 0.75rem;
}

/* ============ SETTINGS ============ */

.section-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    max-width: 1100px;
}

.settings-box {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.settings-box-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
    border-left: 3px solid var(--accent);
}

.settings-box-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.settings-box-title {
    flex: 1;
}

.settings-box-title h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.settings-box-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.settings-box-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
}

.settings-box-status.configured {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.settings-box-status.missing {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.settings-box-status .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.settings-box-body {
    padding: 1rem;
    flex: 1;
}

.settings-field-row {
    margin-bottom: 0.75rem;
}

.settings-field-row:last-child {
    margin-bottom: 0;
}

.settings-field-row label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.settings-input {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.settings-input:focus {
    border-color: var(--accent);
}

input.settings-input[type="password"] {
    font-family: monospace;
    letter-spacing: 0.1em;
}

.settings-box-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg-main);
}

.settings-box-footer .btn {
    width: 100%;
    justify-content: center;
    gap: 0.4rem;
}

.settings-box-footer .btn svg {
    flex-shrink: 0;
}

/* ============ TIER MODAL (Large) ============ */

.modal-dialog.modal-large {
    max-width: 700px;
}

.modal-large .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

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

.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.form-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.form-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

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

.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.15s;
}

.form-group textarea:focus {
    border-color: var(--accent);
}

/* Input with prefix (currency) */
.input-with-prefix {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    padding: 0.6rem 0.75rem;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 8px 0 0 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.input-with-prefix input {
    border-radius: 0 8px 8px 0;
}

/* Danger button */
.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-main);
}

/* ============ TIER SELECT IN TABLE ============ */

.tier-cell {
    min-width: 160px;
}

.tier-select-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tier-select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.78rem;
    background: var(--bg-white);
    cursor: pointer;
    min-width: 80px;
}

.tier-select:focus {
    border-color: var(--accent);
    outline: none;
}

/* ============ CREDITS INPUT IN TABLE ============ */

.credits-cell {
    min-width: 220px;
}

.credits-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.credits-input {
    width: 50px;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.78rem;
    text-align: center;
}

.credits-input:focus {
    border-color: var(--accent);
    outline: none;
}

.credits-type {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.7rem;
    background: var(--bg-white);
    cursor: pointer;
}

.add-credits-btn {
    padding: 0.35rem 0.6rem !important;
    font-size: 0.7rem !important;
}

/* ============ TIER CHANGE CONFIRMATION ============ */

.tier-change-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
    font-size: 1rem;
}

.tier-arrow {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.badge-default {
    background: rgba(79, 70, 229, 0.1);
    color: var(--accent);
}

/* ============ TIER CARD IMPROVEMENTS ============ */

.tier-limits {
    margin: 1rem 0;
}

.limit-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

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

.limit-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.limit-value {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tier-slug {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
    margin-top: 0.5rem;
}

.tier-polar {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
    margin-top: 0.5rem;
}

.tier-inactive {
    opacity: 0.6;
}

/* Tier Delete Button */
.tier-delete-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.tier-delete-btn svg {
    width: 14px;
    height: 14px;
    stroke: white;
}

.tier-delete-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Tier Card Content (Clickable) */
.tier-card-content {
    cursor: pointer;
    transition: opacity 0.15s;
}

.tier-card-content:hover {
    opacity: 0.8;
}

/* Tier User Count */
.tier-user-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    margin: 0.5rem -1.5rem -1.5rem -1.5rem;
    border-top: 1px solid var(--border);
    border-radius: 0 0 12px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s;
}

.tier-user-count:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.tier-user-count:hover svg {
    stroke: var(--accent);
}

.tier-user-count svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-muted);
    transition: stroke 0.15s;
}

/* Tier Users Modal */
.tier-users-list {
    max-height: 400px;
    overflow-y: auto;
}

.tier-user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.tier-user-item:last-child {
    border-bottom: none;
}

.tier-user-item:hover {
    background: var(--accent-light);
}

.tier-user-info {
    flex: 1;
    min-width: 0;
}

.tier-user-name {
    font-weight: 500;
    font-size: 0.85rem;
}

.tier-user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tier-user-usage {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.tier-users-more {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

.loading-users {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.loading-users .spinner {
    margin-bottom: 0.5rem;
}

.error-state {
    text-align: center;
    color: var(--danger);
    padding: 1rem;
}

/* Delete Confirmation Modal */
.modal-header-danger {
    background: rgba(239, 68, 68, 0.08);
    border-bottom-color: rgba(239, 68, 68, 0.2);
}

.modal-header-danger h3 {
    color: var(--danger);
}

.delete-warning-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.delete-warning-icon svg {
    width: 48px;
    height: 48px;
    stroke: var(--danger);
}

.delete-confirm-text {
    text-align: center;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.delete-warning-text {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============ SECTION HEADER ============ */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ============ RESPONSIVE ADDITIONS ============ */

@media (max-width: 1100px) {
    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .tiers-grid {
        grid-template-columns: 1fr;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .admin-tabs {
        flex-direction: column;
    }
    .credits-input-wrap {
        flex-wrap: wrap;
    }
}


/* ============ FEEDBACK TAB ============ */

.feedback-table-wrap {
    background: var(--bg-white);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.feedback-title-cell {
    max-width: 300px;
}

.feedback-title-cell strong {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.feedback-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-select {
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-white);
    cursor: pointer;
}

.status-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Feedback Modal */
.feedback-modal {
    max-width: 600px;
    width: 90%;
}

.feedback-detail-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.feedback-detail-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.feedback-detail-description {
    background: var(--bg-main);
    border-radius: 6px;
    padding: 1rem;
    font-size: 0.875rem;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
}

.feedback-admin-notes {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 6px;
    font-size: 0.8rem;
}

.feedback-admin-notes strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--warning);
}

.stat-warning {
    border-left-color: var(--warning) !important;
}

/* ============ GENERATION HISTORY TAB ============ */

.history-table-wrap {
    background: var(--bg-white);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.history-row .user-cell {
    display: flex;
    flex-direction: column;
}

.history-row .user-name {
    font-weight: 500;
}

.history-row .user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-session-id {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
}

.history-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.history-detail-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.history-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    background: var(--bg-main);
    padding: 0.75rem 1rem;
    border-radius: 6px;
}

.detail-item label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.detail-section {
    margin-bottom: 1rem;
}

.detail-section > label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.detail-section ul {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.875rem;
}

.detail-section ul li {
    margin-bottom: 0.25rem;
}

.error-section {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    padding: 1rem;
}

.error-section pre {
    margin: 0;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--error);
}

.stat-success {
    border-left-color: var(--success) !important;
}

.stat-highlight {
    border-left-color: var(--accent-primary) !important;
}

.controls-row input[type="date"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-white);
}

.controls-row input[type="date"]:focus {
    outline: none;
    border-color: var(--accent-primary);
}

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

/* ============ BADGE UPLOAD ============ */

.badges-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    max-width: 1100px;
}

.badge-upload-box {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.badge-upload-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
    border-left: 3px solid var(--accent);
}

.badge-upload-title {
    flex: 1;
}

.badge-upload-title h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

.badge-upload-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.badge-upload-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
}

.badge-upload-status.configured {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-upload-status.missing {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-upload-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.badge-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.badge-preview-img {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
    border-radius: 6px;
    background: #f0f0f0;
    padding: 0.5rem;
}

.badge-info {
    display: flex;
    gap: 1rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.badge-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg-main);
    border-radius: 8px;
    border: 2px dashed var(--border);
    color: var(--text-muted);
}

.badge-placeholder svg {
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

.badge-placeholder p {
    font-size: 0.8rem;
    margin: 0;
}

.badge-upload-actions {
    display: flex;
    justify-content: center;
}

.upload-badge-btn {
    gap: 0.4rem;
}

@media (max-width: 1100px) {
    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .badges-grid {
        grid-template-columns: 1fr;
    }
}

/* ============ TIER MODAL DISCOUNT SECTION ============ */

.form-section-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 1.5rem 0;
}

.form-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}
