:root {
    --bg-0: #080808;
    --bg-1: #111111;
    --bg-2: #1a1a1a;
    --bg-3: #222222;
    --border: #2a2a2a;
    --border-light: #383838;
    --text-0: #f0f0f0;
    --text-1: #cccccc;
    --text-2: #999999;
    --text-3: #666666;
    --accent: #e8e8e8;
    --accent-hover: #ffffff;
    --accent-soft: rgba(232, 232, 232, 0.12);
    --accent-glow: rgba(232, 232, 232, 0.35);
    --success: #999999;
    --success-soft: rgba(153, 153, 153, 0.18);
    --warn: #c8c8c8;
    --warn-soft: rgba(200, 200, 200, 0.18);
    --danger: #e8e8e8;
    --danger-soft: rgba(232, 232, 232, 0.16);
    --mono: 'Consolas', 'SF Mono', 'Cascadia Code', 'Menlo', monospace;
    --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --transition: 160ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

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

/* No scrollbars */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: var(--sans);
    font-size: 14px;
    color: var(--text-0);
    background: #080808;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.028) 1px, transparent 0);
    background-size: 32px 32px;
    pointer-events: none;
    z-index: 0;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    transition: all var(--transition);
}

input, select, textarea {
    font-family: inherit;
    font-size: 14px;
    color: var(--text-0);
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    outline: none;
    transition: all var(--transition);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="file"] {
    padding: 7px 10px;
    font-size: 12.5px;
}
input[type="file"]::file-selector-button {
    background: var(--bg-3);
    color: var(--text-0);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    margin-right: 10px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}
input[type="file"]::file-selector-button:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

code {
    font-family: var(--mono);
    background: var(--bg-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-1);
}

.hidden { display: none !important; }
.sep { color: var(--text-3); margin: 0 6px; }

.view {
    display: none;
    position: relative;
    z-index: 1;
    min-height: 100vh;
}
.view.active { display: block; }

/* ============ LOGIN ============ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 20px var(--accent-glow));
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { filter: drop-shadow(0 0 16px var(--accent-glow)); }
    50% { filter: drop-shadow(0 0 28px var(--accent-glow)); }
}

.login-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--text-0) 0%, #aaaaaa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-2);
    font-size: 13px;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 18px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
}

.token-toggle {
    position: absolute;
    right: 8px;
    bottom: 7px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    border-radius: var(--radius-sm);
}
.token-toggle:hover { background: var(--bg-3); color: var(--text-0); }

.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(180deg, var(--accent-hover) 0%, var(--accent) 100%);
    color: #080808;
    box-shadow: 0 2px 0 rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.06), inset 0 1px 0 rgba(255,255,255,0.4);
    text-shadow: 0 1px 0 rgba(255,255,255,0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow), 0 2px 0 rgba(0,0,0,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
    background: var(--bg-3);
    color: var(--text-0);
    border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: #2a2a2a; border-color: var(--accent); }

.btn-danger {
    background: linear-gradient(180deg, #aaaaaa 0%, var(--danger) 100%);
    color: #080808;
    box-shadow: 0 2px 0 rgba(0,0,0,0.3);
    text-shadow: 0 1px 0 rgba(255,255,255,0.2);
}
.btn-danger:hover { filter: brightness(1.05); }

.btn-warn {
    background: linear-gradient(180deg, #9a9a9a 0%, #6a6a6a 100%);
    color: #080808;
    box-shadow: 0 2px 0 rgba(0,0,0,0.3);
    text-shadow: 0 1px 0 rgba(255,255,255,0.2);
    border: 1px solid rgba(0,0,0,0.25);
}
.btn-warn:hover { filter: brightness(1.1); }
.btn-warn:disabled { opacity: 0.6; cursor: not-allowed; filter: none; }

.sidebar-action.btn-warn {
    width: 100%;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.btn-ghost {
    background: transparent;
    color: var(--text-1);
    border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--bg-2); color: var(--text-0); border-color: var(--border); }

.btn-block { width: 100%; padding: 12px 16px; font-size: 14px; }
.btn-small { padding: 6px 10px; font-size: 12px; }

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--danger-soft);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    color: #e8e8e8;
    font-size: 13px;
}

.login-footer {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-3);
    font-size: 12px;
}
.login-footer p { line-height: 1.6; }

/* ============ LEFT SIDEBAR NAV ============ */
.sidebar-nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 50;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand-logo {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-text {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--text-0), #aaaaaa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-version {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 500;
    margin-top: 1px;
}

