/* ============================
   CFriend v2.0 — Design System
   ============================ */

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

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: #16161f;
    --bg-card-hover: #1e1e2a;
    --bg-sidebar: #0d0d14;
    --bg-modal: #1a1a24;

    --border: #ffffff0f;
    --border-hover: #ffffff1a;
    --border-active: #6c63ff33;

    --accent: #6c63ff;
    --accent-dim: #6c63ff22;
    --accent-hover: #7b73ff;
    --accent-green: #00d97e;
    --accent-green-dim: #00d97e1a;
    --accent-red: #ff4d6d;
    --accent-red-dim: #ff4d6d1a;
    --accent-orange: #ff9a3c;
    --accent-orange-dim: #ff9a3c1a;
    --accent-blue: #3c9eff;
    --accent-blue-dim: #3c9eff1a;
    --accent-purple: #b44dff;
    --accent-purple-dim: #b44dff1a;

    --text-primary: #f0f0ff;
    --text-secondary: #8888aa;
    --text-muted: #55556a;

    --sidebar-width: 240px;
    --header-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;

    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);

    --font: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ffffff15; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #ffffff25; }

/* ============================
   SIDEBAR
   ============================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.25s ease;
}

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

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

.logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--accent-blue));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px;
}

.logo-icon svg { width: 100%; height: 100%; color: white; }

.logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff, #aaaad0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.version-badge {
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    width: 100%;
    text-align: left;
    position: relative;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
}

.nav-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 0 5px;
    background: var(--accent-dim);
    color: var(--accent);
}

.nav-badge.alert { background: var(--accent-red-dim); color: var(--accent-red); }
.nav-badge.beta { background: var(--accent-orange-dim); color: var(--accent-orange); font-size: 9px; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================
   MAIN CONTENT
   ============================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}

/* ============================
   TOP HEADER
   ============================ */
.top-header {
    height: var(--header-height);
    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;
    flex-shrink: 0;
}

.header-left { display: flex; align-items: center; gap: 14px; }

.sidebar-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.sidebar-toggle:hover { background: var(--bg-card); color: var(--text-primary); }
.sidebar-toggle svg { width: 18px; height: 18px; }

.breadcrumb {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.header-right { display: flex; align-items: center; gap: 16px; }

.header-stats { display: flex; gap: 10px; }

.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.time-display {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================
   STATUS DOT
   ============================ */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}
.status-dot.online { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green)88; animation: pulse-dot 2s infinite; }
.status-dot.offline { background: var(--accent-red); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; }
.chip-dot.online { background: var(--accent-green); animation: pulse-dot 2s infinite; }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ============================
   PAGES
   ============================ */
.pages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.page {
    display: none;
    padding: 28px 28px 40px;
    animation: fadeIn 0.2s ease;
}

.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-title {
    margin-bottom: 24px;
}

.page-title h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.page-title p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ============================
   STATS GRID (Dashboard)
   ============================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon svg { width: 22px; height: 22px; }
.stat-card-icon.green { background: var(--accent-green-dim); color: var(--accent-green); }
.stat-card-icon.blue { background: var(--accent-blue-dim); color: var(--accent-blue); }
.stat-card-icon.purple { background: var(--accent-purple-dim); color: var(--accent-purple); }
.stat-card-icon.orange { background: var(--accent-orange-dim); color: var(--accent-orange); }

.stat-card-info { flex: 1; }
.stat-value { display: block; font-size: 32px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; display: block; }

/* ============================
   SECTION CARD
   ============================ */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.section-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================
   CLIENTS GRID
   ============================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: border-color 0.15s;
}

.search-box:focus-within { border-color: var(--accent); }
.search-box svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-box input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
}
.search-box input::placeholder { color: var(--text-muted); }

.label-count {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.client-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.client-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-blue));
    opacity: 0;
    transition: opacity 0.2s;
}

.client-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.client-card:hover::before { opacity: 1; }

.client-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.client-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-dim), var(--accent-blue-dim));
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.client-name-group { flex: 1; min-width: 0; }
.client-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.client-ip {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 2px;
}

.client-badge-online {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green)88;
    animation: pulse-dot 2s infinite;
    flex-shrink: 0;
}

.client-info-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
}

