/* --- DESIGN TOKENS & RESET --- */
:root {
    --bg-subtle: rgba(255, 255, 255, 0.03);
    --bg-subtle-hover: rgba(255, 255, 255, 0.05);
    --bg-active: rgba(255, 255, 255, 0.08);
    --bg-highlight: rgba(255, 255, 255, 0.1);
    --nav-bg: rgba(0, 0, 0, 0.25);

    --bg-main: #0a0d14;
    --bg-surface: #111726;
    --bg-card: rgba(18, 24, 38, 0.85);
    --bg-card-hover: #1c2438;
    --bg-input: #0e1320;
    --border-color: var(--bg-active);
    --border-focus: var(--accent-primary);
    --accent-primary: #38bdf8;
    --accent-success: #34d399;
    --accent-warning: #fbbf24;
    --accent-danger: #f87171;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Semantic Text Colors for Dark Theme */
    --text-info: #38bdf8;
    --text-success: #34d399;
    --text-warning: #fbbf24;
    --text-danger: #f87171;
    
    --font-ui: 'Cairo', system-ui, -apple-system, sans-serif;
    --font-code: 'Fira Code', 'JetBrains Mono', monospace;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-theme {
    --bg-subtle: rgba(0, 0, 0, 0.03);
    --bg-subtle-hover: rgba(0, 0, 0, 0.05);
    --bg-active: rgba(0, 0, 0, 0.08);
    --bg-highlight: rgba(0, 0, 0, 0.1);
    --nav-bg: rgba(0, 0, 0, 0.05);

    --bg-main: #f0f4f8;
    --bg-surface: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: #f8fafc;
    --bg-input: #e2e8f0;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-focus: #0ea5e9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-card-hover);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--bg-active);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Glassmorphism */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
    border-radius: 0 !important;
    position: relative;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    pointer-events: none;
    z-index: 10;
    background:
      linear-gradient(to right, #fbbf24 6px, transparent 6px) 0 0,
      linear-gradient(to bottom, #fbbf24 6px, transparent 6px) 0 0,
      linear-gradient(to left, #fbbf24 6px, transparent 6px) 100% 0,
      linear-gradient(to bottom, #fbbf24 6px, transparent 6px) 100% 0,
      linear-gradient(to right, #fbbf24 6px, transparent 6px) 0 100%,
      linear-gradient(to top, #fbbf24 6px, transparent 6px) 0 100%,
      linear-gradient(to left, #fbbf24 6px, transparent 6px) 100% 100%,
      linear-gradient(to top, #fbbf24 6px, transparent 6px) 100% 100%;
    background-repeat: no-repeat;
    background-size: 35px 35px; /* Thicker, longer corner lines */
}

.glass-nav {
    background: rgba(13, 18, 30, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    user-select: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: #ffffff;
}
.btn-primary:hover {
    background: var(--accent-primary-hover);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: var(--bg-subtle-hover);
    color: var(--text-primary);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.btn-icon:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* --- LOGIN SCREEN --- */
.login-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #131b2e 0%, #080b12 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo {
    display: inline-flex;
    padding: 14px;
    background: rgba(2, 132, 199, 0.12);
    border: 1px solid rgba(2, 132, 199, 0.25);
    border-radius: var(--radius-lg);
    color: var(--accent-primary);
    margin-bottom: 16px;
}
.login-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}
.login-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

.input-group {
    margin-bottom: 18px;
}
.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrapper svg {
    position: absolute;
    right: 12px;
    color: var(--text-muted);
}
.input-wrapper input,
.input-group input,
.files-search-box input {
    width: 100%;
    padding: 10px 14px;
    padding-right: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}
.input-group input:not(.input-wrapper input) {
    padding-right: 14px;
}
.input-wrapper input:focus,
.input-group input:focus,
.files-search-box input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.error-badge {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
}

/* --- APP WRAPPER & HEADER --- */
.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    gap: 16px;
    z-index: 100;
    flex-wrap: wrap; /* Changed to wrap so it doesn't force a strict horizontal line */
    flex-shrink: 0;
    width: 100%;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 170px;
}
.brand-icon {
    color: var(--accent-primary);
    display: flex;
    align-items: center;
}
.brand-text {
    display: flex;
    flex-direction: column;
}
.brand-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.2px;
}
.badge {
    font-size: 11px;
    color: var(--text-muted);
}

/* Header Stats */
.header-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 550px;
    flex-wrap: wrap;
    justify-content: center;
}
.stat-pill {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-family: var(--font-code);
    flex: 1;
}
.stat-label {
    color: var(--text-muted);
    font-size: 11px;
}
.stat-val {
    color: var(--text-primary);
    font-weight: 600;
}
.mini-bar {
    width: 36px;
    height: 5px;
    background: var(--bg-active);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-right: auto;
}
.mini-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* Navigation Tabs */
.main-nav {
    display: flex;
    align-items: center;
    background: var(--nav-bg);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    gap: 4px;
    overflow-x: auto;
    max-width: 100%;
    flex-wrap: nowrap;
}
.main-nav::-webkit-scrollbar {
    height: 4px;
}
.main-nav::-webkit-scrollbar-thumb {
    background: var(--bg-highlight);
    border-radius: 4px;
}
.drawer-header,
.drawer-footer {
    display: none;
}
.drawer-tabs-wrapper {
    display: contents;
}
.nav-backdrop {
    display: none;
}
.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.nav-tab:hover {
    color: var(--text-primary);
    background: var(--bg-subtle);
}
.nav-tab.active {
    background: var(--bg-card);
    color: var(--accent-primary);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.user-tag {
    font-size: 13px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-primary);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-family: var(--font-code);
}

/* --- MAIN CONTENT & PANES --- */
.app-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding: 14px 20px;
    height: 0;
    min-height: 0;
}

.tab-pane {
    display: none;
    min-height: 100%;
    flex-direction: column;
}
.tab-pane.active {
    display: flex;
}

#tab-terminal {
    height: 100%;
    overflow: hidden;
}

#tab-files {
    height: 100%;
    min-height: calc(100vh - 100px);
    overflow: hidden;
    padding-bottom: 20px;
}

#tab-editor {
    height: 100%;
    overflow: hidden;
}

#tab-monitor, #tab-settings, #tab-security {
    height: auto;
    min-height: 100%;
    padding-bottom: 80px;
}

/* --- TAB 1: TERMINAL --- */
.terminal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}
.arabic-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.toggle-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-primary);
}

#btn-term-reconnect.connecting svg {
    animation: term-spin 0.8s linear infinite;
    color: var(--accent-warning, #f59e0b);
}
#btn-term-reconnect.connected svg {
    color: var(--accent-success, #10b981);
}
@keyframes term-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #334155;
    transition: .3s;
    border-radius: 20px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    right: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--accent-primary);
}
input:checked + .slider:before {
    transform: translateX(-16px);
}

.terminal-container {
    flex: 1;
    min-height: 0;
    background: #06090f;
    border: 1px solid var(--border-color);
    padding: 10px;
    overflow: hidden;
    position: relative;
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: normal !important;
}
#terminal,
.xterm,
.xterm-viewport,
.xterm-screen,
.xterm-rows,
.xterm-helpers {
    width: 100%;
    height: 100%;
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: normal !important;
    letter-spacing: normal !important;
}