.brand-info { min-width: 0; }

.sidebar-collapse-btn {
    margin-left: auto;
    padding: 4px;
    border-radius: 6px;
    color: var(--text-3);
    transition: all 0.15s ease;
    flex-shrink: 0;
    opacity: 0;
}
.sidebar-collapse-btn svg {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-nav:hover .sidebar-collapse-btn { opacity: 1; }
.sidebar-collapse-btn:hover { background: var(--bg-3); color: var(--text-0); }

/* --- Collapsed sidebar --- */
.sidebar-nav.collapsed { width: 60px; }
.sidebar-nav.collapsed .brand-info,
.sidebar-nav.collapsed .sidebar-nav-label,
.sidebar-nav.collapsed .nav-btn span,
.sidebar-nav.collapsed .sidebar-nav-item span,
.sidebar-nav.collapsed .sidebar-stats-row,
.sidebar-nav.collapsed .sidebar-user-info,
.sidebar-nav.collapsed .sidebar-user-info-offline,
.sidebar-nav.collapsed .sidebar-agent-meta,
.sidebar-nav.collapsed .sidebar-agent-name,
.sidebar-nav.collapsed .mod-nav span {
    display: none !important;
}
.sidebar-nav.collapsed .sidebar-brand { padding: 14px; justify-content: center; }
.sidebar-nav.collapsed .sidebar-collapse-btn {
    position: absolute;
    top: 14px;
    right: 6px;
    opacity: 1;
}
.sidebar-nav.collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
}
.sidebar-nav.collapsed .brand-logo { width: 32px; height: 32px; }
.sidebar-nav.collapsed .sidebar-nav-group { padding: 8px 6px 2px; }
.sidebar-nav.collapsed .nav-btn { justify-content: center; padding: 10px; }
.sidebar-nav.collapsed .sidebar-nav-item { justify-content: center; padding: 10px; }
.sidebar-nav.collapsed .mod-nav { justify-content: center; padding: 10px; }
.sidebar-nav.collapsed .sidebar-footer { padding: 10px 6px; }
.sidebar-nav.collapsed .sidebar-agent-info { justify-content: center; padding: 10px; }
.sidebar-nav.collapsed .agent-status-dot { width: 8px; height: 8px; }

.dash-content {
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-nav.collapsed ~ .dash-content { margin-left: 60px; }
.sidebar-nav.collapsed ~ .dash-content .dash-header-centered {
    width: calc(100vw - 60px);
}

.sidebar-nav-group {
    padding: 8px 12px 2px;
}

.sidebar-nav-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 8px 6px;
}

.sidebar-nav .nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border-bottom: none;
    margin-bottom: 2px;
    white-space: nowrap;
    position: relative;
    transition: all 0.15s ease;
}

.sidebar-nav .nav-btn:hover {
    background: var(--bg-2);
    color: var(--text-0);
}

.sidebar-nav .nav-btn.active {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-bottom: none;
}
.sidebar-nav .nav-btn.active::before { display: none; }

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    width: 100%;
    text-align: left;
    margin-bottom: 2px;
    transition: all 0.15s ease;
}
.sidebar-nav-item:hover {
    background: var(--bg-2);
    color: var(--text-0);
}

.sidebar-nav-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.sidebar-back-btn {
    color: var(--text-3) !important;
    font-weight: 500 !important;
    font-size: 12px !important;
    border-radius: 0 !important;
    padding: 10px 16px !important;
    margin: 0 -12px;
    width: calc(100% + 24px) !important;
    border-bottom: 1px solid var(--border);
    gap: 6px !important;
}
.sidebar-back-btn svg { width: 14px; height: 14px; }
.sidebar-back-btn:hover { color: var(--text-0) !important; background: var(--bg-2) !important; }

