/* ── Reset & Tokens ──────────────────────────────────────── */
:root {
    --bg: #030307;
    --surface: rgba(13, 13, 23, 0.45);
    --surface-raised: rgba(22, 22, 38, 0.7);
    --surface-hover: rgba(28, 28, 48, 0.8);
    --border: rgba(255, 255, 255, 0.05);
    --border-light: rgba(255, 255, 255, 0.1);
    --accent: #a855f7;
    --blue: #3b82f6;
    --blue-glow: rgba(59, 130, 246, 0.35);
    --blue-dim: rgba(59, 130, 246, 0.12);
    --purple: #8b5cf6;
    --purple-glow: rgba(139, 92, 246, 0.35);
    --purple-dim: rgba(139, 92, 246, 0.12);
    --green: #10b981;
    --green-glow: rgba(16, 185, 129, 0.35);
    --green-dim: rgba(16, 185, 129, 0.12);
    --amber: #f59e0b;
    --amber-glow: rgba(245, 158, 11, 0.35);
    --amber-dim: rgba(245, 158, 11, 0.12);
    --red: #ef4444;
    --red-glow: rgba(239, 68, 68, 0.35);
    --red-dim: rgba(239, 68, 68, 0.12);
    --text: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --sans: 'Plus Jakarta Sans', -apple-system, system-ui, sans-serif;
    --radius: 10px;
    --radius-lg: 14px;
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
    font-family: var(--sans);
    background: var(--bg);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.05) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(59, 130, 246, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: 56px;
    display: grid; grid-template-columns: 220px 1fr auto;
    align-items: center;
    background: rgba(3, 3, 7, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.topbar-left {
    display: flex; align-items: center; justify-content: center;
    height: 100%; padding: 0 8px;
    border-right: 1px solid var(--border);
}
.topbar-center { display: flex; align-items: center; justify-content: center; padding: 0 24px; position: relative; }
.topbar-right { display: flex; align-items: center; padding: 0 16px; }
.topbar-section { font-size: 13px; color: var(--text-secondary); }
.topbar-client-selector {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px; border-radius: 8px;
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid var(--border);
    cursor: pointer; transition: all var(--transition);
    user-select: none; width: 100%;
}
.topbar-client-selector:hover { 
    background: rgba(255, 255, 255, 0.08); 
    border-color: var(--border-light);
}
.client-selector-avatar {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--surface-raised); display: flex; align-items: center; justify-content: center;
    color: var(--text-tertiary); overflow: hidden;
}
.client-selector-avatar img { width: 100%; height: 100%; object-fit: cover; }
.client-selector-name { font-size: 13px; color: var(--text-secondary); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-selector-chevron { color: var(--text-tertiary); margin-left: auto; }
.topbar-back {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px;
    background: none; border: none; color: var(--text-tertiary);
    cursor: pointer; transition: all var(--transition); flex-shrink: 0;
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
}
.topbar-back:hover { background: var(--surface-hover); color: var(--text); }

/* ── Client dropdown ─────────────────────────────────────── */
.client-dropdown {
    position: fixed; top: 56px; left: 16px; z-index: 99;
    width: 300px; max-height: 320px;
    background: rgba(13, 13, 23, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    display: none;
}
.client-dropdown.open { display: block; animation: dropIn 0.15s ease-out; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.client-dropdown-search-wrap {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; border-bottom: 1px solid var(--border);
    color: var(--text-tertiary);
}
.client-dropdown-search {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text); font-family: var(--sans); font-size: 13px;
}
.client-dropdown-search::placeholder { color: var(--text-tertiary); }
.client-dropdown-list { overflow-y: auto; max-height: 260px; padding: 4px; }
.client-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 6px;
    cursor: pointer; transition: background var(--transition);
}
.client-dropdown-item:hover { background: var(--surface-hover); }
.client-dropdown-item.active { background: var(--surface-raised); }
.client-dropdown-item-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--surface-raised); display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; color: var(--text-secondary); overflow: hidden; flex-shrink: 0;
}
.client-dropdown-item-avatar img { width: 100%; height: 100%; object-fit: cover; }
.client-dropdown-item-info { flex: 1; min-width: 0; }
.client-dropdown-item-name { font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-dropdown-item-place { font-size: 11px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-dropdown-item-transport {
    font-family: var(--mono); font-size: 10px; font-weight: 600;
    text-transform: uppercase; padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.transport-ws { background: var(--green-dim); color: var(--green); }
.transport-http { background: var(--amber-dim); color: var(--amber); }
.client-dropdown-empty {
    padding: 24px; text-align: center; color: var(--text-tertiary); font-size: 13px;
}

/* ── Layout ──────────────────────────────────────────────── */
.layout {
    display: flex; min-height: 100vh; padding-top: 56px;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: 220px; flex-shrink: 0;
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 16px 12px;
    position: fixed; top: 56px; bottom: 0; left: 0;
    background: rgba(3, 3, 7, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 8px;
    background: none; border: none; color: var(--text-secondary);
    font-family: var(--sans); font-size: 13.5px; font-weight: 500;
    cursor: pointer; transition: all var(--transition); text-align: left; width: 100%;
}
.sidebar-item:hover { 
    background: rgba(255, 255, 255, 0.04); 
    color: var(--text);
    transform: translateX(2px);
}
.sidebar-item--active { 
    background: rgba(139, 92, 246, 0.15); 
    color: var(--text); 
    border-left: 2px solid var(--accent);
    padding-left: 12px;
}
.sidebar-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 10px 0 10px; border-top: 1px solid var(--border); margin-top: 8px;
}
.sidebar-uptime {
    display: flex; align-items: center; gap: 6px;
    font-family: var(--mono); font-size: 11px; color: var(--text-tertiary);
}
.sidebar-link { color: var(--text-tertiary); transition: color var(--transition); display: flex; }
.sidebar-link:hover { color: var(--text); }

/* ── Main content ────────────────────────────────────────── */
.main-content {
    flex: 0 0 calc(100% - 220px); width: calc(100% - 220px);
    margin-left: 220px; min-height: calc(100vh - 56px);
    overflow: hidden; min-width: 0;
}
.view { padding: 32px 40px; }

/* ── No-client view ──────────────────────────────────────── */
.view--no-client {
    display: flex; align-items: center; justify-content: center;
    min-height: calc(100vh - 56px);
}
.no-client-wrapper {
    display: flex; flex-direction: column; align-items: center;
    width: 100%; max-width: 460px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.no-client-icon { color: var(--text-tertiary); margin-bottom: 20px; opacity: 0.8; }
.no-client-icon svg {
    filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.4));
    color: var(--accent);
}
.no-client-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.02em; }
.no-client-sub { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }
.no-client-search-wrap {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 12px 16px; border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border);
    color: var(--text-tertiary); margin-bottom: 16px;
    transition: all var(--transition);
}
.no-client-search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 15px rgba(139, 92, 246, 0.15); }
.no-client-search {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text); font-family: var(--sans); font-size: 14px;
}
.no-client-search::placeholder { color: var(--text-tertiary); }
.no-client-list { width: 100%; }
.no-client-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: var(--radius);
    cursor: pointer; transition: all var(--transition);
}
.no-client-item:hover { background: var(--surface-hover); }
.no-client-item-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--surface-raised); display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; color: var(--text-secondary); overflow: hidden; flex-shrink: 0;
}
.no-client-item-avatar img { width: 100%; height: 100%; object-fit: cover; }
.no-client-item-name { font-size: 14px; color: var(--text); }
.no-client-item-transport {
    margin-left: auto; font-family: var(--mono); font-size: 10px; font-weight: 600;
    text-transform: uppercase; padding: 2px 6px; border-radius: 4px;
}
.no-client-empty {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 32px; color: var(--text-tertiary); font-size: 13px;
}
.no-client-empty-icon { opacity: 0.3; }

