:root {
    --bg-primary: #0f1117;
    --bg-secondary: #161822;
    --bg-card: #1a1d2e;
    --bg-hover: #222640;
    --border: #2a2e42;
    --text-primary: #e4e6f0;
    --text-secondary: #8b8fa3;
    --text-muted: #5c6078;
    --accent: #cd412b;
    --accent-hover: #e04e37;
    --green: #22c55e;
    --green-dim: rgba(34, 197, 94, 0.15);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.15);
    --yellow: #eab308;
    --yellow-dim: rgba(234, 179, 8, 0.15);
    --blue: #3b82f6;
    --blue-dim: rgba(59, 130, 246, 0.15);
    --purple: #a855f7;
    --purple-dim: rgba(168, 85, 247, 0.15);
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --transition: 150ms ease;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; overflow: hidden; }
.mono { font-family: 'JetBrains Mono', monospace; }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
.text-red { color: var(--red); }
.app { display: flex; height: 100vh; }

/* Sidebar */
.sidebar { width: 220px; background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 18px; border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: 10px; }
.logo h1 { font-size: 15px; font-weight: 700; }
.logo .version { font-size: 10px; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: var(--radius-sm); color: var(--text-secondary); text-decoration: none; font-size: 13px; font-weight: 500; transition: all var(--transition); }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent); color: white; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--border); }
.connection-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.connected { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.disconnected { background: var(--red); }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); flex-shrink: 0; }
.topbar h2 { font-size: 18px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.guild-selector select { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); padding: 5px 8px; border-radius: var(--radius-sm); font-size: 12px; font-family: 'JetBrains Mono', monospace; }
.last-update { font-size: 11px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.content { flex: 1; overflow-y: auto; padding: 20px 24px; }
.section { display: none; }
.section.active { display: block; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stats-grid-small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; gap: 12px; transition: border-color var(--transition); }
.stat-card:hover { border-color: var(--accent); }
.stat-card.stat-sm { padding: 12px; }
.stat-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 20px; font-weight: 700; }
.stat-sm .stat-icon { width: 36px; height: 36px; font-size: 16px; }
.stat-icon.blue { background: var(--blue-dim); color: var(--blue); }
.stat-icon.green { background: var(--green-dim); color: var(--green); }
.stat-icon.red { background: var(--red-dim); color: var(--red); }
.stat-icon.yellow { background: var(--yellow-dim); color: var(--yellow); }
.stat-icon.purple { background: var(--purple-dim); color: var(--purple); }
.stat-label { font-size: 12px; color: var(--text-secondary); }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-body { padding: 16px 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 .card { margin-bottom: 0; }

/* Badge */
.badge { font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 500; font-family: 'JetBrains Mono', monospace; background: var(--bg-hover); color: var(--text-secondary); }
.badge.online { background: var(--green-dim); color: var(--green); }
.badge.offline { background: var(--red-dim); color: var(--red); }

/* Server */
.server-banner { border-radius: 8px; overflow: hidden; max-height: 100px; margin-bottom: 14px; }
.server-banner img { width: 100%; object-fit: cover; }
.server-info { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.server-info dt { color: var(--text-secondary); font-weight: 500; }
.server-info dd { color: var(--text-primary); font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.server-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.server-row:last-child { border-bottom: none; }
.server-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--bg-hover); overflow: hidden; flex-shrink: 0; }
.server-icon img { width: 100%; height: 100%; object-fit: cover; }
.server-details { flex: 1; }
.server-name { font-weight: 600; font-size: 13px; }
.server-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.server-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.server-stats { display: flex; gap: 10px; font-size: 11px; color: var(--text-muted); }

/* Time */
.time-display { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.time-clock { font-size: 32px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.time-label { font-size: 14px; color: var(--text-secondary); }
.time-bar { position: relative; height: 8px; background: #1e2235; border-radius: 4px; margin-bottom: 12px; overflow: visible; }
.time-bar-day { position: absolute; top: 0; height: 100%; background: linear-gradient(90deg, #f59e0b33, #f59e0b66, #f59e0b33); border-radius: 4px; }
.time-bar-marker { position: absolute; top: -4px; width: 4px; height: 16px; background: var(--text-primary); border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 6px rgba(255,255,255,0.3); }
.time-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; }

/* Team */
.team-member { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.team-member:last-child { border-bottom: none; }
.team-member.offline { opacity: 0.5; }
.member-status { flex-shrink: 0; }
.member-info { flex: 1; }
.member-name { font-weight: 600; font-size: 14px; }
.member-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.member-pos { font-size: 11px; color: var(--text-muted); }

/* Events */
.event-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(42, 46, 66, 0.4); font-size: 13px; }
.event-row:last-child { border-bottom: none; }
.event-icon { font-size: 16px; flex-shrink: 0; }
.activity-row { padding: 6px 0; border-bottom: 1px solid rgba(42, 46, 66, 0.3); font-size: 12px; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; }
.scroll-list { max-height: 250px; overflow-y: auto; }
.scroll-list-lg { max-height: 400px; overflow-y: auto; }

/* Devices */
.device-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.device-item:last-child { border-bottom: none; }
.device-name { display: flex; align-items: center; gap: 8px; }
.device-actions { display: flex; align-items: center; gap: 12px; }
.device-status { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.device-status.active { background: var(--green); box-shadow: 0 0 6px var(--green); }
.device-status.inactive { background: var(--text-muted); }
.device-status.unreachable { background: var(--red); }
.device-meta { font-size: 11px; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; }

/* Switch Toggle */
.switch-toggle { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.switch-toggle input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; inset: 0; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 22px; transition: all var(--transition); }
.switch-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: var(--text-muted); border-radius: 50%; transition: all var(--transition); }
.switch-toggle input:checked + .switch-slider { background: var(--green-dim); border-color: var(--green); }
.switch-toggle input:checked + .switch-slider::before { transform: translateX(18px); background: var(--green); }

/* Hosters */
.hoster-card { display: flex; align-items: center; justify-content: space-between; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; transition: border-color var(--transition); }
.hoster-card:last-child { margin-bottom: 0; }
.hoster-card:hover { border-color: var(--text-muted); }
.hoster-card.is-hoster { border-color: var(--green); background: var(--green-dim); }
.hoster-info { display: flex; align-items: center; gap: 12px; }
.hoster-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--bg-hover); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); flex-shrink: 0; }
.is-hoster .hoster-avatar { background: var(--green); color: #fff; }
.hoster-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.steam-name { font-weight: 600; font-size: 14px; }
.hoster-tag { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--green); color: #fff; letter-spacing: 0.5px; }
.expired-tag { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--red); color: #fff; }
.hoster-meta { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }
.current-hoster-label { font-size: 12px; color: var(--green); font-weight: 600; }

/* Settings */
.settings-grid { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; }
.setting-row { display: contents; }
.setting-key { font-size: 12px; color: var(--text-secondary); padding: 6px 0; border-bottom: 1px solid var(--border); }
.setting-value { font-size: 12px; font-family: 'JetBrains Mono', monospace; padding: 6px 0; border-bottom: 1px solid var(--border); text-align: right; }
.setting-value.true { color: var(--green); }
.setting-value.false { color: var(--text-muted); }
.notif-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.notif-row:last-child { border-bottom: none; }
.notif-name { color: var(--text-primary); font-weight: 500; }
.notif-channels { display: flex; gap: 5px; }
.notif-tag { font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 500; }
.notif-tag.on { background: var(--green-dim); color: var(--green); }
.notif-tag.off { background: rgba(92, 96, 120, 0.2); color: var(--text-muted); }

/* Logs */
.log-container { max-height: 500px; overflow-y: auto; font-family: 'JetBrains Mono', monospace; font-size: 11px; line-height: 1.8; }
.log-line { padding: 1px 0; color: var(--text-secondary); border-bottom: 1px solid rgba(42, 46, 66, 0.3); }
.log-line:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Buttons */
.btn { padding: 7px 14px; border: none; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; font-family: 'Inter', sans-serif; cursor: pointer; transition: all var(--transition); }
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(0.97); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 10px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: #fff; z-index: 9999; opacity: 0; transform: translateY(10px); transition: all 300ms ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--blue); }

/* Empty */
.empty-state { text-align: center; padding: 30px 16px; color: var(--text-muted); font-size: 13px; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Responsive */
@media (max-width: 1024px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
    .sidebar { width: 56px; }
    .sidebar .logo div, .nav-item span, .sidebar-footer span:not(.status-dot) { display: none; }
    .nav-item { justify-content: center; padding: 11px; }
    .sidebar-header { padding: 14px; }
    .logo { justify-content: center; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .content { padding: 14px; }
}