/* --- TERMINAL SPECIAL KEYS BAR --- */
.terminal-keys-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-top: none;
    border-bottom: 1px solid var(--bg-subtle-hover);
    flex-wrap: wrap;
}
.key-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.keys-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 2px;
}
.term-key-btn {
    padding: 4px 9px;
    border-radius: 4px;
    font-family: var(--font-code);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    border: 1px solid var(--bg-highlight);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: all 0.12s ease;
    user-select: none;
}
.term-key-btn:hover {
    background: var(--bg-active);
    color: #ffffff;
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}
.term-key-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.term-key-btn.btn-key-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
    border-color: rgba(239, 68, 68, 0.35);
}
.term-key-btn.btn-key-danger:hover {
    background: var(--accent-danger);
    color: #ffffff;
}

.term-key-btn.btn-key-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
    border-color: rgba(245, 158, 11, 0.35);
}
.term-key-btn.btn-key-warning:hover {
    background: var(--accent-warning);
    color: #000000;
}

.term-key-btn.btn-key-primary {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-primary);
    border-color: rgba(56, 189, 248, 0.35);
}
.term-key-btn.btn-key-primary:hover {
    background: var(--accent-primary);
    color: #ffffff;
}

.term-key-btn.btn-key-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-success);
    border-color: rgba(16, 185, 129, 0.4);
}
.term-key-btn.btn-key-success:hover {
    background: var(--accent-success);
    color: #ffffff;
}

.term-key-btn.btn-key-arrow {
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 600;
}
.term-key-btn.btn-key-arrow:hover {
    color: var(--accent-primary);
}

.quick-commands-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-top: none;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    overflow-x: auto;
}
.quick-title {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.cmd-pill {
    background: #192233;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font-code);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}
.cmd-pill:hover {
    background: #25334c;
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* --- TAB 2: FILE MANAGER --- */
.files-header {
    padding: 12px 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.files-nav-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}
.path-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-input);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-family: var(--font-code);
    font-size: 13px;
    flex: 1;
    overflow-x: auto;
}
.breadcrumb-item {
    cursor: pointer;
    color: var(--accent-primary);
    padding: 2px 6px;
    border-radius: 4px;
    transition: var(--transition);
}
.breadcrumb-item:hover {
    background: rgba(56, 189, 248, 0.15);
}
.breadcrumb-item::after {
    content: "/";
    margin-right: 6px;
    color: var(--text-muted);
}
.breadcrumb-item:last-child::after {
    display: none;
}

.files-quick-jumps {
    display: flex;
    align-items: center;
    gap: 4px;
}
.jump-btn {
    font-family: var(--font-code);
    font-size: 12px;
}

.files-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.action-buttons-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.files-search-box {
    width: 240px;
}
.files-search-box input {
    padding-right: 12px;
    height: 34px;
}

.files-table-container {
    flex: 1;
    min-height: 380px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    position: relative;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
}
.drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.92);
    border: 2px dashed var(--accent-primary);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 50;
    color: var(--accent-primary);
}

.files-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: right;
}
.files-table th {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 10px 14px;
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}
.files-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--bg-subtle);
}
.file-row {
    transition: var(--transition);
    cursor: pointer;
}
.file-row:hover {
    background: var(--bg-subtle);
}
.file-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.file-name-text {
    font-weight: 500;
    color: var(--text-primary);
}
.file-row.is-dir .file-name-text {
    color: var(--accent-primary);
    font-weight: 600;
}
.file-actions-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.action-btn-sm {
    padding: 4px 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}
.action-btn-sm:hover {
    color: var(--accent-primary);
    background: var(--bg-active);
}
.action-btn-sm.delete:hover {
    color: var(--accent-danger);
}

/* --- TAB 3: CODE EDITOR --- */
.editor-header {
    padding: 8px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.editor-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-code);
    font-size: 14px;
    color: var(--accent-primary);
}
.unsaved-indicator {
    color: var(--accent-warning);
    font-size: 14px;
}
.editor-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.select-wrapper select {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-code);
    font-size: 13px;
    outline: none;
}

.editor-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    border-radius: var(--radius-md);
}
#code-editor-container {
    width: 100%;
    height: 100%;
    font-family: var(--font-code) !important;
    font-size: 14px !important;
}

.editor-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
    font-size: 12px;
    font-family: var(--font-code);
    color: var(--text-muted);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    margin-top: 6px;
}

/* --- TAB 4: SETTINGS --- */
.settings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
    overflow-y: auto;
    padding: 10px 0;
}
.settings-card {
    padding: 24px;
}
.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-primary);
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 3px solid #fbbf24 !important; /* Thick golden line acting as separator */
}
.card-header h3 {
    font-size: 18px;
    font-weight: 700;
}
.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--bg-subtle-hover);
    font-size: 14px;
}
.info-row span { color: var(--text-secondary); }
.info-row strong { color: var(--text-primary); font-family: var(--font-code); }

/* --- MODALS & TOASTS --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal-box {
    width: 100%;
    max-width: 380px;
    padding: 24px;
    border-radius: var(--radius-lg);
}
.modal-box h3 {
    margin-bottom: 16px;
    font-size: 18px;
}
.modal-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}
.toast {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    animation: slideIn 0.25s ease-out;
}
.toast.success { border-color: var(--accent-success); color: var(--accent-success); }
.toast.error { border-color: var(--accent-danger); color: var(--accent-danger); }
@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 900px) {
    .header-stats { display: none; }
    .brand-section { min-width: auto; }
}

/* --- BOOSTER BUTTON --- */
.btn-booster {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #0369a1 100%);
    color: #ffffff;
    border: 1px solid rgba(56, 189, 248, 0.4);
    box-shadow: 0 0 12px rgba(2, 132, 199, 0.3);
    font-weight: 600;
}
.btn-booster:hover {
    background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
    border-color: var(--accent-primary);
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.5);
    transform: translateY(-1px);
}

/* --- TAB: MONITORING --- */
.monitor-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.monitor-top-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 14px;
}
.banner-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sys-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-primary);
}
.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-success);
}
.sys-subinfo {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.sys-subinfo strong {
    color: var(--text-primary);
}

.banner-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.auto-refresh-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}
.select-sm {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}
.select-sm:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* KPI Grid */
.monitor-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.kpi-card {
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: var(--transition);
}
.kpi-card:hover {
    border-color: rgba(56, 189, 248, 0.3);
    transform: translateY(-2px);
}
.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.kpi-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-cpu { background: rgba(56, 189, 248, 0.15); color: var(--accent-primary); }
.icon-ram { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.icon-proc { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.icon-ports { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }

.kpi-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 6px;
    flex: 1;
}
.badge-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    background: var(--bg-active);
    border-radius: var(--radius-full);
    color: var(--text-primary);
}
.kpi-value-wrap {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}
.kpi-main-val {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.kpi-progress {
    width: 100%;
    height: 6px;
    background: var(--bg-active);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.kpi-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-primary));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}
.kpi-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}
.kpi-footer strong {
    color: var(--text-secondary);
}

.proc-breakdown {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.badge-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.status-running { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.status-sleeping { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }
.status-zombie { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); }

/* Monitor Sections */
.monitor-section {
    padding: 18px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.section-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.search-box input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    width: 200px;
    font-family: inherit;
}
.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
}
.sort-box {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Data Tables */
.table-container {
    overflow-x: auto;
    max-height: 480px;
    overflow-y: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-main);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: right;
}
.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-main);
    color: var(--text-secondary);
    padding: 10px 14px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.data-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--bg-subtle);
    color: var(--text-primary);
    white-space: nowrap;
}
.data-table tbody tr:hover {
    background: var(--bg-subtle);
}