/* ── Overview view ───────────────────────────────────────── */
.overview-hero {
    display: flex; align-items: center; justify-content: space-between;
    padding: 28px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); margin-bottom: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.overview-hero:hover {
    transform: translateY(-2px);
    border-color: var(--border-light);
    box-shadow: 0 12px 40px 0 rgba(139, 92, 246, 0.12);
}
.overview-hero-left { display: flex; align-items: center; gap: 20px; }
.overview-avatar {
    width: 64px; height: 64px; border-radius: 16px;
    background: var(--surface-raised); display: flex; align-items: center; justify-content: center;
    color: var(--text-tertiary); overflow: hidden; border: 1px solid var(--border);
    transition: transform var(--transition);
}
.overview-avatar img { width: 100%; height: 100%; object-fit: cover; }
.overview-hero:hover .overview-avatar {
    transform: scale(1.05);
}
.overview-username { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.overview-place { font-size: 13.5px; color: var(--text-secondary); margin-top: 4px; }
.overview-transport {
    font-family: var(--mono); font-size: 11px; font-weight: 600;
    text-transform: uppercase; padding: 4px 10px; border-radius: 6px;
}

/* ── Info cards ───────────────────────────────────────────── */
.overview-cards {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 16px; margin-bottom: 24px;
}
.info-card {
    padding: 20px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); 
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.15);
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.info-card:hover { 
    transform: translateY(-2px);
    border-color: var(--border-light);
    box-shadow: 0 12px 30px 0 rgba(59, 130, 246, 0.1);
}
.info-card-label { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; font-weight: 600; }
.info-card-value { font-size: 15px; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-card-value--mono { font-family: var(--mono); font-size: 13px; color: var(--blue); }

/* ── Status tiles ────────────────────────────────────────── */
.overview-tiles {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 16px; margin-bottom: 32px;
}
.status-tile--wide { grid-column: 1 / -1; }
.status-tile {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.15);
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.status-tile:hover { 
    transform: translateY(-2px);
    border-color: var(--border-light);
    box-shadow: 0 12px 30px 0 rgba(16, 185, 129, 0.1);
}
.status-tile-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.01);
}
.status-tile-title { font-size: 14px; font-weight: 600; }
.status-tile-badge {
    font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px;
    background: var(--blue-dim); color: var(--blue);
    border: 1px solid rgba(59, 130, 246, 0.2);
}
.status-tile-badge--green { 
    background: var(--green-dim); 
    color: var(--green); 
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.status-tile-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.status-tile-stat { display: flex; align-items: center; justify-content: space-between; }
.status-tile-stat-label { font-size: 13px; color: var(--text-secondary); }
.status-tile-stat-value { font-size: 13px; font-family: var(--mono); color: var(--text); }
.overview-index-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.overview-index-status {
    font-family: var(--mono); font-size: 12px; color: var(--text-tertiary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.logs-table-wrap {
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden; background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}
.logs-table-header {
    display: grid; grid-template-columns: 160px 80px 200px 1fr;
    padding: 12px 16px; background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
    font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.logs-table-body { max-height: calc(100vh - 220px); overflow-y: auto; }
.logs-table-body::-webkit-scrollbar { width: 6px; }
.logs-table-body::-webkit-scrollbar-track { background: transparent; }
.logs-table-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 99px; }
.logs-table-body::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }
.logs-row {
    display: grid; grid-template-columns: 160px 80px 200px 1fr;
    padding: 10px 16px; border-bottom: 1px solid var(--border);
    font-size: 13px; transition: all var(--transition); cursor: default;
    align-items: center;
}
.logs-row:last-child { border-bottom: none; }
.logs-row:hover { background: var(--surface-hover); }
.logs-row--error { background: rgba(239, 68, 68, 0.06); }
.logs-row--error:hover { background: rgba(239, 68, 68, 0.1); }
.logs-col--time { font-family: var(--mono); font-size: 12px; color: var(--text-tertiary); }
.logs-col--type { font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.logs-type-tool { color: var(--blue); }
.logs-type-event { color: var(--green); }
.logs-type-error { color: var(--red); }
.logs-type-info { color: var(--text-tertiary); }
.logs-col--tool { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logs-col--message { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logs-empty { padding: 64px; text-align: center; color: var(--text-tertiary); font-size: 13.5px; }
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.section-title { font-size: 15px; font-weight: 600; }
.section-count {
    font-family: var(--mono); font-size: 12px; color: var(--text-tertiary);
    padding: 2px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border);
}
.section-body { display: flex; flex-direction: column; gap: 4px; }
.section-client {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: var(--radius);
    transition: all var(--transition); cursor: pointer;
    border: 1px solid transparent;
}
.section-client:hover { 
    background: var(--surface-hover); 
    border-color: var(--border);
    transform: translateX(4px);
}
.section-client-avatar {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--surface-raised); display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600; color: var(--text-secondary); overflow: hidden; flex-shrink: 0;
    border: 1px solid var(--border);
}
.section-client-avatar img { width: 100%; height: 100%; object-fit: cover; }
.section-client-info { flex: 1; min-width: 0; }
.section-client-name { font-size: 13.5px; font-weight: 600; }
.section-client-meta { font-size: 11.5px; color: var(--text-tertiary); }
.section-client-transport {
    font-family: var(--mono); font-size: 10px; font-weight: 600;
    text-transform: uppercase; padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}

/* ── Logs view ───────────────────────────────────────────── */
.logs-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.logs-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.logs-controls { display: flex; gap: 8px; }
.logs-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text-secondary); font-family: var(--sans); font-size: 13px;
    cursor: pointer; transition: all var(--transition);
}
.logs-btn:hover { border-color: var(--border-light); color: var(--text); }
.logs-btn--live { border-color: var(--green); color: var(--green); }
.logs-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: livePulse 2s infinite; }
@keyframes livePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.logs-table-wrap {
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden; background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}
.logs-table-header {
    display: grid; grid-template-columns: 160px 80px 200px 1fr;
    padding: 12px 16px; background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
    font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.logs-table-body { max-height: calc(100vh - 220px); overflow-y: auto; }
.logs-table-body::-webkit-scrollbar { width: 6px; }
.logs-table-body::-webkit-scrollbar-track { background: transparent; }
.logs-table-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 99px; }
.logs-table-body::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }
.logs-row {
    display: grid; grid-template-columns: 160px 80px 200px 1fr;
    padding: 10px 16px; border-bottom: 1px solid var(--border);
    font-size: 13px; transition: all var(--transition); cursor: default;
    align-items: center;
}
.logs-row:last-child { border-bottom: none; }
.logs-row:hover { background: var(--surface-hover); }
.logs-row--error { background: rgba(239, 68, 68, 0.06); }
.logs-row--error:hover { background: rgba(239, 68, 68, 0.1); }
.logs-col--time { font-family: var(--mono); font-size: 12px; color: var(--text-tertiary); }
.logs-col--type { font-family: var(--mono); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.logs-type-tool { color: var(--blue); }
.logs-type-event { color: var(--green); }
.logs-type-error { color: var(--red); }
.logs-type-info { color: var(--text-tertiary); }
.logs-col--tool { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logs-col--message { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logs-empty { padding: 64px; text-align: center; color: var(--text-tertiary); font-size: 13.5px; }

/* ── Tools view (Flush Postman-style) ───────────────────── */
.view--tools {
    padding: 0 !important;
    margin-bottom: -24px !important;
    margin-right: -32px !important;
    overflow: hidden;
}

.tools-layout {
    display: flex;
    height: calc(100vh - 56px); /* Height from top padding to bottom edge */
    background: transparent;
    border-left: none;
}

.tools-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: transparent;
}

.tools-sidebar {
    width: 280px;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: rgba(3, 3, 7, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.tools-sidebar-header {
    padding: 16px 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.02);
}

.tools-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.tools-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
    margin-bottom: 2px;
}

.tools-list-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.tools-list-item.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--text);
    font-weight: 600;
}