.sidebar-agent-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.agent-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}
.agent-status-dot.online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}
.sidebar-agent-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.sidebar-agent-meta {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.mod-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    transition: all 0.12s ease;
}
.mod-nav:hover { background: var(--bg-2); color: var(--text-0); }
.mod-nav.active { background: rgba(34, 197, 94, 0.1); color: #22c55e; }

.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-stats-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 0 0;
}
.sidebar-stat-inline {
    font-size: 11px;
    color: var(--text-3);
}
.sidebar-stat-val {
    font-weight: 700;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
.sidebar-stat-sep {
    font-size: 11px;
    color: var(--text-3);
    opacity: 0.4;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 8px;
}
.sidebar-user-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-0);
    display: block;
    line-height: 1.2;
}
.sidebar-user-role {
    font-size: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.sidebar-user-info .status-chip {
    border: none;
    padding: 0;
    background: none;
}
.sidebar-user-info .status-dot {
    width: 10px;
    height: 10px;
}
.sidebar-user-info-offline {
    padding: 0 0 8px;
}
.sidebar-user-info-offline .status-chip {
    width: 100%;
    justify-content: center;
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 6px;
    color: var(--text-3);
    transition: all 0.15s ease;
}
.sidebar-logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* ============ STATUS CHIP ============ */
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-3);
}

.status-offline { background: var(--bg-2); color: var(--text-2); border: 1px solid var(--border); }
.status-offline .status-dot { background: var(--text-3); }

.status-connecting { background: rgba(234, 179, 8, 0.12); color: #eab308; border: 1px solid rgba(234, 179, 8, 0.3); }
.status-connecting .status-dot { background: #eab308; animation: pulse-dot 1s ease-in-out infinite; }

.status-online { background: rgba(34, 197, 94, 0.12); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.35); }
.status-online .status-dot { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.5); }

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

/* ============ DASH CONTENT ============ */
.dash-content {
    margin-left: 240px;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-sizing: border-box;
}

/* ============ MAIN CONTENT / PAGES ============ */
.main-content {
    padding: 28px 32px;
    min-width: 0;
}

.page-section { display: none; }
.page-section.active { display: block; animation: pageIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.dash-header-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 32px 0 28px;
    width: calc(100vw - 240px);
    margin-left: -32px;
    box-sizing: border-box;
}

.content-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

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

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    min-width: 280px;
    transition: all var(--transition);
}
.search-box-centered {
    min-width: 340px;
    border-radius: 10px;
}
.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-box svg { color: var(--text-2); flex-shrink: 0; }
.search-box input {
    background: transparent;
    border: none;
    padding: 9px 0;
    flex: 1;
    box-shadow: none !important;
}

/* ============ AGENTS GRID ============ */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.agent-card {
    background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.agent-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: #22c55e;
    opacity: 0.85;
}
.agent-card.agent-offline {
    background: linear-gradient(180deg, #141414 0%, #0d0d0d 100%);
    border-color: #242424;
    opacity: 0.85;
}
.agent-card.agent-offline::before {
    background: #666666;
    opacity: 0.55;
}
.agent-card.agent-offline:hover {
    border-color: #333333;
}
.agent-card.agent-offline .agent-avatar {
    background: linear-gradient(135deg, #2e2e2e, #1b1b1b);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    opacity: 0.9;
}
.agent-card.agent-offline .agent-name {
    color: var(--text-2);
}
.agent-card.agent-offline .agent-card-value {
    color: #888888;
}
.agent-card.agent-online .agent-ping.ping-online {
    color: #e8e8e8;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    margin-left: 6px;
    opacity: 0.95;
}
.agent-card.agent-offline .agent-ping.ping-offline {
    color: #888888;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-left: 6px;
}
.agent-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--accent-glow);
}

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

.agent-card-delete {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 0;
    opacity: 0.65;
    transition: background 120ms ease, color 120ms ease, opacity 120ms ease, border-color 120ms ease;
}
.agent-card-delete:hover {
    background: #2a2a2a;
    color: #f0f0f0;
    border-color: var(--danger);
    opacity: 1;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.03);
}
.agent-offline .agent-card-delete { color: #bbbbbb; }
.agent-offline .agent-card-delete:hover { border-color: #888888; }
.agent-card-delete:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}

.agent-avatar {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), #333333);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #080808;
    text-transform: uppercase;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.agent-name {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.2;
    margin-bottom: 2px;
    word-break: break-word;
}

.agent-user {
    font-size: 12px;
    color: var(--text-2);
}

.agent-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 12px;
    color: var(--text-1);
}
.agent-card-row + .agent-card-row { border-top: 1px solid var(--border); }