.client-info-row svg { width: 13px; height: 13px; color: var(--text-muted); flex-shrink: 0; margin-top: 1px; }
.client-info-label { color: var(--text-muted); white-space: nowrap; }
.client-info-value {
    color: var(--text-secondary);
    word-break: break-word;
    flex: 1;
}

.client-window-row {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid var(--border);
}

.client-card-footer {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

.btn-card {
    flex: 1;
    padding: 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-card:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-hover); }
.btn-card.primary { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-dim); }
.btn-card.primary:hover { background: var(--accent); color: white; }
.btn-card.purple { background: var(--accent-purple-dim); color: var(--accent-purple); border-color: var(--accent-purple-dim); }
.btn-card.purple:hover { background: var(--accent-purple); color: white; }
.btn-card.danger { background: var(--accent-red-dim); color: var(--accent-red); border-color: transparent; }
.btn-card.danger:hover { background: var(--accent-red); color: white; }

/* ============================
   CONTROL REMOTE PAGE
   ============================ */
.control-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: start;
}

.screen-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.screen-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.screen-info { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.screen-controls { display: flex; align-items: center; gap: 8px; }

.canvas-wrapper {
    position: relative;
    background: #000;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#remote-screen, #hvnc-screen, #dd-screen, #v2-screen {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    cursor: crosshair;
}

.screen-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--bg-card);
    pointer-events: none;
    transition: opacity 0.3s;
}

.screen-overlay.hidden { opacity: 0; pointer-events: none; }
.screen-overlay svg { width: 48px; height: 48px; color: var(--text-muted); }
.screen-overlay p { font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.screen-overlay span { font-size: 12px; color: var(--text-muted); }

.screen-statusbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.control-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.control-section h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

/* Keyboard */
.keyboard-section { display: flex; flex-direction: column; gap: 6px; }
.key-row { display: flex; gap: 4px; justify-content: center; }

.vkey {
    padding: 7px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-secondary);
    font-size: 11px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.1s;
    min-width: 36px;
    text-align: center;
    user-select: none;
}

.vkey:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-dim); }
.vkey:active { transform: scale(0.95); }
.vkey.wide { flex: 1; }
.vkey.mod.active { background: var(--accent); color: white; border-color: var(--accent); }
.vkey.arrow { width: 36px; }

.key-input-row {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.key-text-input {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s;
}
.key-text-input:focus { border-color: var(--accent); }
.key-text-input::placeholder { color: var(--text-muted); }

/* Shortcuts */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.shortcut-btn {
    padding: 7px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 11px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.shortcut-btn:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-dim); }

.client-info-panel {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ============================
   HVNC PAGE
   ============================ */
.hvnc-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    align-items: start;
}

.hvnc-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hvnc-sidebar h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.hvnc-select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}
.hvnc-select:focus { border-color: var(--accent); }
.hvnc-select option { background: var(--bg-card); }

.hvnc-windows-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 8px;
}

.hvnc-window-item {
    padding: 7px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hvnc-window-item:hover { background: var(--accent-dim); color: var(--accent); border-color: transparent; }
.hvnc-window-item.active { background: var(--accent); color: white; }

.hvnc-actions { display: flex; flex-direction: column; gap: 8px; }
.hvnc-screen-area {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.hvnc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.hvnc-status-text { font-size: 12px; color: var(--text-secondary); }
.hvnc-window-title { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); flex: 1; text-align: right; }

.hvnc-canvas-wrapper { min-height: 400px; }
#hvnc-screen { max-width: 100%; display: block; cursor: crosshair; }

/* ============================
   NOTIFICATIONS
   ============================ */
.notif-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--accent-orange-dim);
    border: 1px solid var(--accent-orange)33;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 13px;
}

.notif-warning svg { width: 20px; height: 20px; color: var(--accent-orange); flex-shrink: 0; margin-top: 1px; }
.notif-warning strong { display: block; color: var(--accent-orange); font-size: 14px; margin-bottom: 4px; }
.notif-warning p { color: var(--text-secondary); font-size: 12px; }

.notif-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notif-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    animation: slideIn 0.3s ease;
    position: relative;
    overflow: hidden;
}

.notif-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.notif-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.notif-icon svg { width: 18px; height: 18px; color: var(--accent); }

