:root {
    --bg-primary: #0a0a0c;
    --bg-surface: #111114;
    --bg-elevated: #18181b;
    --border: #27272a;
    --border-hover: #3f3f46;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --danger: #ef4444;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);
    --trans: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

.view { display: none; min-height: 100vh; position: relative; }
.view.active { display: block; }

/* Background Elements */
.bg-grid {
    position: absolute; inset: 0; z-index: 0;
    background-image: linear-gradient(rgba(99,102,241,0.02) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(99,102,241,0.02) 1px, transparent 1px);
    background-size: 48px 48px;
}
.bg-orb {
    position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.3;
    animation: float 14s ease-in-out infinite alternate;
}
.orb-primary { width: 600px; height: 600px; background: #4f46e5; top: -15%; left: -10%; }
.orb-secondary { width: 500px; height: 500px; background: #7c3aed; bottom: -10%; right: -5%; animation-delay: -5s; }
@keyframes float { 0% { transform: translate(0, 0); } 100% { transform: translate(25px, -25px); } }

/* Login */
.login-wrapper { position: relative; z-index: 10; display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
.login-card {
    width: 100%; max-width: 400px; background: rgba(17,17,20,0.85); backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow-lg);
}
.brand { text-align: center; margin-bottom: 28px; }
.brand-icon { width: 44px; margin: 0 auto 16px; }
.brand h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.brand h1 span { color: var(--accent); }
.brand p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

/* Forms */
.input-group { margin-bottom: 18px; }
.input-group.compact { margin-bottom: 14px; }
.input-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.input-field { position: relative; display: flex; align-items: center; }
.input-field svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.input-field input, .input-field select, textarea {
    width: 100%; padding: 11px 12px 11px 38px;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font); font-size: 14px;
    transition: var(--trans);
}
.input-field select, textarea { padding-left: 12px; appearance: none; cursor: pointer; resize: vertical; }
.input-field input:focus, .input-field select:focus, textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}
.pass-toggle {
    position: absolute; right: 8px; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px;
}
.pass-toggle svg { position: static; width: 16px; height: 16px; }
.error-msg { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 12px; text-align: center; }
#auth-btn, .btn-primary, .btn-secondary, .nav-btn, .filter, .btn-small {
    width: 100%; padding: 12px 16px; border: none; border-radius: var(--radius-sm);
    font-family: var(--font); font-weight: 600; font-size: 14px; cursor: pointer; transition: var(--trans);
}
#auth-btn, .btn-primary { background: linear-gradient(135deg, var(--accent), #7c3aed); color: #fff; }
#auth-btn:hover, .btn-primary:hover { box-shadow: 0 6px 16px rgba(99,102,241,0.25); transform: translateY(-1px); }
#auth-btn:active { transform: translateY(0); }
.btn-secondary { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-elevated); border-color: var(--border-hover); }
.btn-small { width: auto; padding: 6px 12px; font-size: 12px; background: var(--accent); color: #fff; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row button { width: auto; flex: 1; }
.login-footer { text-align: center; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.login-footer span { font-size: 11px; color: var(--text-muted); }

/* Dashboard Layout */
.topbar {
    position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 56px; background: rgba(10,10,12,0.92); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.role-badge { font-size: 9px; font-weight: 700; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.5px; }
.role-badge.admin { background: rgba(99,102,241,0.12); color: var(--accent-hover); border: 1px solid var(--accent); }
.role-badge.user { background: rgba(34,197,94,0.12); color: var(--success); border: 1px solid var(--success); }
.topbar-nav { display: flex; gap: 4px; align-items: center; }
.nav-btn {
    width: auto; padding: 8px 10px; background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 500;
}
.nav-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }
.nav-btn.active { color: var(--text-primary); background: var(--bg-surface); border: 1px solid var(--border); }
.nav-btn.logout { color: var(--danger); }
.nav-btn.logout:hover { background: rgba(239,68,68,0.08); }

.dashboard-content { max-width: 1000px; margin: 0 auto; padding: 24px; }
.panel { display: none; }
.panel.active { display: block; animation: slideIn 0.25s ease; }
@keyframes slideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Cards & Grids */
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 22px; }
.card h2 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.card-desc { color: var(--text-secondary); font-size: 13px; margin-bottom: 18px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.form-row { display: flex; gap: 14px; margin-bottom: 16px; }
.form-row .input-group { flex: 1; margin-bottom: 0; }
.full-width { grid-column: 1 / -1; }

/* Database Table */
.panel-header { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-wrap { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.search-wrap svg { width: 14px; height: 14px; color: var(--text-muted); }
.search-wrap input { padding: 0; background: transparent; border: none; width: 160px; font-size: 13px; }
.search-wrap input:focus { outline: none; box-shadow: none; }
.filter-wrap { display: flex; gap: 4px; }
.filter { width: auto; padding: 6px 10px; background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.filter.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.table-container { overflow-x: auto; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { padding: 12px 14px; text-align: left; font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-elevated); }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
.status-badge { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 11px; text-transform: uppercase; }
.status-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.status-badge.online { color: var(--success); }
.status-badge.online::before { background: var(--success); box-shadow: 0 0 5px var(--success); }
.status-badge.offline { color: var(--danger); }
.status-badge.offline::before { background: var(--danger); box-shadow: 0 0 5px var(--danger); }
.pass-mask { font-family: monospace; background: var(--bg-elevated); padding: 4px 6px; border-radius: 4px; cursor: pointer; border: none; color: var(--text-secondary); font-size: 12px; transition: var(--trans); }
.pass-mask:hover { color: var(--text-primary); background: var(--border); }
.action-btns { display: flex; gap: 6px; }
.action-btn { padding: 5px 8px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); font-size: 11px; cursor: pointer; transition: var(--trans); }
.action-btn:hover { color: var(--text-primary); border-color: var(--border-hover); }
.action-btn.del:hover { color: var(--danger); border-color: var(--danger); background: rgba(239,68,68,0.08); }

/* Outputs & Checker */
.output-panel { margin-top: 22px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.output-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.output-header h3 { font-size: 14px; font-weight: 600; }
#gen-list { padding: 12px 16px; max-height: 300px; overflow-y: auto; }
.gen-item { display: flex; align-items: center; justify-content: space-between; padding: 10px; background: var(--bg-elevated); border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 13px; border: 1px solid var(--border); }
.gen-item .em { color: var(--accent-hover); font-weight: 600; }
.gen-item .pw { color: var(--text-secondary); font-family: monospace; }
.gen-item .dt { color: var(--success); font-size: 11px; }

.progress-section { margin-top: 18px; }
.progress-track { width: 100%; height: 4px; background: var(--bg-elevated); border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
#check-bar, #u-check-bar { height: 100%; background: var(--accent); width: 0%; transition: width 0.3s ease; }
#check-status, #u-check-status { font-size: 12px; color: var(--text-secondary); }
.result-feed { margin-top: 16px; max-height: 280px; overflow-y: auto; }
.check-res { display: flex; justify-content: space-between; padding: 10px; border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 13px; }
.check-res.live { background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.15); }
.check-res.dead { background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.15); }
.check-res .cr-status { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.check-res.live .cr-status { color: var(--success); }
.check-res.dead .cr-status { color: var(--danger); }

/* Settings */
.info-list { list-style: none; }
.info-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.info-list li:last-child { border-bottom: none; }
.info-list li span:first-child { color: var(--text-secondary); }
.tag { background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.stat-block { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.stat-block strong { font-size: 16px; font-weight: 700; }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.status-msg { margin-top: 10px; font-size: 13px; min-height: 18px; }

/* User Accounts */
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 18px; }
.acc-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; transition: var(--trans); }
.acc-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.acc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.acc-email { font-weight: 600; color: var(--accent-hover); word-break: break-all; }
.acc-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.acc-row .label { color: var(--text-muted); }
.acc-row .val { font-family: monospace; }
.acc-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Toast */
.toast {
    position: fixed; bottom: 24px; right: 24px; padding: 12px 16px; background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; z-index: 9999; transform: translateY(120px); opacity: 0; transition: var(--trans); box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
    .topbar { flex-direction: column; height: auto; padding: 12px; gap: 10px; }
    .topbar-nav { width: 100%; overflow-x: auto; padding-bottom: 6px; justify-content: flex-start; }
    .dashboard-content { padding: 16px; }
    .form-row { flex-direction: column; gap: 12px; }
    .panel-header { flex-direction: column; align-items: flex-start; }
    .panel-controls { width: 100%; flex-direction: column; }
    .search-wrap input { width: 100%; }
    .metrics-grid, .card-grid { grid-template-columns: 1fr; }
}