.agent-card-label { color: var(--text-2); }
.agent-card-value {
    font-family: var(--mono);
    font-size: 12px;
    max-width: 55%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    background: var(--bg-3);
    color: var(--text-1);
    border: 1px solid var(--border-light);
}
.badge-success { background: rgba(34, 197, 94, 0.15); color: #22c55e; border-color: rgba(34, 197, 94, 0.35); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(200, 200, 200, 0.35); }
.badge-danger { background: var(--danger-soft); color: #e8e8e8; border-color: rgba(232, 232, 232, 0.35); }

.empty-state {
    grid-column: 1 / -1;
    padding: 72px 20px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-1);
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.empty-state.small { padding: 40px 20px; border: none; background: transparent; min-height: unset; display: block; }
#bots-list .empty-state { padding: 40px 20px; min-height: 160px; }

.empty-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--bg-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
}
.empty-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 6px;
}
.empty-subtitle {
    font-size: 13px;
    color: var(--text-2);
}

/* ============ PANELS ============ */
.panel {
    background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.1);
    gap: 16px;
    flex-wrap: wrap;
}
.panel-header h3 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-header h4 { font-size: 13px; font-weight: 700; }
.panel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.hint-text {
    font-size: 11.5px;
    color: var(--text-2);
}
.panel-body {
    padding: 16px 18px;
    flex: 1;
    min-width: 0;
}

/* ============ BUILDER FORM ============ */
.form-grid {
    column-count: 2;
    column-gap: 16px;
}
.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.form-section {
    break-inside: avoid;
    margin-bottom: 16px;
}
.form-section.panel-wide { column-span: all; margin-top: 16px; }

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.inline-row {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

/* ============ CHECKBOX GRID ============ */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.chk {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
    font-size: 13px;
    position: relative;
}
.chk:hover {
    border-color: var(--border-light);
    background: var(--bg-3);
}
.chk input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.chk-box {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: var(--bg-2);
    border: 1px solid var(--border-light);
    flex-shrink: 0;
    transition: all var(--transition);
    position: relative;
}
.chk input:checked + .chk-box {
    background: linear-gradient(180deg, var(--accent-hover), var(--accent));
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.chk input:checked + .chk-box::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.chk .lbl {
    color: var(--text-1);
    font-weight: 500;
}
.chk:hover .lbl { color: var(--text-0); }

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 13px;
    user-select: none;
}
.checkbox-inline input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}
.checkbox-inline .lbl {
    color: var(--text-1);
}

/* ============ ICON PREVIEW ============ */
.icon-preview {
    margin-top: 12px;
    padding: 14px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
}
.icon-preview img { max-width: 64px; max-height: 64px; border-radius: 8px; }