.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.notif-meta { font-size: 11px; color: var(--text-muted); }
.notif-site { font-family: var(--font-mono); color: var(--accent); font-size: 12px; margin-top: 4px; }

.notif-time {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================
   SECURITY PAGE
   ============================ */
.security-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.security-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.security-card-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.security-card-header svg { width: 16px; height: 16px; }
.security-card-header h3 { font-size: 14px; font-weight: 600; }

.security-card-body { padding: 14px 16px; }

.security-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.security-row:last-child { border-bottom: none; }
.security-row-label { color: var(--text-muted); }
.security-row-value { color: var(--text-secondary); text-align: right; font-family: var(--font-mono); }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    margin: 2px;
}
.tag.green { background: var(--accent-green-dim); color: var(--accent-green); }
.tag.red { background: var(--accent-red-dim); color: var(--accent-red); }
.tag.orange { background: var(--accent-orange-dim); color: var(--accent-orange); }
.tag.blue { background: var(--accent-blue-dim); color: var(--accent-blue); }
.tag.purple { background: var(--accent-purple-dim); color: var(--accent-purple); }
.tag.gray { background: var(--bg-secondary); color: var(--text-muted); }

/* ============================
   BUTTONS
   ============================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary svg { width: 15px; height: 15px; }

.btn-primary-full {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-primary-full:hover { background: var(--accent-hover); }
.btn-primary-full svg { width: 14px; height: 14px; }

.btn-primary-sm {
    padding: 7px 12px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-primary-sm:hover { background: var(--accent-hover); }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-hover); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
    border-radius: var(--radius-sm);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-card); }
.btn-ghost svg { width: 14px; height: 14px; }

.btn-ghost-full {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 7px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-ghost-full:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn-danger-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--accent-red-dim);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--accent-red);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-danger-sm:hover { background: var(--accent-red); color: white; }
.btn-danger-sm svg { width: 13px; height: 13px; }

.btn-danger-full {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--accent-red-dim);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--accent-red);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-danger-full:hover { background: var(--accent-red); color: white; }
.btn-danger-full svg { width: 14px; height: 14px; }

.btn-icon {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.btn-icon:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.btn-icon svg { width: 14px; height: 14px; }

/* ============================
   TOGGLE
   ============================ */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
}

.toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 34px;
    height: 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toggle::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--text-muted);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.2s;
}

.toggle:checked { background: var(--accent); border-color: var(--accent); }
.toggle:checked::after { left: 18px; background: white; }

/* ============================
   MODAL
   ============================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.modal-close:hover { background: var(--accent-red-dim); color: var(--accent-red); }

.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================
   TOAST NOTIFICATIONS
   ============================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    max-width: 360px;
}

.toast {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    cursor: pointer;
    transition: opacity 0.3s;
}

.toast.leaving { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(30px); }
}

.toast-icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.toast-msg { font-size: 11px; color: var(--text-secondary); margin-top: 2px; word-break: break-word; }

.toast.info .toast-icon { color: var(--accent-blue); }
.toast.success .toast-icon { color: var(--accent-green); }
.toast.warning .toast-icon { color: var(--accent-orange); }
.toast.error .toast-icon { color: var(--accent-red); }
.toast.site .toast-icon { color: var(--accent); }

/* ============================
   EMPTY STATES
   ============================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state svg { width: 42px; height: 42px; opacity: 0.4; }
.empty-state p { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.empty-state span { font-size: 12px; color: var(--text-muted); }
.empty-state.large svg { width: 60px; height: 60px; }
.empty-state.large p { font-size: 16px; }
.empty-state.small { padding: 20px; }
.info-empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 10px 0; }

/* ============================
   DASHBOARD CLIENT TABLE
   ============================ */
.clients-table-container {
    overflow-x: auto;
}

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

.clients-table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.clients-table td {
    padding: 12px 16px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border)88;
    vertical-align: middle;
}

.clients-table tr:last-child td { border-bottom: none; }
.clients-table tr:hover td { background: var(--bg-card-hover); }
.clients-table .mono { font-family: var(--font-mono); }
.clients-table .bold { font-weight: 600; color: var(--text-primary); }