.tools-list-item svg {
    opacity: 0.6;
    transition: all var(--transition);
}

.tools-list-item.active svg {
    opacity: 1;
    color: var(--accent);
}

.tool-exec-header {
    padding: 24px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.01);
}

.tool-exec-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.tool-exec-info h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.tool-exec-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-exec-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tool-params-panel {
    flex: 1;
    overflow-y: auto;
    background: transparent;
}

.tool-params-table {
    width: 100%;
    border-collapse: collapse;
}

.tool-params-table th {
    text-align: left;
    padding: 12px 32px;
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.tool-params-table td {
    padding: 0;
    border-bottom: 1px solid var(--border);
}

.tool-params-table input, .tool-params-table select, .tool-params-table textarea {
    width: 100%;
    padding: 14px 32px;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    outline: none;
    transition: all var(--transition);
}

.tool-params-table input:focus, .tool-params-table select:focus, .tool-params-table textarea:focus {
    background: rgba(255, 255, 255, 0.02);
}

.tool-params-table td:first-child {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--text-secondary);
    padding: 14px 32px;
    border-right: 1px solid var(--border);
}

.tool-params-table tr:hover {
    background: var(--surface-hover);
}

.tool-run-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    border-radius: 6px;
    background: var(--blue);
    color: #fff;
    border: none;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-run-btn:hover {
    background: #47a1ff;
    transform: translateY(-1px);
}