/* Badges inside tables */
.badge-pid {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-subtle-hover);
    padding: 2px 6px;
    border-radius: 4px;
}
.badge-port {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--accent-primary);
    background: rgba(2, 132, 199, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(56, 189, 248, 0.3);
}
.badge-proto {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}
.badge-proto.tcp { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.badge-proto.udp { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }

.badge-ip {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}
.badge-ip.public { color: var(--accent-primary); font-weight: 600; }
.badge-ip.local { color: var(--text-muted); }

.badge-cpu-low { color: var(--accent-success); font-weight: 600; }
.badge-cpu-med { color: var(--accent-warning); font-weight: 700; }
.badge-cpu-high { color: var(--accent-danger); font-weight: 800; }

.btn-kill-proc {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-kill-proc:hover {
    background: var(--accent-danger);
    color: #ffffff;
}

/* Clean Modal */
.clean-modal-box {
    max-width: 460px;
    text-align: center;
}
.modal-clean-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.clean-icon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(2, 132, 199, 0.15);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}
.modal-clean-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.modal-clean-header p {
    font-size: 13px;
    color: var(--text-secondary);
}
.clean-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.clean-stat-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.clean-stat-label {
    font-size: 11px;
    color: var(--text-muted);
}
.clean-stat-num {
    font-size: 18px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
}
.clean-actions-list {
    text-align: right;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
}
.clean-actions-list h4 {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.clean-actions-list ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--accent-success);
}
.clean-actions-list li::before {
    content: "✓ ";
    color: var(--accent-success);
    font-weight: bold;
}

/* Service Actions Buttons */
.srv-action-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}
.btn-srv {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}
.btn-srv.restart {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-primary);
    border-color: rgba(56, 189, 248, 0.3);
}
.btn-srv.restart:hover {
    background: var(--accent-primary);
    color: #ffffff;
}
.btn-srv.stop {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
    border-color: rgba(239, 68, 68, 0.3);
}
.btn-srv.stop:hover {
    background: var(--accent-danger);
    color: #ffffff;
}
.btn-srv.start {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
    border-color: rgba(16, 185, 129, 0.3);
}
.btn-srv.start:hover {
    background: var(--accent-success);
    color: #ffffff;
}

/* --- BOTS & APPS MANAGER STYLES --- */
.bots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.bot-card {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}
.bot-card:hover {
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.bot-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.bot-info-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.bot-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: rgba(56, 189, 248, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.bot-name-wrap h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.bot-name-wrap span {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-code);
}

.bot-metrics-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: var(--nav-bg);
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--bg-subtle);
}
.bot-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.bot-metric span {
    font-size: 11px;
    color: var(--text-muted);
}
.bot-metric strong {
    font-size: 13px;
    color: var(--text-primary);
    font-family: var(--font-code);
}