/* ============================
   DD TOOLBAR
   ============================ */
.dd-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #1e1e24;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.dd-monitor-select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
    outline: none;
    padding-right: 10px;
    cursor: pointer;
}

.dd-monitor-select option {
    background: var(--bg-card);
}

.hvnc-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.hvnc-select:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.hvnc-select option {
    background: var(--bg-modal);
    color: var(--text-primary);
    padding: 10px;
}

.dd-toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

.dd-quality-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.dd-quality-slider {
    -webkit-appearance: none;
    width: 80px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}

.dd-quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-green);
    cursor: pointer;
}

.text-danger { color: var(--accent-red) !important; }
.text-danger:hover { background: var(--accent-red-dim) !important; }

.text-success { color: var(--accent-green) !important; }
.text-success:hover { background: var(--accent-green-dim) !important; }

/* ============================
   SITE MONITOR PAGE
   ============================ */
/* Toggle grande (controle global) */
.sitemonitor-toggle-big {
    position: relative;
    display: inline-block;
    width: 62px;
    height: 32px;
    cursor: pointer;
    flex-shrink: 0;
}
.sitemonitor-toggle-big input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.sitemonitor-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(.4,0,.2,1);
}
.sitemonitor-slider::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    left: 3px;
    top: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.sitemonitor-toggle-big input:checked + .sitemonitor-slider {
    background: var(--accent-green);
    border-color: var(--accent-green);
    box-shadow: 0 0 16px var(--accent-green)55;
}
.sitemonitor-toggle-big input:checked + .sitemonitor-slider::before {
    transform: translateX(30px);
    background: white;
}

/* Cards de clientes individuais */
.sitemonitor-client-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    border: 1px solid transparent;
}
.sitemonitor-client-row:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}
.sitemonitor-client-row.enabled {
    border-left: 3px solid var(--accent-green);
}
.sitemonitor-client-row.disabled {
    border-left: 3px solid var(--accent-red);
    opacity: 0.75;
}
.sitemonitor-avatar {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--accent-dim), var(--accent-blue-dim));
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}
.sitemonitor-client-info { flex: 1; min-width: 0; }
.sitemonitor-client-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.sitemonitor-client-meta { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 1px; }
.sitemonitor-client-status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}
.sitemonitor-client-status.on {
    background: rgba(0,217,126,0.15);
    color: var(--accent-green);
}
.sitemonitor-client-status.off {
    background: rgba(255,77,109,0.12);
    color: var(--accent-red);
}

/* Toggle pequeno (individual) */
.sitemonitor-toggle-sm {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}
.sitemonitor-toggle-sm input { opacity: 0; width: 0; height: 0; position: absolute; }
.sitemonitor-slider-sm {
    position: absolute;
    inset: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: all 0.25s ease;
}
.sitemonitor-slider-sm::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all 0.25s ease;
}
.sitemonitor-toggle-sm input:checked + .sitemonitor-slider-sm {
    background: var(--accent-green);
    border-color: var(--accent-green);
}
.sitemonitor-toggle-sm input:checked + .sitemonitor-slider-sm::before {
    transform: translateX(20px);
    background: white;
}

/* Log de sites */
.sitemonitor-log-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    transition: background 0.15s;
}
.sitemonitor-log-row:hover { background: var(--bg-card-hover); }
.sitemonitor-log-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.sitemonitor-log-info { flex: 1; min-width: 0; }
.sitemonitor-log-site { font-weight: 600; color: var(--accent-blue); word-break: break-all; }
.sitemonitor-log-meta { color: var(--text-muted); margin-top: 2px; }
.sitemonitor-log-time { font-family: var(--font-mono); color: var(--text-muted); font-size: 11px; flex-shrink: 0; }

/* ============================
   HVNC PAGE UPDATES
   ============================ */
.hvnc-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 15px;
}

.hvnc-section h3 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hvnc-browser-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.btn-browser {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 8px 5px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.btn-browser:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-browser.danger:hover {
    background: var(--accent-red-dim);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.hvnc-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.hvnc-controls {
    margin-top: 10px;
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 1100px) {
    .control-layout { grid-template-columns: 1fr; }
    .hvnc-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .clients-grid { grid-template-columns: 1fr; }
}