/* ============ JOB LOG (build / dll) ============ */
.build-progress {
    animation: fadein 0.2s;
}
.job-log {
    background: #090909;
    border: 1px solid #1f1f1f;
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.65;
    color: #d5d5d5;
    max-height: 360px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.job-log .log-line { border-bottom: 1px dashed rgba(255, 255, 255, 0.08); padding: 1px 0; }
.job-log .log-line:last-child { border-bottom: none; }
.job-log .log-time { color: var(--text-3); margin-right: 8px; }
.job-log .log-err { color: #e8e8e8; opacity: 0.92; }
.job-log .log-warn { color: var(--warn); }

.placeholder-box {
    padding: 36px 20px;
    text-align: center;
    color: var(--text-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-1);
}

/* ============ BUILDS SIDEBAR ============ */
.builds-sidebar {
    margin-bottom: 16px;
}

/* ============ CARDS GRID (bots) ============ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.bot-card {
    background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    position: relative;
    overflow: hidden;
}
.bot-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, #888888, transparent);
    opacity: 0.9;
}
.bot-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
}
.bot-name {
    font-weight: 700;
    font-size: 15px;
}
.bot-token-preview {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--text-2);
    margin-bottom: 10px;
    padding: 6px 10px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    word-break: break-all;
}
.bot-info-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12.5px;
    color: var(--text-1);
}
.bot-info-row + .bot-info-row { border-top: 1px solid var(--border); }
.bot-info-label { color: var(--text-2); }
.bot-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.bot-linked-agents {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.bot-linked-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-2);
    font-weight: 600;
    margin-bottom: 8px;
}
.linked-agent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 12.5px;
}
.bot-link-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

/* ============ COLLECTIONS (tree + preview) ============ */
.collections-wrap {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    min-height: 520px;
}
.tree-panel, .preview-panel { min-height: 520px; }
.tree-view {
    font-size: 13px;
    font-family: var(--mono);
    max-height: 640px;
    overflow-y: auto;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-1);
    user-select: none;
}
.tree-item:hover { background: var(--bg-3); color: var(--text-0); }
.tree-item.selected { background: var(--accent-soft); color: var(--text-0); }
.tree-item.folder > .tree-label { font-weight: 600; color: var(--warn); }
.tree-toggle {
    width: 16px; height: 16px; flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    transition: transform var(--transition);
}
.tree-item.folder.open > .tree-toggle { transform: rotate(90deg); }
.tree-item.empty > .tree-toggle { visibility: hidden; }
.tree-icon {
    width: 16px; height: 16px;
    color: var(--text-3);
    flex-shrink: 0;
}
.tree-item.folder .tree-icon { color: var(--warn); }
.tree-label {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tree-size { font-size: 11.5px; color: var(--text-3); }
.tree-children {
    padding-left: 18px; border-left: 1px solid var(--border);
    margin-left: 8px;
    display: none;
}
.tree-item.open + .tree-children { display: block; }

.preview-pane {
    min-height: 440px;
    max-height: 70vh;
    overflow: auto;
}
.preview-img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.preview-text {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-1);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 60vh;
    overflow: auto;
}

/* ============ DATA TABLE ============ */
.data-table-wrap {
    background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 16px;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table thead {
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--border);
}
.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-2);
    font-weight: 700;
}
.data-table td {
    padding: 11px 16px;
    border-top: 1px solid var(--border);
    color: var(--text-1);
    vertical-align: middle;
}
.data-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}
.data-table .token-col {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-0);
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.data-table-actions { display: flex; gap: 6px; }

/* ============ HINT BOX ============ */
.hint-box {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    line-height: 1.55;
}
.hint-box.info {
    background: rgba(232, 232, 232, 0.07);
    border: 1px solid rgba(232, 232, 232, 0.25);
    color: #e8e8e8;
}
.hint-box.warn {
    background: var(--warn-soft);
    border: 1px solid rgba(200, 203, 208, 0.3);
    color: var(--warn);
}

/* ============ MODAL ============ */
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.agent-loading-overlay {
    position: absolute;
    inset: 0;
    background: var(--bg-0);
    display: flex;
    align-items: center;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    justify-content: center;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.agent-loading-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.agent-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.agent-loading-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-0);
}
.agent-loading-meta {
    font-size: 13px;
    color: var(--text-3);
    margin-bottom: 20px;
}
.agent-loading-bar {
    width: 220px;
    height: 3px;
    background: var(--bg-3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}
.agent-loading-fill {
    height: 100%;
    width: 0;
    background: #22c55e;
    border-radius: 3px;
    animation: loadbar 0.85s ease-in-out forwards;
}
@keyframes loadbar {
    0% { width: 0; }
    30% { width: 45%; }
    60% { width: 75%; }
    100% { width: 100%; }
}
.agent-loading-status {
    font-size: 12px;
    color: var(--text-3);
    letter-spacing: 0.3px;
}

.module-body {
    padding: 22px 0;
    min-height: 300px;
}

.module-pane { display: none; }
.module-pane.active { display: block; animation: pageIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) both; }

/* ============ INFO GRID ============ */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.info-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.info-card-wide { grid-column: span 2; }