.bot-actions-row {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* --- FAIL2BAN JAIL CARDS --- */
.f2b-jail-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.f2b-jail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.f2b-jail-header strong {
    font-size: 13px;
    color: var(--accent-primary);
    font-family: var(--font-code);
}
.f2b-jail-stats {
    font-size: 12px;
    color: var(--text-secondary);
}

/* --- DB STUDIO STYLES --- */
.db-table-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    text-align: right;
    width: 100%;
}
.db-table-btn:hover, .db-table-btn.active {
    background: rgba(2, 132, 199, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* --- LIGHT THEME --- */
body.light-theme {
    --bg-main: #f0f2f5;
    --bg-surface: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-hover: #e2e8f0;
    --bg-input: #ffffff;
    --border-color: rgba(0, 0, 0, 0.12);
    --border-focus: var(--accent-primary);
    --accent-primary: #0284c7;
    --accent-success: #16a34a;
    --accent-warning: #d97706;
    --accent-danger: #dc2626;
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    /* Semantic Text Colors for Light Theme */
    --text-info: #0284c7;
    --text-success: #16a34a;
    --text-warning: #d97706;
    --text-danger: #dc2626;
}

body.light-theme ::-webkit-scrollbar-track {
    background: var(--bg-main);
}
body.light-theme ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}
body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body.light-theme .glass-nav {
    background: rgba(255, 255, 255, 0.94) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

/* Light Theme - Header & Navigation Enhancements */
body.light-theme .brand-title {
    color: #0f172a !important;
}
body.light-theme .badge {
    background: rgba(0, 0, 0, 0.05);
    color: #475569;
    border: 1px solid rgba(0, 0, 0, 0.08);
}
body.light-theme .stat-pill {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .stat-label {
    color: #64748b !important;
}
body.light-theme .stat-val {
    color: #0f172a !important;
}
body.light-theme .mini-bar {
    background: #e2e8f0 !important;
}
body.light-theme .user-actions .btn-icon {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #334155 !important;
}
body.light-theme .user-actions .btn-icon:hover {
    background: #f1f5f9 !important;
    color: #0284c7 !important;
    border-color: #0284c7 !important;
}
body.light-theme .user-tag {
    background: rgba(2, 132, 199, 0.1) !important;
    color: #0284c7 !important;
    border: 1px solid rgba(2, 132, 199, 0.2) !important;
}

/* Desktop Main Nav in Light Mode */
body.light-theme .main-nav {
    background: rgba(0, 0, 0, 0.04) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}
body.light-theme .nav-tab {
    color: #475569 !important;
}
body.light-theme .nav-tab:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #0f172a !important;
}
body.light-theme .nav-tab.active {
    background: #ffffff !important;
    color: #0284c7 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
}

/* Light Theme - Mobile Drawer Overrides */
body.light-theme .hidden-desktop {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: #0f172a !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}
body.light-theme .hidden-desktop:hover,
body.light-theme.menu-open .hidden-desktop,
body.light-theme .app-header.menu-open .hidden-desktop {
    background: rgba(2, 132, 199, 0.1) !important;
    border-color: #0284c7 !important;
    color: #0284c7 !important;
}

body.light-theme .nav-backdrop {
    background: rgba(15, 23, 42, 0.45) !important;
}

@media (max-width: 1200px) {
    body.light-theme .main-nav {
        background: #ffffff !important;
        border-left: 1px solid rgba(0, 0, 0, 0.08) !important;
        box-shadow: -15px 0 40px rgba(0, 0, 0, 0.12) !important;
    }
    html[dir="ltr"] body.light-theme .main-nav {
        border-left: none !important;
        border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
        box-shadow: 15px 0 40px rgba(0, 0, 0, 0.12) !important;
    }
    body.light-theme .drawer-header {
        background: #f8fafc !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
    }
    body.light-theme .drawer-brand-title {
        background: linear-gradient(135deg, #0284c7 0%, #7c3aed 100%) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
    }
    body.light-theme .drawer-brand-sub {
        color: #64748b !important;
    }
    body.light-theme .drawer-close-btn {
        background: #f1f5f9 !important;
        border: 1px solid rgba(0, 0, 0, 0.1) !important;
        color: #334155 !important;
    }
    body.light-theme .drawer-close-btn:hover {
        background: #fee2e2 !important;
        border-color: #f87171 !important;
        color: #dc2626 !important;
    }
    body.light-theme .main-nav .nav-tab {
        background: #f8fafc !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        color: #334155 !important;
    }
    body.light-theme .main-nav .nav-tab:hover {
        background: #f1f5f9 !important;
        border-color: rgba(0, 0, 0, 0.1) !important;
        color: #0f172a !important;
    }
    body.light-theme .main-nav .nav-tab.active {
        background: linear-gradient(135deg, rgba(2, 132, 199, 0.12) 0%, rgba(37, 99, 235, 0.15) 100%) !important;
        border: 1px solid rgba(2, 132, 199, 0.4) !important;
        color: #0284c7 !important;
        box-shadow: 0 4px 12px rgba(2, 132, 199, 0.12) !important;
    }
    body.light-theme .main-nav .nav-tab.active svg {
        stroke: #0284c7 !important;
        filter: none !important;
    }
    body.light-theme .main-nav .nav-tab-ai {
        background: linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(2, 132, 199, 0.06)) !important;
        border: 1px solid rgba(168, 85, 247, 0.25) !important;
        color: #581c87 !important;
    }
    body.light-theme .main-nav .nav-tab-ai.active {
        background: linear-gradient(135deg, rgba(168, 85, 247, 0.18), rgba(2, 132, 199, 0.18)) !important;
        border-color: rgba(168, 85, 247, 0.5) !important;
        color: #7c3aed !important;
    }
    body.light-theme .drawer-footer {
        background: #f8fafc !important;
        border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
    }
    body.light-theme .drawer-sys-status {
        color: #475569 !important;
    }
    body.light-theme .drawer-version-tag {
        color: #64748b !important;
    }
}

/* Light Theme - AI Assistant & Chat Styling */
body.light-theme .ai-agent-header {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .ai-brand-title strong {
    color: #0f172a !important;
}
body.light-theme .ai-brand-subtitle {
    color: #64748b !important;
}
body.light-theme .ai-toggle-sessions-btn {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
}
body.light-theme .ai-toggle-sessions-btn:hover {
    background: #f1f5f9 !important;
    border-color: #0284c7 !important;
    color: #0284c7 !important;
}
body.light-theme .ai-count-badge {
    background: #e0f2fe !important;
    color: #0284c7 !important;
}
body.light-theme .ai-sessions-sidebar {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .ai-sidebar-header {
    background: #f8fafc !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}
body.light-theme .ai-sidebar-title {
    color: #0f172a !important;
}
body.light-theme .btn-sidebar-close {
    color: #64748b !important;
}
body.light-theme .btn-sidebar-close:hover {
    color: #0f172a !important;
    background: #e2e8f0 !important;
}
body.light-theme .ai-sidebar-search {
    border-color: rgba(0, 0, 0, 0.08) !important;
}
body.light-theme .ai-sidebar-search input {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.14) !important;
    color: #0f172a !important;
}
body.light-theme .ai-sidebar-search input:focus {
    border-color: #0284c7 !important;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15) !important;
}
body.light-theme .ai-session-item:hover {
    background: #f8fafc !important;
    border-color: rgba(2, 132, 199, 0.25) !important;
}
body.light-theme .ai-session-item.active {
    background: #e0f2fe !important;
    border-color: #0284c7 !important;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.15) !important;
}
body.light-theme .ai-session-item-title {
    color: #0f172a !important;
}
body.light-theme .ai-session-item.active .ai-session-item-title {
    color: #0284c7 !important;
    font-weight: 700 !important;
}
body.light-theme .ai-session-item-meta {
    color: #64748b !important;
}
body.light-theme .ai-session-turns-pill {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
}
body.light-theme .ai-session-delete-btn {
    color: #94a3b8 !important;
}
body.light-theme .ai-session-delete-btn:hover {
    color: #ef4444 !important;
    background: #fee2e2 !important;
}
body.light-theme .ai-no-sessions-hint {
    color: #64748b !important;
}
body.light-theme .ai-session-selector-wrap select,
body.light-theme .ai-effort-wrap select {
    background: #f8fafc !important;
    color: #0f172a !important;
    border-color: rgba(0, 0, 0, 0.14) !important;
}
body.light-theme .ai-chat-container {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .ai-welcome-heading {
    color: #0f172a !important;
}
body.light-theme .ai-welcome-desc {
    color: #475569 !important;
}
body.light-theme .ai-quick-card {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}
body.light-theme .ai-quick-card:hover {
    background: #f8fafc !important;
    border-color: #0284c7 !important;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.12) !important;
}
body.light-theme .ai-quick-card-body strong {
    color: #0f172a !important;
}
body.light-theme .ai-quick-card-body span {
    color: #64748b !important;
}
body.light-theme .ai-bubble-user {
    background: linear-gradient(135deg, #0284c7, #2563eb) !important;
    border: none !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.22) !important;
}
body.light-theme .ai-bubble-user .ai-bubble-text {
    color: #ffffff !important;
}
body.light-theme .ai-bubble-user .ai-bubble-time {
    color: rgba(255, 255, 255, 0.8) !important;
}
body.light-theme .ai-msg-assistant .ai-msg-body {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
    color: #0f172a !important;
}
body.light-theme .ai-msg-author {
    color: #0284c7 !important;
}
body.light-theme .ai-role-pill {
    background: #e0f2fe !important;
    color: #0284c7 !important;
    border-color: rgba(2, 132, 199, 0.25) !important;
}
body.light-theme .ai-copy-response-btn {
    border-color: rgba(0, 0, 0, 0.12) !important;
    color: #64748b !important;
    background: #f8fafc !important;
}
body.light-theme .ai-copy-response-btn:hover {
    background: #e0f2fe !important;
    color: #0284c7 !important;
    border-color: #0284c7 !important;
}
body.light-theme .ai-tools-accordion {
    background: #f8fafc !important;
    border-color: rgba(0, 0, 0, 0.09) !important;
}
body.light-theme .ai-tools-summary {
    color: #334155 !important;
}
body.light-theme .ai-tools-summary:hover {
    background: #f1f5f9 !important;
}
body.light-theme .ai-tools-details-list {
    border-top-color: rgba(0, 0, 0, 0.06) !important;
}
body.light-theme .ai-step-card {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    color: #334155 !important;
}
body.light-theme .ai-step-card.active {
    background: rgba(2, 132, 199, 0.06) !important;
    border-color: #0284c7 !important;
}
body.light-theme .ai-step-card.done {
    background: rgba(22, 163, 74, 0.05) !important;
    border-color: rgba(22, 163, 74, 0.3) !important;
}
body.light-theme .ai-step-label {
    color: #0f172a !important;
}
body.light-theme .ai-step-target {
    background: #f1f5f9 !important;
    color: #0284c7 !important;
    border: 1px solid #e2e8f0 !important;
}
body.light-theme .ai-msg-body h1,
body.light-theme .ai-msg-body h2,
body.light-theme .ai-msg-body h3,
body.light-theme .ai-msg-body h4 {
    color: #0284c7 !important;
}
body.light-theme .ai-msg-body code {
    background: #f1f5f9 !important;
    color: #0369a1 !important;
    border: 1px solid #e2e8f0 !important;
}
body.light-theme .btn-ai-scroll-bottom {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08) !important;
}
body.light-theme .ai-input-dock {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}
body.light-theme #ai-prompt-input {
    background: #f8fafc !important;
    color: #0f172a !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
}
body.light-theme #ai-prompt-input:focus {
    background: #ffffff !important;
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15) !important;
}
body.light-theme .ai-dock-meta {
    color: #64748b !important;
}
body.light-theme .ai-active-session-id {
    color: #0284c7 !important;
}

/* Light Theme - Tables, Cards, Modals */
body.light-theme .monitor-card,
body.light-theme .bot-card,
body.light-theme .table-container {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #0f172a !important;
}
body.light-theme th {
    background: #f8fafc !important;
    color: #475569 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}
body.light-theme td {
    color: #0f172a !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}
body.light-theme tr:hover td {
    background: rgba(0, 0, 0, 0.02) !important;
}
body.light-theme input,
body.light-theme select,
body.light-theme textarea {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
}
body.light-theme .modal-box {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #0f172a !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15) !important;
}
body.light-theme .modal-header h3 {
    color: #0f172a !important;
}

/* --- RESPONSIVE DESIGN & MODERN SLIDE DRAWER (TABLETS & MOBILES <= 1200px) --- */
.hidden-desktop {
    display: none !important;
}

@media (max-width: 1200px) {
    /* Header Container on iPad & Mobile */
    .app-header {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 8px 16px !important;
        min-height: 56px !important;
        flex-wrap: nowrap !important;
        background: var(--bg-surface) !important;
        border-bottom: 1px solid var(--border-color) !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18) !important;
        z-index: 999 !important;
    }

    body.menu-open .app-header,
    .app-header.menu-open {
        z-index: 10000 !important;
    }

    /* Brand Section */
    .brand-section {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        flex: 0 0 auto !important;
    }

    /* Modern Hamburger Button */
    .hidden-desktop {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 10px !important;
        background: rgba(255, 255, 255, 0.04) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        color: var(--text-primary) !important;
        cursor: pointer !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
        padding: 0 !important;
        margin-left: 6px !important;
        margin-right: 0 !important;
        position: relative !important;
        z-index: 100 !important;
    }
    html[dir="ltr"] .hidden-desktop {
        margin-left: 0 !important;
        margin-right: 6px !important;
    }
    .hidden-desktop:hover,
    body.menu-open .hidden-desktop,
    .app-header.menu-open .hidden-desktop {
        background: rgba(56, 189, 248, 0.14) !important;
        border-color: rgba(56, 189, 248, 0.45) !important;
        color: #38bdf8 !important;
        box-shadow: 0 0 14px rgba(56, 189, 248, 0.25) !important;
    }

    /* Hide heavy stats on tablet/mobile to keep header neat */
    .header-stats {
        display: none !important;
    }

    /* User Actions in Top Header */
    .user-actions {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        flex: 0 0 auto !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    /* Mobile Backdrop Overlay */
    .nav-backdrop {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: rgba(4, 8, 16, 0.65) !important;
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
        z-index: 9998 !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease !important;
    }
    body.menu-open .nav-backdrop,
    .app-header.menu-open .nav-backdrop {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    /* Modern Slide-Over Navigation Drawer */
    .main-nav {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        left: auto !important;
        width: 310px !important;
        max-width: 86vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: #0f172a !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: none !important;
        border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: -15px 0 45px rgba(0, 0, 0, 0.7) !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        border-radius: 0 !important;
        z-index: 10000 !important;
        transform: translateX(105%) !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.32s ease !important;
        overflow: hidden !important;
    }

    body.menu-open .main-nav,
    .app-header.menu-open .main-nav {
        transform: translateX(0) !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    /* LTR Support for Drawer */
    html[dir="ltr"] .main-nav {
        right: auto !important;
        left: 0 !important;
        border-left: none !important;
        border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-shadow: 15px 0 45px rgba(0, 0, 0, 0.7), 0 0 1px rgba(255, 255, 255, 0.1) !important;
        transform: translateX(-105%) !important;
    }
    html[dir="ltr"] body.menu-open .main-nav,
    html[dir="ltr"] .app-header.menu-open .main-nav {
        transform: translateX(0) !important;
    }

    /* Drawer Header */
    .drawer-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 16px 18px !important;
        background: rgba(255, 255, 255, 0.02) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        flex-shrink: 0 !important;
    }
    .drawer-brand {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }
    .drawer-brand-icon {
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px !important;
        background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(168, 85, 247, 0.2)) !important;
        border: 1px solid rgba(56, 189, 248, 0.3) !important;
        color: #38bdf8 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    .drawer-brand-text {
        display: flex !important;
        flex-direction: column !important;
    }
    .drawer-brand-title {
        font-size: 1.05rem !important;
        font-weight: 800 !important;
        background: linear-gradient(135deg, #38bdf8 0%, #a855f7 100%) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        line-height: 1.2 !important;
    }
    .drawer-brand-sub {
        font-size: 0.7rem !important;
        color: var(--text-muted) !important;
        font-weight: 500 !important;
    }
    .drawer-close-btn {
        width: 34px !important;
        height: 34px !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        color: var(--text-secondary) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
        padding: 0 !important;
    }
    .drawer-close-btn:hover {
        background: rgba(239, 68, 68, 0.18) !important;
        border-color: rgba(239, 68, 68, 0.45) !important;
        color: #ef4444 !important;
        transform: rotate(90deg) !important;
    }

    /* Drawer Tabs Wrapper */
    .drawer-tabs-wrapper {
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
        padding: 14px !important;
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .drawer-tabs-wrapper::-webkit-scrollbar {
        width: 4px !important;
    }
    .drawer-tabs-wrapper::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1) !important;
        border-radius: 4px !important;
    }

    /* Drawer Tab Buttons */
    .main-nav .nav-tab {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        padding: 12px 14px !important;
        border-radius: 12px !important;
        font-size: 0.92rem !important;
        font-weight: 600 !important;
        color: #cbd5e1 !important;
        background: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid rgba(255, 255, 255, 0.06) !important;
        width: 100% !important;
        justify-content: flex-start !important;
        transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
        white-space: nowrap !important;
        cursor: pointer !important;
        min-height: 46px !important;
        box-sizing: border-box !important;
    }
    .main-nav .nav-tab:hover {
        background: rgba(255, 255, 255, 0.06) !important;
        border-color: rgba(255, 255, 255, 0.1) !important;
        color: #ffffff !important;
        transform: translateX(-3px) !important;
    }
    html[dir="ltr"] .main-nav .nav-tab:hover {
        transform: translateX(3px) !important;
    }
    .main-nav .nav-tab.active {
        background: linear-gradient(135deg, rgba(56, 189, 248, 0.16) 0%, rgba(37, 99, 235, 0.24) 100%) !important;
        border: 1px solid rgba(56, 189, 248, 0.45) !important;
        color: #38bdf8 !important;
        box-shadow: 0 4px 16px rgba(56, 189, 248, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
        transform: translateX(-4px) !important;
    }
    html[dir="ltr"] .main-nav .nav-tab.active {
        transform: translateX(4px) !important;
    }
    .main-nav .nav-tab svg {
        width: 19px !important;
        height: 19px !important;
        flex-shrink: 0 !important;
        stroke-width: 2.1 !important;
        transition: transform 0.2s ease !important;
    }
    .main-nav .nav-tab:hover svg {
        transform: scale(1.1) !important;
    }
    .main-nav .nav-tab.active svg {
        stroke: #38bdf8 !important;
        filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.6)) !important;
    }
    .main-nav .nav-tab-ai {
        background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(56, 189, 248, 0.08)) !important;
        border: 1px solid rgba(168, 85, 247, 0.25) !important;
    }
    .main-nav .nav-tab-ai.active {
        background: linear-gradient(135deg, rgba(168, 85, 247, 0.22), rgba(56, 189, 248, 0.22)) !important;
        border: 1px solid rgba(168, 85, 247, 0.5) !important;
        color: #c084fc !important;
        box-shadow: 0 4px 18px rgba(168, 85, 247, 0.22) !important;
    }
    .main-nav .nav-tab-ai.active svg {
        stroke: #c084fc !important;
        filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.7)) !important;
    }
    .main-nav .nav-tab .ai-nav-glow {
        margin-right: auto !important;
        margin-left: 0 !important;
        font-size: 0.68rem !important;
        padding: 2px 7px !important;
        border-radius: 20px !important;
        background: linear-gradient(135deg, #a855f7, #38bdf8) !important;
        color: #fff !important;
        font-weight: 800 !important;
        box-shadow: 0 0 10px rgba(168, 85, 247, 0.5) !important;
    }
    html[dir="ltr"] .main-nav .nav-tab .ai-nav-glow {
        margin-right: 0 !important;
        margin-left: auto !important;
    }

    /* Drawer Footer */
    .drawer-footer {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 12px 16px !important;
        background: rgba(255, 255, 255, 0.02) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        flex-shrink: 0 !important;
    }
    .drawer-sys-status {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        font-size: 0.78rem !important;
        color: var(--text-secondary) !important;
        font-weight: 500 !important;
    }
    .drawer-pulse-dot {
        width: 8px !important;
        height: 8px !important;
        border-radius: 50% !important;
        background: #10b981 !important;
        box-shadow: 0 0 8px #10b981 !important;
        animation: pulseGreen 2s infinite ease-in-out !important;
    }
    .drawer-version-tag {
        font-size: 0.72rem !important;
        color: var(--text-muted) !important;
        font-family: var(--font-code) !important;
    }

    /* Cards & Grids on Tablet / iPad */
    .monitor-kpi-grid, .kpi-grid, .bots-grid, .domains-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
        gap: 12px;
        width: 100%;
    }

    .app-main {
        padding: 12px;
    }
}

