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

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #1e2130;
    --bg-hover: #252838;
    --bg-input: #13151d;
    --border: #2a2d3a;
    --border-focus: #6366f1;
    --text-primary: #e8eaed;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);
    --gradient-1: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-2: linear-gradient(135deg, #10b981, #059669);
    --gradient-3: linear-gradient(135deg, #f59e0b, #d97706);
    --gradient-4: linear-gradient(135deg, #ef4444, #dc2626);
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body, html {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}
.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(99,102,241,0.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 60%, rgba(139,92,246,0.06) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
}
@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-2%, 2%) rotate(3deg); }
}
.login-box {
    width: 100%;
    max-width: 420px;
    padding: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo h1 {
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}
.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
}

/* ===== FORMS — REDESIGNED ===== */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.form-control {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    outline: none;
    line-height: 1.5;
}
.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: #161824;
}
.form-control:hover:not(:focus) {
    border-color: #3a3d50;
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}
select.form-control option {
    background: var(--bg-card);
    color: var(--text-primary);
}
textarea.form-control {
    resize: vertical;
    min-height: 100px;
}
.form-control:disabled, .form-control[readonly] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form row helper */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ===== BUTTONS — REDESIGNED ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.1px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 6px 22px var(--accent-glow); }

.btn-success {
    background: var(--gradient-2);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}
.btn-success:hover { box-shadow: 0 6px 22px rgba(16, 185, 129, 0.4); }

.btn-warning {
    background: var(--gradient-3);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
}
.btn-warning:hover { box-shadow: 0 6px 22px rgba(245, 158, 11, 0.4); }

.btn-danger {
    background: var(--gradient-4);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { box-shadow: 0 6px 22px rgba(239, 68, 68, 0.4); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(99, 102, 241, 0.06);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 7px 13px; font-size: 12px; gap: 5px; border-radius: 7px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* Icon-only button */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    font-size: 16px;
}
.btn-icon.btn-sm { width: 30px; height: 30px; font-size: 13px; border-radius: 6px; }

/* ===== LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}
.sidebar {
    width: 180px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-logo {
    padding: 0 14px;
    margin-bottom: 20px;
}
.sidebar-logo h2 {
    font-size: 16px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-logo span {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.sidebar-nav { flex: 1; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.18s;
    cursor: pointer;
    border-left: 3px solid transparent;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
    color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
    border-left-color: var(--accent);
}
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
}

.main-content {
    flex: 1;
    margin-left: 180px;
    padding: 0;
    min-width: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}
.topbar {
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 12px;
}
.topbar-title {
    font-size: 17px;
    font-weight: 600;
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}
.notification-bell {
    position: relative;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
    transition: color 0.2s;
    padding: 6px;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
}
.notification-bell:hover { color: var(--text-primary); background: var(--bg-hover); }
.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    animation: notifPulse 2s ease-in-out infinite;
}
@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
.notif-panel {
    position: absolute;
    top: 44px;
    right: -10px;
    width: 380px;
    max-height: 500px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 1000;
    overflow: hidden;
    animation: notifSlideIn 0.2s ease;
}
@keyframes notifSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
}
.notif-panel-body {
    max-height: 400px;
    overflow-y: auto;
}
.notif-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { border-left: 3px solid var(--accent); background: rgba(99,102,241,0.08); }
.notif-item .notif-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.notif-item .notif-message { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.notif-item .notif-time { font-size: 10px; color: var(--text-secondary); margin-top: 4px; }
.notif-item .notif-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.15s;
}
.notif-item:hover .notif-delete { opacity: 1; }
.notif-item .notif-delete:hover { color: var(--danger); }
.notif-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 340px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 2000;
    padding: 14px 16px;
    animation: notifPopIn 0.3s ease;
    cursor: pointer;
    border-left: 4px solid var(--danger);
}
@keyframes notifPopIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}
.notif-popup.fadeout {
    animation: notifPopOut 0.3s ease forwards;
}
@keyframes notifPopOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}

.page-content {
    padding: 28px;
    min-width: 0;
    width: 100%;
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: all 0.3s;
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}
.stat-card .stat-icon.purple { background: rgba(99,102,241,0.15); color: var(--accent); }
.stat-card .stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-card .stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-card .stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-card .stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 22px;
    overflow: hidden;
    min-width: 0;
    width: 100%;
}
.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}
.card-body { padding: 22px; }

/* ===== TABLES — MOBILE SCROLL ENABLED ===== */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Show scroll hint on mobile */
    position: relative;
}
/* Subtle fade on right edge to hint scrollability */
.table-wrapper::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 20px;
    background: linear-gradient(to right, transparent, var(--bg-card));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* forces scroll on mobile */
}
th {
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: rgba(0,0,0,0.15);
}
td {
    padding: 13px 14px;
    font-size: 13px;
    border-bottom: 1px solid rgba(42,45,58,0.6);
    white-space: nowrap;
}
tr:hover td { background: var(--bg-hover); }
tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: rgba(156,163,175,0.1); color: var(--text-secondary); }
.badge-primary { background: rgba(99,102,241,0.15); color: var(--accent); }