.tool-run-btn:active {
    transform: translateY(0);
}

.tool-run-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.tool-response-panel {
    border-top: 1px solid var(--border);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
    background: var(--surface);
}

.tool-response-header {
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    height: 40px;
}

.tool-response-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.tool-response-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.tool-res-badge:empty, .tool-res-badge:empty + .tool-res-dot {
    display: none;
}

.tool-res-dot {
    opacity: 0.5;
}

.tool-res-time {
    font-family: var(--mono);
    min-width: 40px;
    text-align: right;
}

.tool-res-badge {
    color: var(--green);
    font-weight: 600;
}

.tool-res-time {
    color: var(--text-tertiary);
}

.tool-response-body-wrap {
    flex: 1;
    overflow: auto;
    background: #0a0a0a;
}

.tool-response-body {
    padding: 20px;
    margin: 0;
    font-family: var(--mono);
    font-size: 13px;
    color: #e0e0e0;
    white-space: pre-wrap;
    line-height: 1.6;
}

.tool-res-badge--success { color: var(--green); }
.tool-res-badge--error { color: var(--red); }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; }

/* ── Server view ─────────────────────────────────────────── */
.server-header { margin-bottom: 20px; }
.server-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.server-sub { font-size: 13px; color: var(--text-secondary); }
.server-graph-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: clamp(18px, 2vw, 32px); margin-bottom: 20px;
    overflow: hidden; min-height: 320px;
    display: flex; align-items: center; justify-content: center;
}
.server-graph { width: 100%; height: clamp(280px, 34vh, 360px); position: relative; }
.server-graph svg { display: block; width: 100%; height: 100%; }
.server-stats {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
    margin-bottom: 24px;
}
.server-stat-card {
    padding: 20px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); transition: border-color var(--transition);
    min-width: 0;
}
.server-stat-card:hover { border-color: var(--border-light); }
.server-stat-label { font-size: 12px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.server-stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.server-stat-value--green { color: var(--green); }
.server-stat-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* ── Scripts view ──────────────────────────────────────── */
.scripts-header { margin-bottom: 24px; }
.scripts-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.scripts-sub { font-size: 13px; color: var(--text-secondary); }
.scripts-index-status::before {
    content: '•'; margin-right: 4px; display: inline;
}

/* GitHub-style Layout */
.scripts-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 32px;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.scripts-main {
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.scripts-sidebar {
    width: 280px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-section {
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.sidebar-section:first-child {
    border-top: none;
    padding-top: 0;
}
.sidebar-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

/* GitHub-style Progress Bar */
.github-progress {
    display: flex;
    height: 8px;
    background: var(--surface-raised);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 12px;
}
.github-progress-segment {
    height: 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.github-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.github-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}
.github-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.github-legend-label {
    color: var(--text);
    font-weight: 500;
}
.github-legend-value {
    color: var(--text-tertiary);
    font-family: var(--mono);
    margin-left: 4px;
}
.github-legend-perc {
    color: var(--text-tertiary);
    margin-left: auto;
}

.sidebar-section-footer {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-section-footer .scripts-sync-badge {
    align-self: flex-start;
}

.sidebar-section-footer .tool-run-btn {
    width: 100%;
    justify-content: center;
    font-size: 12px;
    padding: 6px 12px;
}

.sidebar-section-footer .scripts-index-status {
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.4;
}

/* File browser */
.scripts-browser {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    min-width: 0;
    max-width: 100%;
}
.scripts-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.scripts-search-wrap {
    display: flex; align-items: center; gap: 8px;
    color: var(--text-tertiary); flex: 1; max-width: 400px;
}
.scripts-search {
    flex: 1; background: none; border: none; color: var(--text);
    font-family: var(--sans); font-size: 13px; outline: none;
}
.scripts-search::placeholder { color: var(--text-tertiary); }
.scripts-count { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }

/* Breadcrumb */
.scripts-breadcrumb {
    display: flex; align-items: center; gap: 2px;
    padding: 8px 16px; border-bottom: 1px solid var(--border);
    font-size: 13px; flex-wrap: wrap;
}
.scripts-bc-seg {
    color: var(--blue); cursor: pointer; padding: 2px 4px; border-radius: 4px;
    transition: background var(--transition);
    background: none; border: none; font-family: var(--sans); font-size: 13px;
}
.scripts-bc-seg:hover { background: var(--blue-dim); }
.scripts-bc-seg--current { color: var(--text); cursor: default; font-weight: 600; }
.scripts-bc-seg--current:hover { background: none; }
.scripts-bc-sep { color: var(--text-tertiary); font-size: 12px; user-select: none; }

/* File list header */
.scripts-file-header {
    display: grid; grid-template-columns: 1fr 70px 80px 36px;
    padding: 6px 16px; background: var(--surface-raised);
    border-bottom: 1px solid var(--border);
}
.scripts-fh-name {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-tertiary);
}
.scripts-fh-meta {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-tertiary); text-align: right;
}

/* File list rows */
.scripts-file-list { max-height: calc(100vh - 350px); overflow-y: auto; }
.scripts-frow {
    display: grid; grid-template-columns: 1fr 70px 80px 36px;
    padding: 8px 16px; border-bottom: 1px solid var(--border);
    align-items: center; cursor: pointer;
    transition: background var(--transition);
    min-height: 44px;
}
.scripts-frow:hover { background: var(--surface-hover); }
.scripts-frow:last-child { border-bottom: none; }
.scripts-fname {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; min-width: 0;
}
.scripts-ficon { 
    flex-shrink: 0; 
    color: var(--text-tertiary); 
    width: 18px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}
.scripts-ficon--folder { color: var(--blue); }
.scripts-fname-text {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--text);
}
.scripts-frow--folder .scripts-fname-text { color: var(--blue); }
.scripts-fname-count {
    font-size: 11px; color: var(--text-tertiary); flex-shrink: 0;
}
.scripts-fmeta {
    font-size: 12px; color: var(--text-secondary); text-align: right;
    font-family: var(--mono);
}
/* Go-up row */
.scripts-frow--up { opacity: 0.7; }
.scripts-frow--up:hover { opacity: 1; }

/* File row actions & three-dot menu */
.scripts-factions {
    display: flex; align-items: center; justify-content: center;
}
.scripts-menu-btn {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 6px;
    background: none; border: none; color: var(--text-tertiary);
    cursor: pointer; transition: all var(--transition); flex-shrink: 0;
}
.scripts-menu-btn:hover { background: var(--surface-hover); color: var(--text); }
.scripts-menu-dropdown {
    position: absolute; top: 100%; right: 0; z-index: 50;
    min-width: 160px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    box-shadow: 0 12px 32px rgba(0,0,0,0.4);
    display: none; margin-top: 4px;
}
.scripts-menu-dropdown.open { display: block; animation: dropIn 0.12s ease-out; }
.scripts-menu-item {
    display: block; width: 100%; padding: 8px 14px;
    background: none; border: none; color: var(--text-secondary);
    font-family: var(--sans); font-size: 13px; text-align: left;
    cursor: pointer; transition: background var(--transition);
}
.scripts-menu-item:hover { background: var(--surface-hover); color: var(--text); }
.scripts-menu-item + .scripts-menu-item { border-top: 1px solid var(--border); }

.scripts-file-menu {
    position: fixed; 
}
.scripts-fh-actions { text-align: center; }

/* Code viewer bar updates */
.scripts-code-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; border-bottom: 1px solid var(--border);
    background: var(--surface-raised); height: 40px;
    min-width: 0;
}
.scripts-code-tabs {
    display: flex; align-items: center; gap: 0;
    flex-shrink: 0;
}
.scripts-code-tab {
    padding: 8px 14px; border: none; background: none;
    color: var(--text-tertiary); font-family: var(--sans); font-size: 13px;
    font-weight: 500; cursor: pointer; transition: all var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.scripts-code-tab:hover { color: var(--text); }
.scripts-code-tab--active {
    color: var(--text); font-weight: 600;
    border-bottom-color: var(--blue);
}
.scripts-code-bar-right {
    display: flex; align-items: center; gap: 8px; position: relative;
    min-width: 0;
}
.scripts-code-save-btn {
    padding: 4px 12px; border-radius: 5px;
    background: var(--text); color: var(--bg); border: none;
    font-family: var(--sans); font-size: 12px; font-weight: 600;
    cursor: pointer; transition: opacity var(--transition);
}
.scripts-code-save-btn:hover { opacity: 0.85; }
.scripts-code-info {
    font-size: 12px; color: var(--text-tertiary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.scripts-code-wrap {
    max-height: calc(100vh - 320px); 
    overflow: auto;
    position: relative; 
    border-radius: 0 0 8px 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: var(--surface);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.scripts-code-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.scripts-code-wrap::-webkit-scrollbar-track { background: transparent; }
.scripts-code-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.scripts-code-wrap::-webkit-scrollbar-corner { background: transparent; }

/* Right-edge fade hint when code overflows horizontally */
.scripts-code-wrap::after {
    content: '';
    position: sticky;
    right: 0; top: 0;
    width: 24px; height: 100%;
    display: block;
    pointer-events: none;
    background: linear-gradient(to left, var(--surface) 0%, transparent 100%);
    float: right;
    margin-top: -100%;
    opacity: 0;
    transition: opacity 0.2s;
}
.scripts-code-wrap.has-overflow-x::after { opacity: 1; }
.scripts-code-inner {
    display: flex;
    align-items: stretch;
    min-height: 100%;
    min-width: 100%;
}
.scripts-code-gutter {
    flex-shrink: 0; padding: 16px 0; min-width: 48px;
    text-align: right; user-select: none; color: var(--text-tertiary);
    font-family: var(--mono); font-size: 13px; line-height: 20px;
    white-space: pre; border-right: 1px solid var(--border);
    position: sticky; left: 0; z-index: 1;
    background: var(--surface);
}
.scripts-code-gutter span {
    display: block; padding: 0 12px; cursor: pointer;
}
.scripts-code-gutter span:hover { color: var(--text); }
.scripts-code-pre {
    flex: 1; margin: 0; padding: 16px;
    font-size: 13px; line-height: 20px; tab-size: 4;
    background: transparent !important;
    white-space: pre;
    overflow: visible;
    min-width: 0;
}
.scripts-code-pre code {
    font-family: var(--mono) !important;
    background: transparent !important;
    padding: 0 !important;
    overflow: visible;
    display: inline-block;
    min-width: 100%;
    font-variant-ligatures: none;
}
.scripts-code-pre code[contenteditable="true"] {
    outline: none; cursor: text;
}
.scripts-code-pre code.scripts-edit-active {
    caret-color: var(--blue);
}
.scripts-code-pre code.hljs { background: transparent !important; }

/* ── Settings view ──────────────────────────────────────── */
.settings-header { margin-bottom: 24px; }
.settings-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.settings-sub { font-size: 13px; color: var(--text-secondary); }
.settings-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden;
}
.settings-card-body { padding: 24px; }
.settings-card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.settings-card-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5; }
.settings-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px; background: var(--surface-raised); border-top: 1px solid var(--border);
}
.settings-card-footer-hint { font-size: 12px; color: var(--text-tertiary); }
.settings-field { margin-bottom: 14px; }
.settings-field:last-child { margin-bottom: 0; }
.settings-field label {
    display: block; font-size: 12px; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 6px;
}
.settings-field input, .settings-field select {
    width: 100%; max-width: 400px; padding: 8px 12px; border-radius: 6px;
    background: var(--bg); border: 1px solid var(--border);
    color: var(--text); font-family: var(--mono); font-size: 13px;
    outline: none; transition: border-color var(--transition);
}
.settings-field input:focus, .settings-field select:focus { border-color: var(--border-light); }
/* Toggle switch (Vercel style) */
.settings-toggle-row {
    display: flex; align-items: center; gap: 14px;
    color: var(--text-secondary); font-size: 13px; cursor: pointer;
}
.toggle-switch { position: relative; display: inline-flex; flex-shrink: 0; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
    width: 44px; height: 24px; border-radius: 12px;
    background: var(--border); display: flex; align-items: center;
    padding: 2px; transition: background 200ms ease;
}
.toggle-thumb {
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--text-tertiary); transition: all 200ms ease;
    transform: translateX(0);
}
.toggle-switch input:checked + .toggle-track {
    background: var(--blue);
}
.toggle-switch input:checked + .toggle-track .toggle-thumb {
    background: #fff; transform: translateX(20px);
}
.settings-provider-toggle {
    display: inline-flex; border-radius: 6px; overflow: hidden;
    border: 1px solid var(--border); background: var(--bg);
}
.settings-provider-btn {
    padding: 6px 16px; border: none; background: none;
    color: var(--text-secondary); font-family: var(--sans); font-size: 13px;
    cursor: pointer; transition: all var(--transition);
}
.settings-provider-btn--active { background: var(--text); color: var(--bg); font-weight: 600; }
.settings-card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.settings-delete-btn {
    padding: 6px 16px;
    border-radius: 6px;
    background: transparent;
    color: var(--red);
    border: 1px solid var(--red-muted);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.settings-delete-btn:hover {
    background: var(--red);
    color: white;
    border-color: var(--red);
}

.settings-save-btn {
    padding: 6px 16px;
    border-radius: 6px;
    background: var(--text);
    color: var(--bg);
    border: none;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition);
}

.settings-save-btn:hover { opacity: 0.85; }
.settings-save-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.settings-test-btn {
    padding: 6px 16px; border-radius: 6px;
    background: none; color: var(--text-secondary); border: 1px solid var(--border);
    font-family: var(--sans); font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all var(--transition);
}
.settings-test-btn:hover { border-color: var(--border-light); color: var(--text); }
.settings-test-result {
    margin-top: 12px; padding: 10px 14px; border-radius: 6px;
    font-size: 13px; font-family: var(--mono);
}
.settings-test-result--ok { background: var(--green-dim); color: var(--green); }
.settings-test-result--err { background: var(--red-dim); color: var(--red); }

/* ── Toast notifications ────────────────────────────────── */
.toast-container {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column-reverse; gap: 8px;
    pointer-events: none;
}
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: 8px; min-width: 280px; max-width: 400px;
    background: var(--surface-raised); border: 1px solid var(--border);
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    font-size: 13px; color: var(--text);
    animation: toastIn 300ms cubic-bezier(0.16,1,0.3,1) forwards;
}
.toast--removing { animation: toastOut 200ms ease forwards; }
.toast-icon { flex-shrink: 0; width: 18px; height: 18px; }
.toast-icon--success { color: var(--green); }
.toast-icon--error { color: var(--red); }
.toast-icon--info { color: var(--blue); }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close {
    flex-shrink: 0; background: none; border: none; color: var(--text-tertiary);
    cursor: pointer; padding: 2px; transition: color var(--transition);
}
.toast-close:hover { color: var(--text); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(8px) scale(0.96); }
}

