:root {
    --bg-dark: #0a0e14;
    --bg-panel: #12171f;
    --bg-card: #161c26;
    --accent-blue: #2f8fff;
    --accent-teal: #26d9c9;
    --text-main: #e8edf3;
    --text-dim: #8b96a5;
    --border-color: #232a35;
    --online: #26d97a;
    --offline: #ff4d5e;
    --radius: 10px;
}

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

body {
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Segoe UI', Inter, Arial, sans-serif;
    min-height: 100vh;
}

/* ---------- Login ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 20%, #10202c 0%, #0a0e14 60%);
}
.login-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-card h1 {
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 26px;
    margin-bottom: 6px;
}
.subtitle { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
.login-card label { display: block; font-size: 12px; color: var(--text-dim); margin: 14px 0 6px; }
.login-card input {
    width: 100%; padding: 10px 12px; border-radius: 8px;
    border: 1px solid var(--border-color); background: var(--bg-dark);
    color: var(--text-main); font-size: 14px;
}
.login-card button {
    width: 100%; margin-top: 22px; padding: 11px; border: none; border-radius: 8px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-teal));
    color: #05141f; font-weight: 600; font-size: 14px; cursor: pointer;
}
.alert { padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; }
.alert-error { background: rgba(255,77,94,0.12); color: var(--offline); border: 1px solid rgba(255,77,94,0.3); }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px; background: var(--bg-panel); border-right: 1px solid var(--border-color);
    padding: 24px 16px; flex-shrink: 0;
}
.sidebar h2 {
    font-size: 18px; margin-bottom: 30px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-teal));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar a {
    display: block; color: var(--text-dim); text-decoration: none;
    padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 4px;
}
.sidebar a:hover, .sidebar a.active { background: var(--bg-card); color: var(--text-main); }
.main-content { flex: 1; padding: 28px 32px; overflow-x: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.topbar h1 { font-size: 22px; }
.topbar .user-info { font-size: 13px; color: var(--text-dim); }
.topbar a.logout { color: var(--offline); text-decoration: none; margin-left: 12px; }

/* ---------- Grid / Live Wall ---------- */
.stats-row { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius);
    padding: 16px 20px; flex: 1;
}
.stat-card .num { font-size: 26px; font-weight: 700; }
.stat-card .label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.screen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.screen-card {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius);
    overflow: hidden; cursor: pointer; transition: transform 0.15s, border-color 0.15s;
}
.screen-card:hover { transform: translateY(-3px); border-color: var(--accent-blue); }
.screen-thumb {
    width: 100%; aspect-ratio: 16/9; background: #05080c;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.screen-thumb img { width: 100%; height: 100%; object-fit: cover; }
.screen-thumb .placeholder { color: var(--text-dim); font-size: 12px; }
.screen-info { padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; }
.screen-info .name { font-size: 13px; font-weight: 600; }
.screen-info .meta { font-size: 11px; color: var(--text-dim); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.online { background: var(--online); box-shadow: 0 0 8px var(--online); }
.status-dot.offline { background: var(--offline); }

/* ---------- Fullscreen ---------- */
.fullscreen-view { text-align: center; }
.fullscreen-view img {
    max-width: 100%; max-height: 82vh; border-radius: var(--radius); border: 1px solid var(--border-color);
    background: #05080c;
}

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; background: var(--bg-card); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border-color); }
th { color: var(--text-dim); font-weight: 600; text-transform: uppercase; font-size: 11px; }
tr:last-child td { border-bottom: none; }

.btn {
    display: inline-block; padding: 8px 14px; border-radius: 7px; font-size: 13px; text-decoration: none;
    border: none; cursor: pointer; font-weight: 600;
}
.btn-primary { background: linear-gradient(90deg, var(--accent-blue), var(--accent-teal)); color: #05141f; }
.btn-danger { background: rgba(255,77,94,0.15); color: var(--offline); border: 1px solid rgba(255,77,94,0.35); }
.btn-secondary { background: var(--bg-panel); color: var(--text-main); border: 1px solid var(--border-color); }

.form-panel {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius);
    padding: 24px; max-width: 480px;
}
.form-panel label { display: block; font-size: 12px; color: var(--text-dim); margin: 14px 0 6px; }
.form-panel input, .form-panel select {
    width: 100%; padding: 10px 12px; border-radius: 8px;
    border: 1px solid var(--border-color); background: var(--bg-dark); color: var(--text-main); font-size: 14px;
}

.agent-key-box {
    background: var(--bg-dark); border: 1px dashed var(--accent-teal); border-radius: 8px;
    padding: 12px; font-family: monospace; font-size: 13px; word-break: break-all; margin-top: 10px;
}