/* ===== MODAL — BOTTOM SHEET ON MOBILE ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.25s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 22px 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    min-width: 300px;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.toast.danger { border-left: 3px solid var(--danger); }
.toast.success { border-left: 3px solid var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast .toast-icon { font-size: 20px; flex-shrink: 0; }
.toast .toast-content { flex: 1; min-width: 0; }
.toast .toast-title { font-weight: 600; font-size: 13px; margin-bottom: 3px; }
.toast .toast-message { font-size: 12px; color: var(--text-secondary); word-break: break-word; }
.toast .toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
    padding: 0 4px;
    -webkit-tap-highlight-color: transparent;
}

/* ===== SEARCH BAR ===== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.search-bar .form-control { flex: 1; min-width: 180px; }

/* ===== PAYMENT PAGE ===== */
.payment-box {
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
}
.payment-qr {
    width: 200px;
    height: 200px;
    margin: 24px auto;
    background: white;
    border-radius: var(--radius);
    padding: 8px;
}
.payment-qr img { width: 100%; height: 100%; }
.payment-address {
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: monospace;
    font-size: 12px;
    word-break: break-all;
    margin: 16px 0;
    cursor: pointer;
    transition: border-color 0.2s;
    line-height: 1.6;
}
.payment-address:hover { border-color: var(--accent); }
.payment-timer {
    font-size: 24px;
    font-weight: 700;
    color: var(--warning);
    margin: 16px 0;
}
.payment-breakdown {
    text-align: left;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 16px 0;
}
.payment-breakdown .row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-secondary);
}
.payment-breakdown .row.total {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 12px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
}

/* ===== TOGGLE ===== */
.toggle {
    position: relative;
    width: 46px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
}
.toggle.active { background: var(--success); }
.toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.toggle.active::after { transform: translateX(20px); }

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 22px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab {
    flex-shrink: 0;
    padding: 9px 16px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.tab.active {
    background: var(--accent);
    color: white;
}
.tab:hover:not(.active) { color: var(--text-primary); }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 14px; }

/* ===== UTILS ===== */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* ===== LOADING ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SYSTEM / DIAGNOSTICS ===== */
.sys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.sys-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sys-card h4 { font-size: 14px; color: var(--text-secondary); }
.sys-card .sys-value { font-size: 18px; font-weight: 600; }
.sys-card .sys-status {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sys-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.sys-dot.green { background: var(--success); box-shadow: 0 0 8px var(--success); }
.sys-dot.red { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.sys-dot.orange { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.sys-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}
.sys-log {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--success);
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
}

/* ===== HAMBURGER MENU ===== */
.hamburger {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-hover);
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    border-radius: 9px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}
.hamburger:hover { background: var(--border); }
.hamburger:active { transform: scale(0.92); }

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ===== RESPONSIVE BREAKPOINTS ===== */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== TABLET / LARGE MOBILE ===== */
@media (max-width: 768px) {
    /* Hamburger */
    .hamburger { display: flex; }

    /* Sidebar slides in */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 200;
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    }

    .main-content { margin-left: 0; }
    .swap-alert-banner { left: 0; top: 56px; }

    /* Topbar */
    .topbar { height: 56px; padding: 0 14px; gap: 10px; }
    .topbar-title { font-size: 15px; }
    .topbar-search-wrapper { display: none !important; }
    .topbar-actions { gap: 8px; }

    /* Page */
    .page-content { padding: 14px; }

    /* Stats */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 11px; }
    .stat-card .stat-icon { width: 38px; height: 38px; font-size: 17px; margin-bottom: 10px; }

    /* Card */
    .card-header { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
    .card-body { padding: 14px 16px; }
    .card-header h3 { font-size: 14px; }

    /* Table — KEY FIX: always scrollable */
    .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
        width: calc(100% + 32px);
    }
    table { min-width: 560px; }
    th { font-size: 10px; padding: 10px 12px; }
    td { font-size: 12px; padding: 10px 12px; }

    /* Forms */
    .form-control { font-size: 16px !important; padding: 14px 16px; } /* iOS zoom fix */
    .form-row { grid-template-columns: 1fr; }
    .search-bar { flex-direction: column; }

    /* Buttons */
    .btn { padding: 12px 18px; font-size: 14px; }
    .btn-sm { padding: 9px 13px; font-size: 12px; }
    .modal-footer .btn { flex: 1; min-width: 0; }

    /* Modal */
    .modal-overlay { align-items: flex-end; }
    .modal {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 20px 20px 0 0 !important;
        max-height: 92vh;
        transform: translateY(100%);
    }
    .modal-overlay.active .modal { transform: translateY(0); }
    .modal-header, .modal-body { padding: 18px 20px; }
    .modal-footer { padding: 14px 20px; gap: 8px; }

    /* Notifications */
    .notif-panel { width: calc(100vw - 24px); right: -8px; }
    .notif-popup { width: calc(100vw - 40px); right: 20px; }

    /* Toast */
    .toast { min-width: 280px; max-width: calc(100vw - 40px); }

    /* Login */
    .login-box { margin: 16px; padding: 32px 24px; }
    .sys-grid { grid-template-columns: 1fr; }
    .payment-box { padding: 0; }
}