/* ── View animations ────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.view--entering {
    animation: fadeInUp 300ms cubic-bezier(0.16,1,0.3,1) forwards;
}
.settings-card, .server-stat-card, .server-graph-card, .status-tile,
.overview-clients-section, .tool-card {
    animation: fadeInUp 350ms cubic-bezier(0.16,1,0.3,1) both;
}
.settings-card:nth-child(1) { animation-delay: 0ms; }
.settings-card:nth-child(2) { animation-delay: 50ms; }
.settings-card:nth-child(3) { animation-delay: 100ms; }
.settings-card:nth-child(4) { animation-delay: 150ms; }
.settings-card:nth-child(5) { animation-delay: 200ms; }
.server-stat-card:nth-child(1) { animation-delay: 50ms; }
.server-stat-card:nth-child(2) { animation-delay: 100ms; }
.server-stat-card:nth-child(3) { animation-delay: 150ms; }
.sidebar-item {
    animation: fadeIn 200ms ease both;
}
.sidebar-item:nth-child(1) { animation-delay: 0ms; }
.sidebar-item:nth-child(2) { animation-delay: 40ms; }
.sidebar-item:nth-child(3) { animation-delay: 80ms; }
.sidebar-item:nth-child(4) { animation-delay: 120ms; }
.sidebar-item:nth-child(5) { animation-delay: 160ms; }
.logs-row--entering {
    animation: fadeIn 150ms ease both;
}
.no-client-card {
    transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.no-client-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* ── Scrollbars ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .overview-cards { grid-template-columns: repeat(2, 1fr); }
    .overview-tiles { grid-template-columns: 1fr; }
    .tools-grid { grid-template-columns: 1fr; }
    .scripts-layout { grid-template-columns: minmax(0, 1fr); }
    .scripts-sidebar { width: 100%; }
    .server-stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
@media (max-width: 680px) {
    .sidebar { display: none; }
    .main-content { flex-basis: 100%; width: 100%; margin-left: 0; }
    .view { padding: 20px 16px; }
    .overview-cards { grid-template-columns: 1fr; }
    .server-graph-card { padding: 16px; min-height: 292px; }
    .server-graph { height: 260px; }
}

/* ── Modal / Dialog (Shadcn style) ───────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: fadeIn 0.15s ease-out;
}

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

.modal-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    animation: scaleIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    margin-bottom: 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.modal-desc {
    font-size: 14px;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
}

.modal-btn--cancel {
    background: var(--surface-raised);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.modal-btn--cancel:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.modal-btn--primary {
    background: var(--text);
    color: var(--bg);
}

.modal-btn--primary:hover {
    opacity: 0.9;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ── Executor View Styling ───────────────────────────────── */