@media (max-width: 576px) {
    .brand-title {
        font-size: 14px;
    }
    .user-tag {
        display: none;
    }
    #btn-quick-clean span {
        display: none;
    }
    .table-container {
        overflow-x: auto;
    }
}

.app-header {
    transition: max-height 0.3s ease-in-out;
}


/* When LTR is active */
html[dir="ltr"] .user-actions {
    margin-right: 0;
    margin-left: auto;
}
html[dir="ltr"] .app-sidebar {
    border-left: none;
    border-right: 1px solid var(--border-color);
}
html[dir="ltr"] .nav-tab {
    text-align: left;
}
html[dir="ltr"] .stat-pill i {
    margin-left: 0;
    margin-right: 8px;
}
html[dir="ltr"] .toast {
    right: 20px;
    left: auto;
}
/* Hide Google Translate hover tooltips */
.goog-tooltip { display: none !important; }
.goog-tooltip:hover { display: none !important; }
.goog-text-highlight { background-color: transparent !important; border: none !important; box-shadow: none !important; }
/* General LTR layout flips */
html[dir="ltr"] .app-sidebar {
    border-left: none;
    border-right: 1px solid var(--border-color);
}
html[dir="ltr"] .user-tag {
    margin-right: 10px;
    margin-left: 0;
}
html[dir="ltr"] .btn svg {
    margin-right: 6px;
    margin-left: 0;
}
html[dir="ltr"] .nav-tab i {
    margin-right: 10px;
    margin-left: 0;
}
html[dir="ltr"] .files-table td, html[dir="ltr"] .files-table th {
    text-align: left;
}
html[dir="ltr"] .data-table td, html[dir="ltr"] .data-table th {
    text-align: left;
}