.info-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.info-value {
    font-size: 13px;
    color: var(--text-0);
    font-weight: 500;
    word-break: break-word;
}

.module-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

/* ============ SHELL ============ */
.shell-wrap {
    background: #080808;
    border: 1px solid #1f1f1f;
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 480px;
}

.shell-output {
    flex: 1;
    padding: 14px;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.55;
    color: #d5d5d5;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.shell-output .out-line { color: #d5d5d5; }
.shell-output .err-line { color: #c9c9c9; opacity: 0.85; }
.shell-output .cmd-echo { color: #cccccc; margin-top: 8px; }
.shell-output .cmd-echo::before { content: '$ '; color: var(--text-2); }

.shell-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #1f1f1f;
    background: #0b0b0b;
    align-items: stretch;
}

.shell-prompt {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--warn);
    padding: 9px 0;
    white-space: nowrap;
}

#shell-input {
    flex: 1;
    background: #0c0c0c;
    border: 1px solid #1f1f1f;
    font-family: var(--mono);
    font-size: 13px;
    color: #cfcfcf;
}
#shell-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ============ FILE MANAGER ============ */
.file-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}
.file-path-input {
    flex: 1;
    font-family: var(--mono);
    font-size: 13px;
}

.file-list {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    max-height: 460px;
    overflow-y: auto;
}
.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--bg-2); }
.file-icon {
    width: 22px; height: 22px;
    color: var(--text-2);
    flex-shrink: 0;
}
.file-folder .file-icon { color: var(--warn); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--text-2); font-size: 12px; font-family: var(--mono); }

/* ============ MEDIA ============ */
.media-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.media-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.media-display {
    background: #000;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.media-display img { max-width: 100%; height: auto; display: block; }

/* ============ CREDS / SYSTEM OUTPUT ============ */
.creds-results, .system-output {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 120px;
    max-height: 420px;
    overflow-y: auto;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-1);
    white-space: pre-wrap;
    word-break: break-word;
}

.cred-item {
    padding: 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}
.cred-item-header {
    font-weight: 700;
    color: var(--accent-hover);
    margin-bottom: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cred-item-row {
    display: flex;
    gap: 10px;
    padding: 3px 0;
    font-size: 12.5px;
}
.cred-item-row .k { color: var(--text-2); min-width: 90px; }
.cred-item-row .v { color: var(--text-0); word-break: break-all; }

/* ============ TOASTS ============ */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--bg-2);
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
    animation: toast-in 0.3s cubic-bezier(0.2, 0.7, 0.3, 1);
    font-size: 13px;
    color: var(--text-0);
}
.toast-success { border-left-color: var(--success); }
.toast-warn { border-left-color: var(--warn); }
.toast-error { border-left-color: var(--danger); }
.toast-title { font-weight: 700; margin-bottom: 2px; }