.executor-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    height: calc(100vh - 180px);
}

.executor-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.executor-editor-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(8, 8, 16, 0.68);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.executor-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.025);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.executor-editor-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.executor-editor-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.executor-lsp-pill {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 99px;
    background: var(--purple-dim);
    border: 1px solid rgba(139, 92, 246, 0.24);
    color: #c4b5fd;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.executor-lsp-pill[data-state="loading"] {
    color: var(--amber);
    background: var(--amber-dim);
    border-color: rgba(245, 158, 11, 0.24);
}

.executor-lsp-pill[data-state="fallback"] {
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-light);
}

#executorMonaco {
    display: none;
    flex: 1;
    min-height: 320px;
    background: #070711;
}

#executorMonaco.monaco-ready {
    display: block;
}

#executorTextarea,
.executor-fallback-textarea {
    flex: 1;
    background: transparent;
    border: none;
    resize: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    padding: 16px;
    outline: none;
    line-height: 1.5;
    tab-size: 4;
}

.executor-fallback-textarea--hidden {
    display: none;
}

.executor-editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.025);
    border-top: 1px solid var(--border);
}

.executor-editor-footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex-wrap: wrap;
}

.executor-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.executor-checkbox-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--blue);
}

#executorStatusHint {
    font-size: 12px;
    color: var(--text-tertiary);
    transition: color 0.2s ease;
}