/* Golden Separators and Sharp Corners */
.golden-separator {
    border: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, #fbbf24, #f59e0b, #fbbf24, transparent);
    margin: 30px 0;
    width: 100%;
    opacity: 0.8;
}

/* Golden corners have been applied to .glass-card globally */

.fp-item:hover {
    background-color: var(--bg-active);
    transition: background-color 0.2s;
}

.css-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 999999 !important;
    padding: 0 !important;
    background: #000000 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

/* ==========================================================================
   AI ASSISTANT (ANTIGRAVITY DEV-COPILOT) STYLES
   ========================================================================== */

.nav-tab-ai {
    position: relative;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.nav-tab-ai.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(168, 85, 247, 0.15)) !important;
    border-color: #a855f7 !important;
    color: #f1f5f9 !important;
}

.ai-nav-glow {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #38bdf8, #a855f7);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
    letter-spacing: 0.5px;
    margin-right: 6px;
}

/* =========================================================================
   ANTIGRAVITY AUTONOMOUS AGENT WORKSPACE (MODERN VS CODE / COPILOT STYLE)
   ========================================================================= */

.ai-agent-workspace {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: calc(100vh - 110px);
    max-height: calc(100dvh - 110px);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.ai-agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.ai-agent-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ai-brand-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ai-pulse-dot {
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: ai-pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes ai-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.ai-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ai-brand-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-brand-title strong {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
}

.ai-pro-pill {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #38bdf8, #a855f7);
    color: #ffffff;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
}

.ai-brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-toggle-sessions-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    user-select: none;
}

.ai-toggle-sessions-btn:hover {
    background: var(--bg-card-hover);
    border-color: #38bdf8;
    color: #38bdf8;
}

.ai-count-badge {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.btn-primary-glow {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff !important;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary-glow:hover {
    background: linear-gradient(135deg, #0369a1, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.ai-agent-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ai-effort-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ai-effort-wrap select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
}

/* AI Workspace Body */
.ai-workspace-body {
    flex: 1;
    display: flex;
    min-height: 0;
    gap: 12px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Collapsible Sessions Sidebar */
.ai-sessions-sidebar {
    width: 270px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: width 0.25s ease, margin 0.25s ease, opacity 0.2s ease;
    min-height: 0;
    position: relative;
}

.ai-sessions-sidebar.collapsed {
    width: 0 !important;
    margin-inline-end: -12px !important;
    opacity: 0;
    pointer-events: none;
    border: none !important;
    padding: 0 !important;
}

.ai-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.08);
}

.ai-sidebar-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-sidebar-close {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.btn-sidebar-close:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.ai-sidebar-search {
    padding: 8px 10px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.ai-sidebar-search input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 28px 6px 10px;
    font-size: 0.78rem;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

html[dir="ltr"] .ai-sidebar-search input {
    padding: 6px 10px 6px 28px;
}

.ai-sidebar-search input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.ai-sidebar-search svg {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

html[dir="ltr"] .ai-sidebar-search svg {
    right: auto;
    left: 18px;
}

.ai-sessions-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    background: transparent;
    text-align: start;
    transition: var(--transition);
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

.ai-session-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(56, 189, 248, 0.2);
}

.ai-session-item.active {
    background: rgba(56, 189, 248, 0.12);
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.ai-session-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-session-item-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-session-item.active .ai-session-item-title {
    color: #38bdf8;
    font-weight: 700;
}

.ai-session-item-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-session-turns-pill {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.65rem;
}

.ai-session-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    opacity: 0.4;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-session-item:hover .ai-session-delete-btn {
    opacity: 0.85;
}

.ai-session-delete-btn:hover {
    opacity: 1 !important;
    color: #f87171 !important;
    background: rgba(239, 68, 68, 0.15) !important;
}

.ai-no-sessions-hint {
    padding: 24px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.ai-sidebar-backdrop {
    display: none;
}

/* Chat Container */
.ai-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
    min-width: 0;
}

.ai-messages-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    min-width: 0;
}

/* Welcome Hero */
.ai-welcome-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 30px 20px;
    margin: auto;
    max-width: 780px;
    width: 100%;
    box-sizing: border-box;
}

.ai-welcome-badge {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(168, 85, 247, 0.25));
    border: 1px solid rgba(168, 85, 247, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a855f7;
    margin-bottom: 14px;
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.2);
}

.ai-welcome-heading {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.ai-welcome-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 24px 0;
    max-width: 600px;
}

.ai-quick-prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    width: 100%;
}

.ai-quick-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    text-align: right;
    transition: var(--transition);
    color: inherit;
    font-family: inherit;
}

.ai-quick-card:hover {
    border-color: #38bdf8;
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.15);
}