/* ===== SMALL MOBILE ===== */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { flex-direction: column; }

    .topbar-title {
        font-size: 14px;
        max-width: 130px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .topbar-actions { gap: 6px; }
    .user-info span { display: none; }

    .card-header { flex-direction: column; align-items: flex-start; }
    .card-header > div, .card-header > .btn { width: 100%; }
    .card-header h3 { width: 100%; }

    .btn-block-mobile { width: 100%; }

    th { font-size: 9px; padding: 8px 10px; }
    td { font-size: 11px; padding: 8px 10px; }

    .page-content { padding: 10px; }

    .toast-container { top: 10px; right: 10px; left: 10px; }
    .toast { min-width: unset; width: 100%; max-width: 100%; }

    .notification-bell { font-size: 18px; padding: 5px; }
}

/* ===== SCROLL INDICATOR (Tables) ===== */
@media (max-width: 768px) {
    .table-scroll-hint {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 11px;
        color: var(--text-muted);
        margin-bottom: 8px;
        padding: 0 4px;
    }
    .table-scroll-hint::before {
        content: '← →';
        font-size: 12px;
        opacity: 0.7;
    }
}


/* ===== SWAP ALERT BANNER ===== */
.swap-alert-banner {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    padding: 10px 20px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    position: fixed;
    top: 0;
    left: 180px;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    animation: bannerPulse 2s infinite;
    box-shadow: 0 2px 12px rgba(220,38,38,0.4);
}
.swap-alert-banner.hidden { display: none; }
.swap-alert-banner button {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 4px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}
.swap-alert-banner button:hover { background: rgba(255,255,255,0.35); }
@keyframes bannerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Swap Popup Overlay */
.swap-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.swap-popup-overlay.hidden { display: none; }
.swap-popup {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 28px;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border: 1px solid var(--border);
}
.swap-popup h3 { margin-bottom: 16px; font-size: 18px; }
.swap-item {
    background: rgba(239,68,68,0.06);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
}
.swap-item .swap-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}
@media (max-width: 768px) {
    .swap-alert-banner { left: 0; top: 56px; }
}


/* ===== FILTER BAR — PREMIUM REDESIGN ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding: 14px 18px;
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid var(--border);
}

.filter-input {
    padding: 9px 14px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    min-width: 160px;
    max-width: 240px;
    flex: 1;
    background: var(--bg-input) !important;
    border: 1.5px solid var(--border) !important;
    color: var(--text-primary) !important;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}
.filter-input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px var(--accent-glow) !important;
    outline: none;
}
.filter-input::placeholder { color: var(--text-muted); }

.filter-select {
    padding: 9px 30px 9px 12px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    min-width: 130px;
    background-color: var(--bg-input) !important;
    border: 1.5px solid var(--border) !important;
    color: var(--text-primary) !important;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}
.filter-select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px var(--accent-glow) !important;
    outline: none;
}
.filter-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Domain filter pills */
.domainFilter {
    border-radius: 20px !important;
    padding: 6px 14px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border: 1.5px solid var(--border) !important;
    color: var(--text-secondary) !important;
    background: transparent !important;
    transition: all 0.18s !important;
    white-space: nowrap;
    cursor: pointer;
}
.domainFilter:hover {
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    background: rgba(99,102,241,0.07) !important;
}
.domainFilter.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    border-color: transparent !important;
    color: white !important;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.3) !important;
}