.executor-file-name {
    width: 160px;
    height: 30px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    font-family: var(--mono);
    font-size: 12px;
    outline: none;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.executor-file-name::placeholder {
    color: var(--text-tertiary);
}

.executor-file-name:focus {
    border-color: rgba(168, 85, 247, 0.55);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.12);
}

.executor-output-card {
    height: 180px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.executor-output-header {
    padding: 8px 16px;
    background: var(--surface-raised);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

#executorOutput {
    flex: 1;
    margin: 0;
    padding: 12px 16px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-secondary);
    overflow-y: auto;
    white-space: pre-wrap;
    background: #09090d;
}

.executor-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.executor-sidebar-header {
    padding: 12px 16px;
    background: var(--surface-raised);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

#localScriptsList {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.local-script-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
}

.local-script-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.local-script-item.active {
    background: var(--surface-hover);
    color: var(--text);
    border-left-color: var(--blue);
}

.local-script-name {
    font-family: var(--mono);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.local-script-run-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--blue);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.local-script-item:hover .local-script-run-btn {
    opacity: 1;
}

.local-script-run-btn:hover {
    background: rgba(59, 130, 246, 0.15);
}

/* ── Client Logs Colors ───────────────────────────────────── */
.logs-table-body log[level="Warning"],
.logs-table-body log[level="Warning"] * {
    color: #f59e0b !important;
}

.logs-table-body log[level="Error"],
.logs-table-body log[level="Error"] * {
    color: #ef4444 !important;
}

.logs-table-body log[level="MessageOutput"],
.logs-table-body log[level="MessageOutput"] * {
    color: #3b82f6 !important;
}

.logs-table-body log[level="info"],
.logs-table-body log[level="info"] * {
    color: #10b981 !important;
}