.ai-quick-card-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.ai-quick-card-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ai-quick-card-body strong {
    font-size: 0.88rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.ai-quick-card-body span {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* =========================================================================
   MODERN CHAT BUBBLES & MESSAGES SYSTEM (COPILOT / TELEGRAM / CHATGPT STYLE)
   ========================================================================= */

.ai-msg {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    transition: opacity 0.2s ease;
}

/* User Message: Elegant Modern Speech Bubble */
.ai-msg-user {
    justify-content: flex-end;
    align-self: flex-end;
    width: 100%;
}

.ai-bubble-user {
    max-width: min(620px, 84%);
    width: fit-content;
    min-width: 65px;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(14, 116, 144, 0.32), rgba(37, 99, 235, 0.42));
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
    color: #ffffff;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-sizing: border-box;
    transition: transform 0.15s ease;
}

html[dir="ltr"] .ai-bubble-user {
    border-radius: 18px 18px 18px 4px;
}

.ai-bubble-user:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.25);
}

.ai-bubble-user .ai-bubble-text {
    font-size: 0.92rem;
    line-height: 1.55;
    color: #ffffff;
}

.ai-bubble-user .ai-bubble-time {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.68);
    margin-top: 4px;
    text-align: end;
    font-family: var(--font-ui);
}

/* Assistant Message: Clean Modern Workspace Card */
.ai-msg-assistant {
    justify-content: flex-start;
    align-self: flex-start;
    gap: 10px;
    max-width: 96%;
    width: 100%;
}

.ai-msg-assistant .ai-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7, #8b5cf6);
    border: 1px solid rgba(139, 92, 246, 0.45);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.35);
}

.ai-msg-container {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-msg-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    padding: 0 2px;
}

.ai-msg-meta-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-msg-author {
    font-weight: 700;
    color: #38bdf8;
    font-size: 0.84rem;
}