@keyframes toast-in {
    from { transform: translateX(40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
    to { transform: translateX(40px); opacity: 0; }
}


/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
    .form-grid { column-count: 1; }
    .form-section.panel-wide { column-span: all; }
    .checkbox-grid { grid-template-columns: repeat(2, 1fr); }
    .collections-wrap { grid-template-columns: 1fr; }
    .tree-panel, .preview-panel { min-height: auto; }
    .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .sidebar-nav {
        width: 200px;
    }
    .dash-content {
        margin-left: 200px;
        height: 100vh;
        overflow-y: auto;
    }
    .info-card-wide { grid-column: span 1; }
    .main-content { padding: 18px 14px; }
    .form-row-2 { grid-template-columns: 1fr; }
    .checkbox-grid { grid-template-columns: 1fr 1fr; }
    .form-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .sidebar-nav {
        position: fixed;
        width: 60px;
        overflow: visible;
    }
    .sidebar-nav .nav-btn span,
    .sidebar-nav-item span,
    .sidebar-nav-label,
    .sidebar-brand .brand-text,
    .sidebar-brand .brand-version,
    .sidebar-stats-row,
    .sidebar-user-info,
    .sidebar-user-info-offline {
        display: none !important;
    }
    .sidebar-brand { padding: 14px 14px; justify-content: center; }
    .brand-logo { width: 32px; height: 32px; }
    .sidebar-nav-group { padding: 10px 6px 4px; }
    .sidebar-nav .nav-btn { justify-content: center; padding: 10px; }
    .sidebar-nav-item { justify-content: center; padding: 10px; }
    .sidebar-footer { padding: 10px 6px; }
    .dash-content { margin-left: 60px; }
    .search-box { min-width: 0; width: 100%; }
    .search-box-centered { min-width: 0; }
    .content-header { flex-direction: column; align-items: stretch; }
    .dash-header-centered { padding: 16px 0 20px; width: calc(100vw - 60px); margin-left: -14px; }
    .login-card { padding: 28px 22px; }
    .checkbox-grid { grid-template-columns: 1fr; }
}

/* ============ NEW 16-TAB + BULK-BAR + CARDS ADDITIONS ============ */

/* --- inline checkbox (bulk bar master + card chk) --- */
.chk-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--text-2);
}
.chk-inline input[type="checkbox"] { display: none; }
.chk-inline .chk-box {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid var(--border);
    background: var(--bg-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.chk-inline input[type="checkbox"]:checked + .chk-box {
    background: var(--accent);
    border-color: var(--accent);
}
.chk-inline input[type="checkbox"]:checked + .chk-box::after {
    content: "";
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}

/* --- per-agent card checkbox (top-left corner float) --- */
.agent-card-chk {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
}
.agent-card-chk .chk-box {
    width: 18px;
    height: 18px;
    background: rgba(18, 16, 20, 0.85);
    backdrop-filter: blur(4px);
}

/* --- admin highlight top stripe on agent cards --- */
.agent-card-admin {
    border-top: 3px solid var(--accent-hover) !important;
    padding-top: 14px !important;
}

/* --- selected agent card outline --- */
.agent-card-selected {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}

/* --- trim long values on cards (active window, geo, etc) --- */
.agent-card-value-trim {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
    display: block;
}
.agent-card-activewin {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    font-size: 11px;
    color: var(--text-2);
    font-family: 'SF Mono', Menlo, Consolas, monospace;
}

/* --- AV / info badges on agent cards --- */
.badge-info {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.4;
    border: 1px solid transparent;
    background: var(--bg-3);
    color: var(--text-2);
}
.badge-info.badge-av {
    background: rgba(232, 232, 232, 0.14);
    color: #e8e8e8;
    border-color: rgba(232, 232, 232, 0.3);
}
.badge-info.badge-admin {
    background: rgba(232, 232, 232, 0.2);
    color: #ffffff;
    border-color: rgba(232, 232, 232, 0.45);
}
.badge-info.badge-win {
    background: rgba(80, 80, 80, 0.22);
    color: #cccccc;
    border-color: rgba(80, 80, 80, 0.45);
}
.badge-info.badge-geo {
    background: rgba(94, 56, 22, 0.22);
    color: #f5b971;
    border-color: rgba(94, 56, 22, 0.45);
}


/* --- form-control (standard input look for tab panes) --- */
.form-control {
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--text-0);
    font-size: 13px;
    font-family: inherit;
    transition: all 0.15s ease;
    outline: none;
    box-sizing: border-box;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.12);
    background: var(--bg-1);
}
.form-control::placeholder { color: var(--text-3); }
textarea.form-control {
    resize: vertical;
    min-height: 72px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    line-height: 1.55;
}
select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b606b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

/* --- file item selected highlight in file manager --- */
.file-item-selected {
    background: rgba(231, 76, 60, 0.10) !important;
    border-color: var(--accent) !important;
    color: var(--text-0) !important;
}
.file-item-selected .file-size,
.file-item-selected .file-date { color: var(--text-1) !important; }

