/* ==================== ADMIN PANEL - SIMPLE & FUNCTIONAL ==================== */
/* Deliberately plain: no gradients, no blur, no animation. Just clear and usable. */

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

:root {
    --bg: #14151a;
    --panel: #1c1e24;
    --panel-2: #22242b;
    --border: #33353e;
    --text: #eaeaee;
    --text-dim: #9a9ca5;
    --gold: #ffc531;
    --blue: #4d9fff;
    --green: #3ecf6e;
    --red: #ff5c5c;
    --orange: #ffa53e;
}

body {
    font-family: -apple-system, 'Segoe UI', Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.hidden { display: none !important; }

a { color: var(--blue); }

button {
    font-family: inherit;
    cursor: pointer;
}

input, textarea, select {
    font-family: inherit;
    font-size: 14px;
}

code {
    background: var(--panel-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* ==================== LOGIN SCREEN ==================== */
#login-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.login-box {
    width: 100%;
    max-width: 360px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 28px;
}

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

.login-box .sub {
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    margin-bottom: 20px;
}

/* ==================== FORM ELEMENTS ==================== */
.field {
    margin-bottom: 14px;
}

.field label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.field input, .field textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
}

.field input:focus, .field textarea:focus {
    outline: none;
    border-color: var(--gold);
}

.field textarea {
    resize: vertical;
    min-height: 100px;
    font-family: monospace;
    font-size: 13px;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel-2);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.btn:hover { background: #2a2d35; }

.btn-primary {
    background: var(--gold);
    color: #1a1300;
    border-color: var(--gold);
}

.btn-primary:hover { background: #ffcf55; }

.btn-danger {
    color: var(--red);
    border-color: var(--red);
}

.btn-danger:hover { background: rgba(255,92,92,0.1); }

.btn-block { width: 100%; justify-content: center; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==================== LAYOUT ==================== */
.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

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

.topbar h1 {
    font-size: 18px;
}

.topbar .who {
    font-size: 13px;
    color: var(--text-dim);
}

/* ==================== TABS ==================== */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tab {
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.tab:hover:not(.active) { color: var(--text); }

/* ==================== PANEL / CARD ==================== */
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.panel h2 {
    font-size: 15px;
    margin-bottom: 4px;
}

.panel .hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 14px;
}

.row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.row-end { margin-left: auto; }

/* ==================== STAT CARDS ==================== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: 6px;
    padding: 14px;
}

.stat .label { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.stat .value { font-size: 24px; font-weight: 700; }
.stat .detail { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.stat.blue { border-left-color: var(--blue); }
.stat.green { border-left-color: var(--green); }
.stat.orange { border-left-color: var(--orange); }

/* ==================== TABLE ==================== */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    text-align: left;
    padding: 10px 12px;
    background: var(--panel-2);
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:hover td { background: rgba(255,255,255,0.02); }

.mono { font-family: monospace; font-size: 12px; }

.empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-dim);
    font-size: 13px;
}

.pager {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-dim);
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.badge-green { background: rgba(62,207,110,0.15); color: var(--green); }
.badge-red { background: rgba(255,92,92,0.15); color: var(--red); }
.badge-orange { background: rgba(255,165,62,0.15); color: var(--orange); }
.badge-gray { background: rgba(255,255,255,0.08); color: var(--text-dim); }

/* ==================== ALERT / STATUS MESSAGES ==================== */
.msg {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 10px;
}

.msg-error { background: rgba(255,92,92,0.1); color: var(--red); border: 1px solid rgba(255,92,92,0.3); }
.msg-success { background: rgba(62,207,110,0.1); color: var(--green); border: 1px solid rgba(62,207,110,0.3); }
.msg-info { background: rgba(77,159,255,0.1); color: var(--blue); border: 1px solid rgba(77,159,255,0.3); }

/* ==================== PROXY BAR ==================== */
.proxy-item {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
}

.proxy-bar {
    background: var(--bg);
    border-radius: 4px;
    height: 16px;
    overflow: hidden;
    position: relative;
    margin-top: 6px;
}

.proxy-bar-fill {
    background: var(--gold);
    height: 100%;
}

.proxy-bar-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #1a1300;
}

/* ==================== DANGER ZONE ==================== */
.danger-zone {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 16px;
}

.danger-zone .title {
    color: var(--red);
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 13px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
    .wrap { padding: 12px; }
    .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ==================== EMOJI PICKER ==================== */
#emoji-picker-overlay {
    position: fixed; inset: 0; z-index: 9999;
    display: none; align-items: center; justify-content: center;
}
#emoji-picker-overlay .emoji-backdrop {
    position: absolute; inset: 0; background: rgba(0,0,0,0.6);
}
#emoji-picker-overlay .emoji-panel {
    position: relative; width: min(520px, 92vw); max-height: 70vh;
    background: var(--panel, #131a2e); border: 1px solid var(--border, #1e2a45);
    border-radius: 14px; display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.emoji-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border, #1e2a45);
    font-weight: 700; color: var(--text, #e2e8f0); font-size: 15px;
}
.emoji-head button {
    background: none; border: none; color: var(--text-dim, #94a3b8);
    font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.emoji-head button:hover { background: var(--panel-2, #0a0e1a); color: var(--text, #fff); }
.emoji-body { overflow-y: auto; padding: 8px 14px 16px; }
.emoji-cat {
    font-size: 12px; font-weight: 700; color: var(--gold, #f59e0b);
    margin: 14px 0 8px; position: sticky; top: 0;
    background: var(--panel, #131a2e); padding: 4px 0;
}
.emoji-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px;
}
.emoji-item {
    font-size: 24px; line-height: 1; padding: 6px; background: none;
    border: 1px solid transparent; border-radius: 8px; cursor: pointer;
    transition: background 0.12s, transform 0.12s;
}
.emoji-item:hover {
    background: var(--panel-2, #0a0e1a); border-color: var(--gold-dim, #92610a);
    transform: scale(1.15);
}
.emoji-item { display: flex; align-items: center; justify-content: center; }
.emoji-item .emoji-img { width: 28px; height: 28px; display: block; pointer-events: none; }
.emoji-item span { font-size: 24px; line-height: 1; }