.ai-role-pill {
    font-size: 0.62rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.ai-msg-time {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.ai-copy-response-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 2px 7px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.ai-copy-response-btn:hover {
    color: #38bdf8;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.ai-msg-assistant .ai-msg-body {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px 4px 18px 18px;
    padding: 12px 16px;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: anywhere;
    box-sizing: border-box;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

html[dir="ltr"] .ai-msg-assistant .ai-msg-body {
    border-radius: 4px 18px 18px 18px;
}

/* =========================================================================
   COMPACT COLLAPSIBLE TOOL STEPPER & SUMMARY
   ========================================================================= */

.ai-tool-live-wrapper {
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.ai-tools-accordion {
    margin-bottom: 8px;
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.5);
    overflow: hidden;
    transition: var(--transition);
}

.ai-tools-summary {
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    list-style: none;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.ai-tools-summary::-webkit-details-marker {
    display: none;
}

.ai-tools-summary:hover {
    background: rgba(168, 85, 247, 0.1);
    color: var(--text-primary);
}

.ai-tools-summary-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-tools-pulse-icon {
    font-size: 0.85rem;
}

.ai-tools-pill {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.ai-tools-pill.done {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.ai-tools-pill.active {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.ai-tools-chevron {
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.ai-tools-accordion[open] .ai-tools-chevron {
    transform: rotate(180deg);
}

.ai-tools-details-list {
    padding: 6px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-step-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.ai-step-card.active {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
}

.ai-step-card.done {
    border-color: rgba(16, 185, 129, 0.2);
}

.ai-step-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.ai-step-icon {
    font-size: 0.88rem;
    flex-shrink: 0;
}

.ai-step-label {
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    font-size: 0.76rem;
}

.ai-step-target {
    font-family: var(--font-code);
    font-size: 0.72rem;
    color: #38bdf8;
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: ltr;
    max-width: 260px;
}

.ai-step-status {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    flex-shrink: 0;
}

.ai-step-status.active {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    animation: ai-pulse 1.5s infinite;
}

.ai-step-status.done {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

/* =========================================================================
   MARKDOWN TYPOGRAPHY & CODE BLOCKS
   ========================================================================= */

.ai-msg-body h1, .ai-msg-body h2, .ai-msg-body h3, .ai-msg-body h4 {
    margin: 10px 0 6px 0;
    color: #38bdf8;
    line-height: 1.4;
}

.ai-msg-body p {
    margin: 6px 0;
}

.ai-msg-body ul, .ai-msg-body ol {
    margin: 6px 0;
    padding-inline-start: 20px;
}

.ai-msg-body li {
    margin-bottom: 4px;
}

.ai-msg-body blockquote, .ai-blockquote {
    margin: 8px 0;
    padding: 6px 12px;
    border-inline-start: 3px solid #38bdf8;
    background: rgba(56, 189, 248, 0.06);
    border-radius: 0 4px 4px 0;
    color: var(--text-secondary);
    font-style: normal;
}

html[dir="rtl"] .ai-msg-body blockquote, html[dir="rtl"] .ai-blockquote {
    border-radius: 4px 0 0 4px;
}

.ai-code-block {
    margin: 10px 0;
    border: 1px solid #1e293b;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #050811;
    direction: ltr;
    text-align: left;
}

.ai-code-header {
    background: #0d131f;
    padding: 4px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1e293b;
    font-size: 0.72rem;
    color: #94a3b8;
}

.ai-code-lang {
    font-weight: 700;
    text-transform: uppercase;
    color: #38bdf8;
    font-family: var(--font-code);
}

.ai-code-block pre {
    margin: 0;
    padding: 10px 12px;
    background: transparent !important;
    border: none !important;
    overflow-x: auto;
    font-family: var(--font-code);
    font-size: 0.84rem;
}

.ai-msg-body code {
    font-family: var(--font-code);
    font-size: 0.82rem;
    padding: 1px 5px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 4px;
    color: #38bdf8;
    direction: ltr;
}

.ai-copy-btn {
    background: rgba(30, 41, 59, 0.85);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: var(--transition);
}

.ai-copy-btn:hover {
    color: #ffffff;
    background: #2563eb;
}

/* Floating Scroll to Bottom Button */
.btn-ai-scroll-bottom {
    position: absolute;
    bottom: 65px;
    left: 50%;
    transform: translateX(-50%);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-ai-scroll-bottom:hover {
    background: var(--bg-card-hover);
    border-color: #38bdf8;
    color: #38bdf8;
    transform: translateX(-50%) translateY(-2px);
}

.btn-ai-scroll-bottom.hidden {
    display: none !important;
}

/* Live Thinking Status Bar */
.ai-live-status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(168, 85, 247, 0.08);
    border-top: 1px solid rgba(168, 85, 247, 0.2);
    font-size: 0.82rem;
    color: #c084fc;
}

.ai-status-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c084fc;
    box-shadow: 0 0 0 0 rgba(192, 132, 252, 0.7);
    animation: ai-pulse 1.5s infinite;
}

/* Input Dock */
.ai-input-dock {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-input-box-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#ai-prompt-input {
    flex: 1;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-family: var(--font-ui);
    font-size: 0.92rem;
    resize: none;
    max-height: 140px;
    min-height: 44px;
    line-height: 1.45;
    outline: none;
    transition: var(--transition);
    box-sizing: border-box;
}

#ai-prompt-input:focus {
    border-color: #a855f7;
    box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.25);
}

.btn-ai-send {
    background: linear-gradient(135deg, #38bdf8, #a855f7) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 10px 18px !important;
    height: 44px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-ai-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.35);
}

.btn-ai-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai-dock-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.ai-active-session-id {
    font-family: var(--font-code);
    color: #38bdf8;
    direction: ltr;
}

/* =========================================================================
   IPAD & TABLET RESPONSIVE OVERHAUL (768px - 1180px)
   ========================================================================= */

@media (max-width: 1180px) {
    /* Grids & Cards - Prevent squeezing and overflow */
    .monitor-kpi-grid, .kpi-grid, .bots-grid, .domains-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
        gap: 12px;
        width: 100%;
    }

    /* Tables */
    .table-container, .table-responsive {
        width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* All card text safety */
    .glass-card, .monitor-card, .table-container, .ai-chat-container {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* AI Agent on iPad & Tablet */
    .ai-agent-workspace {
        height: calc(100vh - 140px);
        max-height: calc(100dvh - 140px);
    }

    .ai-agent-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .ai-sessions-sidebar {
        position: absolute;
        top: 0;
        bottom: 0;
        z-index: 105;
        width: min(300px, 85vw);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
        background: var(--bg-surface);
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    }
    html[dir="rtl"] .ai-sessions-sidebar {
        right: 0;
        left: auto;
        transform: translateX(105%);
    }
    html[dir="ltr"] .ai-sessions-sidebar {
        left: 0;
        right: auto;
        transform: translateX(-105%);
    }
    .ai-sessions-sidebar.open {
        transform: translateX(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }
    .btn-sidebar-close {
        display: flex !important;
    }
    .ai-sidebar-backdrop {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 104;
        display: block;
        transition: opacity 0.2s;
    }
    .ai-sidebar-backdrop.hidden {
        display: none !important;
    }

    .ai-msg {
        max-width: 100%;
    }

    .ai-step-target {
        max-width: 180px;
    }
}

/* =========================================================================
   GOOGLE OAUTH AUTHENTICATION WIZARD & STATUS BADGES (curlHUB AI agent)
   ========================================================================= */

.ai-auth-badge-container {
    display: inline-flex;
    align-items: center;
}

.ai-auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    white-space: nowrap;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-auth-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background-color: var(--text-muted);
}

.ai-auth-badge.connected {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.ai-auth-badge.connected .ai-auth-status-dot {
    background-color: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.ai-auth-badge.connected:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
}

.ai-auth-badge.unauthenticated {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
    animation: ai-auth-pulse-glow 2.5s infinite;
}

.ai-auth-badge.unauthenticated .ai-auth-status-dot {
    background-color: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
}

.ai-auth-badge.unauthenticated:hover {
    background: rgba(245, 158, 11, 0.22);
    border-color: rgba(245, 158, 11, 0.6);
    transform: translateY(-1px);
}

@keyframes ai-auth-pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3); }
    50% { box-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }
}

/* Chat Area Warning Banner */
.ai-auth-warning-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.08));
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.ai-auth-warning-content {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.ai-auth-warning-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.ai-auth-warning-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.ai-auth-warning-text strong {
    font-size: 0.95rem;
    color: #fbbf24;
}

.ai-auth-warning-text span {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.btn-google-connect {
    background: #ffffff;
    color: #1f2937 !important;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    transition: var(--transition);
    white-space: nowrap;
}

.btn-google-connect:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.35);
}

/* Modal Box & Steps */
.ai-google-modal-box {
    max-width: 580px;
    width: 92%;
    padding: 0;
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

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

.ai-modal-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.google-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    flex-shrink: 0;
}

.ai-modal-content {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ai-auth-intro {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.ai-auth-intro strong {
    color: var(--text-primary);
}

.ai-step-flow-box {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.ai-step-flow-box:hover {
    background: var(--bg-subtle-hover);
    border-color: rgba(56, 189, 248, 0.3);
}

.ai-step-badge-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), #2563eb);
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}

.ai-step-flow-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.ai-step-flow-content h4 {
    margin: 0;
    font-size: 0.92rem;
    color: var(--text-primary);
    font-weight: 700;
}

.ai-step-flow-content p {
    margin: 0;
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.ai-auth-actions-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.btn-google-direct {
    background: #ffffff;
    color: #1f2937 !important;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: var(--transition);
    font-size: 0.86rem;
}

.btn-google-direct:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.ai-code-input-wrapper {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.ai-auth-code-input {
    flex: 1;
    min-width: 220px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-code);
    font-size: 0.86rem;
    direction: ltr;
    text-align: left;
    transition: var(--transition);
}

.ai-auth-code-input:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.btn-submit-code {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    font-weight: 700;
    font-size: 0.86rem;
    white-space: nowrap;
}

.ai-auth-error-msg {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--accent-danger);
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}

.ai-auth-terminal-hint {
    padding: 10px 14px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ai-auth-terminal-hint code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-primary);
    font-family: var(--font-code);
}

.ai-auth-terminal-hint a {
    color: var(--accent-primary);
    text-decoration: underline;
    cursor: pointer;
}

/* Spinner / Loading Box */
.ai-auth-state-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 12px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    text-align: center;
}

.ai-auth-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(56, 189, 248, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Success Box */
.ai-auth-success-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 10px;
    text-align: center;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-md);
}

.ai-success-check-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #10b981;
    color: #fff;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.ai-auth-success-box h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #34d399;
}

.ai-auth-success-box p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* LIGHT THEME OVERRIDES FOR AUTH COMPONENTS */
body.light-theme .ai-auth-badge.connected {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.45);
    color: #065f46;
}

body.light-theme .ai-auth-badge.unauthenticated {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.45);
    color: #92400e;
}

body.light-theme .ai-auth-warning-banner {
    background: #fffbeb;
    border-color: #fde68a;
}

body.light-theme .ai-auth-warning-text strong {
    color: #b45309;
}

body.light-theme .ai-auth-warning-icon {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body.light-theme .btn-google-connect,
body.light-theme .btn-google-direct {
    background: #ffffff;
    border: 1px solid #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

body.light-theme .ai-step-flow-box {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.light-theme .ai-step-flow-box:hover {
    background: #f1f5f9;
}

body.light-theme .ai-auth-terminal-hint {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}