/* --- sticky bulk action bar --- */
.bulk-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin: 0 0 16px 0;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #1a1a1a 0%, #111111 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    backdrop-filter: blur(8px);
    animation: bulkbar-in 0.25s ease;
}
@keyframes bulkbar-in {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.bulk-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.bulk-bar-right {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.bulk-count-wrap {
    font-size: 13px;
    color: var(--text-1);
    font-weight: 500;
}
.bulk-count-wrap strong {
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
}
.bulk-chk-master { position: static; }
.bulk-chk-master .chk-box { background: var(--bg-1); }
.bulk-upload-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.bulk-upload-label input[type="file"] { display: none; }

/* --- compact btn for packed rows (fun tab 17 buttons) --- */
.btn-compact {
    padding: 5px 10px !important;
    font-size: 11.5px !important;
    border-radius: 6px !important;
    letter-spacing: 0.01em;
}
.module-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    margin-top: 10px;
}

.fun-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin-bottom: 18px;
    margin-top: 6px;
}
.fun-pair {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 72px;
    justify-content: space-between;
}
.fun-pair-wide { grid-column: 1 / -1; }
.fun-pair-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    opacity: 0.85;
}
.fun-pair-btns {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}
.fun-pair-btns .btn {
    flex: 1;
    justify-content: center;
    min-width: 0;
}
.fun-toggle {
    transition: transform 90ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}
.fun-toggle.btn-on {
    background: linear-gradient(180deg, #ffffff 0%, #cccccc 100%) !important;
    color: #080808 !important;
    border-color: rgba(0,0,0,0.28) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.55), 0 2px 0 rgba(0,0,0,0.28) !important;
    font-weight: 700;
    transform: translateY(1px);
    opacity: 1 !important;
    filter: none !important;
}
.fun-toggle:not(.btn-on) {
    opacity: 0.86;
    filter: saturate(0.92);
}
.fun-toggle:active { transform: translateY(1px); }


/* When offline banner visible, disable command buttons (except Kill / Delete): */
#agent-page.is-offline .cmd-btn:not(.cmd-btn-always-on),
#agent-page.is-offline button[data-cmd]:not([data-cmd="kill_agent"]):not([data-cmd="download_selected"]):not([data-cmd="delete_selected"]),
#agent-page.is-offline .fun-toggle,
#agent-page.is-offline #shell-submit,
#agent-page.is-offline #filemanager-go,
#agent-page.is-offline button[data-cmd="upload_file"] {
    pointer-events: none;
    opacity: 0.45;
    filter: grayscale(60%);
    cursor: not-allowed;
}

/* Keep sidebar module nav clickable when offline (so user can see saved output): */
#agent-page.is-offline .mod-nav {
    pointer-events: auto;
    opacity: 1;
    filter: none;
    cursor: pointer;
}

/* --- module pane section label above form rows --- */
.module-subtitle {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin: 16px 0 8px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border);
}
.module-subtitle:first-child { margin-top: 0; }

/* --- two-column form rows inside panes --- */
.pane-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    margin-bottom: 12px;
}
.pane-form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px 14px;
    margin-bottom: 12px;
}
.pane-form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}
.pane-form-row label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-2);
}
@media (max-width: 820px) {
    .pane-form-grid, .pane-form-grid-3 { grid-template-columns: 1fr; }
    .bulk-bar { flex-direction: column; align-items: stretch; }
    .bulk-bar-right { justify-content: flex-start; }
}

/* ============ CREDENTIALS SUB-TABS ============ */
.creds-subtabs {
    display: flex;
    gap: 2px;
    padding: 0 4px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    margin: -22px -22px 16px -22px;
    padding: 0 16px;
    background: var(--bg-2);
    scrollbar-width: thin;
    scrollbar-color: #2d2d2d transparent;
}
.creds-subtabs::-webkit-scrollbar { height: 4px; }
.creds-subtabs::-webkit-scrollbar-track { background: var(--bg-2); }
.creds-subtabs::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 999px; }
.creds-subtabs::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

.creds-subtab {
    display: inline-flex;
    align-items: center;
    padding: 11px 13px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    margin-right: 2px;
    margin-bottom: -1px;
    font-family: inherit;
}
.creds-subtab:hover {
    color: var(--text-0);
    background: rgba(255, 255, 255, 0.03);
}
.creds-subtab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.creds-subbody { position: relative; }
.creds-subpane { display: none; animation: fadein 0.2s; }
.creds-subpane.active { display: block; }

.creds-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.creds-tab-header .hint-text {
    font-size: 11.5px;
    font-weight: 400;
    opacity: 0.7;
    color: var(--text-2);
}
.creds-tab-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