/* Card body with no padding for tables */
.card-body.p-0 {
    padding: 0 !important;
}

/* Table wrapper — guaranteed scroll on all devices */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.table-wrapper::-webkit-scrollbar { height: 4px; }
.table-wrapper::-webkit-scrollbar-track { background: transparent; }
.table-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.table-wrapper table {
    min-width: 600px;
}

/* Filter groups */
.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.filter-pill-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

/* ===== MOBILE FILTER FIXES ===== */
@media (max-width: 768px) {
    .filter-input {
        min-width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        width: 100%;
    }
    .filter-select {
        flex: 1;
        min-width: calc(50% - 4px);
    }
    .domainFilter {
        padding: 7px 12px !important;
        font-size: 11px !important;
    }
    .filter-pill-group {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    /* Scroll hint for tables */
    .table-wrapper::before {
        content: '← kaydırın →';
        display: block;
        text-align: center;
        font-size: 10px;
        color: var(--text-muted);
        padding: 4px 0 2px;
        letter-spacing: 0.5px;
        background: rgba(0,0,0,0.1);
    }
}

@media (max-width: 480px) {
    .filter-select {
        min-width: 100%;
        flex: none;
        width: 100%;
    }
    .filter-pill-group .domainFilter {
        font-size: 10px !important;
        padding: 5px 10px !important;
    }
}

/* ===== TABLE SCROLL CSS FIX v2 ===== */
/* card-body: keep overflow hidden for border-radius on desktop */
.card-body {
    overflow: hidden;
}
/* table-wrapper: scroll container */
.table-wrapper,
.card-body.table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    width: 100%;
    display: block;
}
/* Desktop: table fills full width */
.table-wrapper table,
.card-body.table-wrapper table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
/* Mobile only: enforce min-width to force scroll */
@media (max-width: 1024px) {
    .table-wrapper table,
    .card-body.table-wrapper table {
        min-width: 560px;
    }
}
/* card: allow overflow for border-radius */
.card {
    overflow: hidden;
}

/* Dashboard date input — compact but not cramped */
#recentActivityDate {
    width: 160px !important;
    font-size: 13px;
    padding: 6px 10px;
}

/* Son İşlemler table — full width on desktop */
#recentTable,
#cronStatusTable,
#customersTable {
    width: 100% !important;
    min-width: 0 !important;
}

/* Stats grid responsive */
@media (min-width: 1025px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
/* 1400px+ still 3 columns — dashboard has 6 cards, 3+3 is ideal */



/* ========================================= */
/* ===== MODERN PREMIUM & RESPONSIVE UI ==== */
/* ========================================= */

/* Glassmorphism Modals */
.modal-content, .login-box, .card {
    background: rgba(30, 33, 48, 0.7) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: var(--shadow-lg) !important;
}

/* Animations & Transitions */
.btn, .sidebar-link, input, select, .card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.05);
    padding-left: 20px !important;
}

/* Scrollbar Styling (Hidden) */
::-webkit-scrollbar { display: none; }
* { -ms-overflow-style: none; scrollbar-width: none; }

/* Table Wrapper for Horizontal Scroll */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

/* Mobile Sidebar (Hamburger Menu logic) */
.mobile-toggle {
    display: none;
    font-size: 24px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 15px;
}

/* Media Queries */
@media (max-width: 768px) {
    /* Layout */
    .dashboard-container {
        flex-direction: column;
    }
    
    /* Sidebar as Offcanvas */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 9999;
        width: 250px;
        transition: 0.3s ease-in-out;
    }
    .sidebar.open {
        left: 0 !important;
        transform: translateX(0) !important;
        left: 0;
    }
    
    /* Show Hamburger Menu */
    .mobile-toggle {
        display: inline-block;
    }
    
    .top-header {
        justify-content: flex-start;
        padding: 10px 15px;
    }
    
    .main-content {
        padding: 10px;
        width: 100%;
    }
    
    /* Modal Fullscreen */
    .modal-content {
        width: 95% !important;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Table font size for mobile */
    .table-responsive table {
        font-size: 13px;
    }
    .table-responsive th, .table-responsive td {
        padding: 10px 5px;
    }
    
    /* Action Buttons in Table */
    .action-btn {
        padding: 6px;
        font-size: 12px;
    }
}
