/* ═══════════════════════════════════════════════════════════════
           HYDROFLOW DYNAMICS AESTHETIC STYLE SHEET
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* Light Theme - Violet / Lavender Scheme */
    --bg-darker: #F1EDFA;
    --bg-main: #FAF9FF;
    --surface: rgba(255, 255, 255, 0.75);
    --surface-solid: #FFFFFF;
    --surface-hover: rgba(243, 239, 253, 0.9);
    --border: rgba(124, 58, 237, 0.16);
    --border-glow: rgba(124, 58, 237, 0.4);
    --border-light: rgba(124, 58, 237, 0.08);

    /* Accents & States */
    --accent: #7C3AED; /* Violet */
    --accent-light: #9333EA;
    --accent-dim: rgba(124, 58, 237, 0.07);
    --accent-glow: rgba(124, 58, 237, 0.15);

    --cyan: #0891B2; /* Cyan */
    --cyan-dim: rgba(8, 145, 178, 0.07);
    --cyan-glow: rgba(8, 145, 178, 0.15);

    --green: #059669; /* Emerald Green */
    --green-dim: rgba(5, 150, 105, 0.07);
    --green-glow: rgba(5, 150, 105, 0.15);

    --red: #DC2626; /* Red */
    --red-dim: rgba(220, 38, 38, 0.07);
    
    --orange: #D97706; /* Orange */
    --orange-dim: rgba(217, 119, 6, 0.07);

    --text: #1E1B4B; /* Deep Indigo text */
    --text-muted: #6B7280;
    --text-dim: #4B5563;

    --user-bg: #EEF2F6;
    --agent-bg: #FFFFFF;
    --tool-bg: #F3F4F6;
    --tool-border: #E5E7EB;
    --confirm-bg: #ECFDF5;
    --confirm-border: #A7F3D0;

    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    --shadow: 0 4px 20px rgba(124, 58, 237, 0.04);
    --shadow-lg: 0 10px 40px rgba(124, 58, 237, 0.08);
}

/* Global Resets */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(124, 58, 237, 0.04) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.04) 0, transparent 50%);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

/* ════════════════ STRUCTURE ════════════════ */

#app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Global Header */
#app-header {
    height: 64px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    flex-shrink: 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    font-size: 24px;
    animation: rotate-slow 15s infinite linear;
}

@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.brand-text h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.brand-text p {
    font-size: 9.5px;
    color: var(--cyan);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 1px;
}

/* Top Navigation Tabs */
.app-nav {
    display: flex;
    gap: 8px;
    background: rgba(124, 58, 237, 0.05);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    color: var(--text);
    background: var(--surface-solid);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
}

.tab-icon {
    font-size: 13px;
}

/* Main Panel Viewports */
#app-main {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.viewport-panel {
    display: none;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.viewport-panel.active {
    display: flex;
    flex-direction: column;
}

.viewport-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.viewport-title-bar {
    margin-bottom: 28px;
}

.viewport-title-bar h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.viewport-title-bar p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
    max-width: 800px;
    line-height: 1.5;
}

/* ════════════════ AGENT TAB VIEWPORT ════════════════ */

.subview {
    display: none;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.subview.active {
    display: flex;
    flex-direction: column;
}

/* Subview A: Agent Landing Grid */
#agent-landing-view {
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    overflow-y: auto;
}

.landing-welcome {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 8px;
    max-width: 600px;
    line-height: 1.6;
    margin-left: auto;
    margin-right: auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1040px;
    width: 100%;
    margin: 0 auto;
}

.feature-card {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 24px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    transition: background 0.25s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-glow);
    background: var(--surface-hover);
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.06), 0 0 15px rgba(124, 58, 237, 0.1);
}

.feature-card:hover::before {
    background: linear-gradient(90deg, var(--cyan) 0%, var(--accent) 100%);
}

.feature-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Icon thematic colors */
.font-eng { color: #A78BFA; background: rgba(167, 139, 250, 0.07); border-color: rgba(167, 139, 250, 0.2); }
.font-mfg { color: #F59E0B; background: rgba(245, 158, 11, 0.07); border-color: rgba(245, 158, 11, 0.2); }
.font-org { color: #3B82F6; background: rgba(59, 130, 246, 0.07); border-color: rgba(59, 130, 246, 0.2); }
.font-trb { color: #EF4444; background: rgba(239, 68, 68, 0.07); border-color: rgba(239, 68, 68, 0.2); }
.font-sup { color: #10B981; background: rgba(16, 185, 129, 0.07); border-color: rgba(16, 185, 129, 0.2); }
.font-sls { color: #06B6D4; background: rgba(6, 182, 212, 0.07); border-color: rgba(6, 182, 212, 0.2); }

.feature-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
    flex-grow: 1;
}

.feature-badge {
    align-self: flex-start;
    font-size: 10px;
    font-weight: 600;
    color: var(--cyan);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 16px;
    letter-spacing: 0.02em;
}

/* Subview B: Agent Chat Workspace */
#chat-workspace {
    flex: 1;
    display: flex;
    flex-direction: row;
    height: 100%;
    min-height: 0;
    position: relative;
}

#chat-main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: transparent;
    height: 100%;
}

.chat-header {
    height: 56px;
    border-bottom: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-left h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.status-dot.running {
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan);
    animation: blink-dot 1.2s infinite;
}

.status-dot.idle {
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
}

.status-dot.error {
    background: var(--red);
    box-shadow: 0 0 8px var(--red);
}

@keyframes blink-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Messages area */
#messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#messages::-webkit-scrollbar {
    width: 6px;
}

#messages::-webkit-scrollbar-track {
    background: transparent;
}

#messages::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.msg-row {
    display: flex;
    gap: 16px;
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
    animation: slide-up-msg 0.25s ease;
}

@keyframes slide-up-msg {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-row.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 2px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.avatar.user-av {
    background: linear-gradient(135deg, var(--accent) 0%, #6D28D9 100%);
}

.avatar.agent-av {
    background: linear-gradient(135deg, #1E3A8A 0%, #0F172A 100%);
    border: 1px solid var(--border);
}

.bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    line-height: 1.65;
    word-break: break-word;
}

.bubble.user-bubble {
    background: var(--user-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius) var(--radius) 4px var(--radius);
}

.bubble.agent-bubble {
    background: var(--agent-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius) var(--radius) var(--radius) 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Markdown parsing specs */
.bubble h1, .bubble h2, .bubble h3 {
    margin: 1em 0 0.5em;
    color: var(--text);
    font-weight: 600;
}
.bubble h2 { font-size: 15px; }
.bubble h3 { font-size: 13.5px; }
.bubble p { margin-bottom: 0.6em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { padding-left: 1.4em; margin-bottom: 0.6em; }
.bubble li { margin-bottom: 0.3em; }

.bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
    font-size: 12px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    border: 1px solid var(--border);
}
.bubble th, .bubble td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}
.bubble th {
    background: rgba(124, 58, 237, 0.06);
    font-weight: 600;
    color: var(--text);
}
.bubble code {
    background: rgba(124, 58, 237, 0.06);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: var(--cyan);
}
.bubble pre {
    background: #090E1D;
    padding: 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid var(--border-light);
}
.bubble pre code {
    background: none;
    padding: 0;
    color: var(--text-dim);
    font-size: 11.5px;
}

/* System cards & Tool events */
.sys-row {
    padding: 8px 0 8px 48px;
    font-size: 11.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
}

.tool-card, .tool-confirmed-card {
    margin: 12px auto;
    padding-left: 48px;
    max-width: 850px;
    width: 100%;
}

.tool-card-inner, .tool-confirmed-inner {
    background: var(--tool-bg);
    border: 1px solid var(--tool-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12.5px;
}

.tool-card-inner .tool-name, .tool-confirmed-inner .tool-name {
    font-weight: 600;
    color: var(--cyan);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tool-badge {
    font-size: 9px;
    color: var(--green);
    background: var(--green-dim);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 700;
}

.tool-card-inner .tool-meta, .tool-confirmed-inner .tool-meta {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 4px;
    font-family: 'JetBrains Mono', monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Tool Confirmation Box */
.confirm-card {
    margin: 16px auto;
    padding-left: 48px;
    max-width: 850px;
    width: 100%;
}

.confirm-card-inner {
    background: var(--confirm-bg);
    border: 1px solid var(--confirm-border);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.confirm-card-inner h4 {
    font-size: 13px;
    color: var(--green);
    margin-bottom: 10px;
}

.tool-detail {
    background: rgba(124, 58, 237, 0.04);
    border-radius: 6px;
    padding: 10px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text);
    margin-bottom: 12px;
    overflow-x: auto;
    border: 1px solid rgba(124, 58, 237, 0.16);
    white-space: pre-wrap;
}

.deny-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 12px;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s ease;
}

.deny-input:focus {
    border-color: var(--border-glow);
}

.confirm-actions {
    display: flex;
    gap: 8px;
}

/* Agent Thinking Row */
.thinking-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 8px 48px;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
}

.thinking-dots span {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--cyan);
    margin: 0 2px;
    animation: bounce-dots 1.2s infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce-dots {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-4px); opacity: 1; }
}

/* Chat Input Bar */
#chat-input-area {
    padding: 16px 24px 20px;
    background: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#suggestion-hints {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
}

.suggestion-hint-pill {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-hint-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.input-wrap-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 14px;
}

.input-wrap-container:focus-within {
    border-color: var(--border-glow);
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.1);
}

#user-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-size: 13.5px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    outline: none;
    padding: 6px 0;
}

#send-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--cyan) 0%, var(--accent) 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

#send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#send-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.25);
}

.input-hint {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
}

/* Collapsible Right Session Drawer */
#session-metadata-drawer {
    width: 320px;
    border-left: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    display: none;
    flex-direction: column;
    height: 100%;
    z-index: 50;
    flex-shrink: 0;
}

#session-metadata-drawer.active {
    display: flex;
}

.drawer-header {
    height: 56px;
    border-bottom: 1px solid var(--border-light);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-header h3 {
    font-size: 13.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}

#btn-close-drawer {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.drawer-section h4 {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cyan);
    margin-bottom: 10px;
}

.session-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.session-stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xs);
    padding: 10px 8px;
    text-align: center;
}

.session-stat-card .stat-label {
    display: block;
    font-size: 9.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.session-stat-card .stat-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.meta-details-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meta-row {
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.01);
    border-radius: 4px;
    border-left: 2px solid var(--border);
}

.meta-lbl {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.meta-val {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-dim);
    margin-top: 2px;
    word-break: break-all;
}

/* Event log inside drawer */
.live-logger-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 250px;
}

.event-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.event-log-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot-live {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--green);
}

#event-log-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 9px;
    cursor: pointer;
}

#event-log {
    flex: 1;
    background: rgba(124, 58, 237, 0.02);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 8px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px;
    max-height: 300px;
}

.log-placeholder {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 24px 0;
}

.ev-entry {
    padding: 6px 8px;
    border-radius: var(--radius-xs);
    margin-bottom: 6px;
    border-left: 2px solid;
    animation: log-in 0.15s ease;
}

@keyframes log-in {
    from { opacity: 0; transform: translateX(4px); }
    to { opacity: 1; transform: translateX(0); }
}

.ev-entry .ev-type {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 8.5px;
    margin-bottom: 2px;
}
.ev-entry .ev-data {
    color: var(--text-dim);
}
.ev-entry .ev-ts {
    font-size: 8px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 2px;
}

/* Log entry coloring */
.ev-text_delta { border-color: var(--cyan); background: rgba(6, 182, 212, 0.05); }
.ev-text_delta .ev-type { color: var(--cyan); }
.ev-thinking { border-color: var(--accent); background: rgba(139, 92, 246, 0.05); }
.ev-thinking .ev-type { color: var(--accent); }
.ev-tool_use { border-color: var(--cyan); background: rgba(6, 182, 212, 0.05); }
.ev-tool_use .ev-type { color: var(--cyan); }
.ev-tool_result { border-color: var(--green); background: rgba(16, 185, 129, 0.05); }
.ev-tool_result .ev-type { color: var(--green); }
.ev-tool_confirmation_required { border-color: var(--orange); background: rgba(245, 158, 11, 0.05); }
.ev-tool_confirmation_required .ev-type { color: var(--orange); }
.ev-tool_confirmed { border-color: var(--green); background: rgba(16, 185, 129, 0.05); }
.ev-tool_confirmed .ev-type { color: var(--green); }
.ev-user_message { border-color: var(--accent); background: rgba(139, 92, 246, 0.05); }
.ev-user_message .ev-type { color: var(--accent); }
.ev-status { border-color: var(--text-muted); background: rgba(255, 255, 255, 0.02); }
.ev-status .ev-type { color: var(--text-muted); }
.ev-done { border-color: var(--green); background: rgba(16, 185, 129, 0.05); }
.ev-done .ev-type { color: var(--green); }
.ev-error { border-color: var(--red); background: rgba(239, 68, 68, 0.05); }
.ev-error .ev-type { color: var(--red); }
.ev-model_request_end { border-color: var(--cyan); background: rgba(6, 182, 212, 0.05); }
.ev-model_request_end .ev-type { color: var(--cyan); }
.ev-custom_tool_result { border-color: var(--cyan); background: rgba(6, 182, 212, 0.05); }
.ev-custom_tool_result .ev-type { color: var(--cyan); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-xs);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    font-family: inherit;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-dim);
    border-color: var(--border-light);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--cyan);
    color: var(--text);
}

.btn-danger {
    background: rgba(220, 38, 38, 0.08);
    color: #991B1B;
    border-color: rgba(220, 38, 38, 0.2);
}

.btn-danger:hover {
    background: rgba(220, 38, 38, 0.16);
    border-color: rgba(220, 38, 38, 0.3);
}

.btn-success {
    background: rgba(16, 185, 129, 0.08);
    color: #065F46;
    border-color: rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.35);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 10.5px;
}


/* ════════════════ GLOBAL METADATA TAB VIEWPORT ════════════════ */

.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.telemetry-card {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.telemetry-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.card-purple::before { background: var(--accent); }
.card-cyan::before { background: var(--cyan); }
.card-green::before { background: var(--green); }
.card-orange::before { background: var(--orange); }

.telemetry-card-hdr {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.telemetry-icon {
    font-size: 18px;
}

.telemetry-card-hdr h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.telemetry-number {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
}

.telemetry-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Detail columns */
.telemetry-details-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .telemetry-details-grid {
        grid-template-columns: 1fr;
    }
}

.details-section-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.details-section-card h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.section-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Feature custom progress chart */
.feature-chart-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-label {
    width: 110px;
    font-size: 12px;
    color: var(--text-dim);
    text-align: right;
}

.chart-bar-wrapper {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.1, 1, 0.1, 1);
}

.bar-purple { background: var(--accent); }
.bar-orange { background: var(--orange); }
.bar-blue { background: #3B82F6; }
.bar-red { background: var(--red); }
.bar-green { background: var(--green); }
.bar-cyan { background: var(--cyan); }

.chart-val {
    width: 30px;
    font-size: 12px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
}

/* Telemetry lists */
.telemetry-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.t-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    font-size: 12.5px;
}

.t-row:last-child {
    border-bottom: none;
}

.t-row span:first-child {
    color: var(--text-dim);
}

.t-status {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.t-status.active {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.t-val {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
}


/* ════════════════ SERVER TAB VIEWPORT ════════════════ */

.server-viewport-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 1000px) {
    .server-viewport-layout {
        grid-template-columns: 1fr;
    }
}

.server-config-panel {
    display: flex;
    flex-direction: column;
}

.config-table-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
}

.config-row {
    display: grid;
    grid-template-columns: 1.2fr 1.8fr;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 13px;
    align-items: center;
}

.config-row:last-child {
    border-bottom: none;
}

.config-row.header-row {
    font-weight: 700;
    color: var(--cyan);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.param-name {
    color: var(--text-muted);
    font-weight: 500;
}

.param-value {
    color: var(--text);
    line-height: 1.4;
}

.code-font {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--cyan);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--green);
}

.pulse-green-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: sonar-pulse 1.5s infinite;
}

@keyframes sonar-pulse {
    0% { transform: scale(0.9); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.6; }
    100% { transform: scale(0.9); opacity: 1; }
}

/* Server animated Map panel */
.server-map-panel {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.map-header {
    margin-bottom: 20px;
}

.map-header h3 {
    font-size: 15px;
    font-weight: 700;
}

.map-header p {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.map-header code {
    color: var(--cyan);
    font-family: 'JetBrains Mono', monospace;
}

/* Animated radar map canvas */
.animated-map-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #FAF9FF;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(124, 58, 237, 0.03), 0 0 10px rgba(124, 58, 237, 0.06);
}

/* Radar scan sweeping line overlay (pure CSS) */
.radar-scanline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: conic-gradient(from 0deg at 50% 50%, rgba(124, 58, 237, 0.1) 0deg, rgba(124, 58, 237, 0.02) 90deg, transparent 180deg);
    animation: scan-rotate 5s linear infinite;
    z-index: 2;
}

@keyframes scan-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Telemetry overlays text */
.map-overlay {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 8px;
    color: rgba(124, 58, 237, 0.8);
    line-height: 1.4;
    pointer-events: none;
    z-index: 3;
}

.map-overlay-top-left { top: 12px; left: 12px; }
.map-overlay-top-right { top: 12px; right: 12px; text-align: right; }
.map-overlay-bottom-left { bottom: 12px; left: 12px; }
.map-overlay-bottom-right { bottom: 12px; right: 12px; text-align: right; }

.ticker-text {
    animation: text-flicker 2s infinite;
}

@keyframes text-flicker {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.3; }
}

/* SVG Radar design */
.radar-svg {
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
    position: relative;
}

/* Keyframes animations for Map SVG components */
#radar-sweep-hand {
    transform-origin: 145px 315px;
    animation: scan-rotate 5s linear infinite;
}

.radar-glow {
    animation: pulse-glow 3s infinite ease-in-out;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.15); opacity: 0.7; }
}

.radar-ping-ring {
    transform-origin: center;
    animation: ring-expand 2.5s infinite linear;
}

.radar-ping-ring-2 {
    transform-origin: center;
    animation: ring-expand 2.5s infinite linear;
    animation-delay: 1.25s;
}

@keyframes ring-expand {
    0% { transform: scale(0.1); opacity: 0; }
    15% { opacity: 0.8; }
    100% { transform: scale(2.4); opacity: 0; }
}

.aux-ping {
    transform-origin: center;
    animation: aux-pulse 3s infinite ease-in-out;
}

@keyframes aux-pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.2; }
    50% { transform: scale(1.5); opacity: 0.6; }
}


/* ════════════════ OTHER DETAILS & OVERLAYS ════════════════ */

#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(245, 243, 255, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(8, 145, 178, 0.1);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 16px;
    font-weight: 500;
}

/* Toast */
#toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(239, 68, 68, 0.95);
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: var(--shadow-lg);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    display: none;
    z-index: 10000;
    max-width: 400px;
}

#toast.success {
    background: rgba(16, 185, 129, 0.95);
    border-color: rgba(16, 185, 129, 0.4);
}

/* Utility / hiding classes */
.hidden {
    display: none !important;
}


/* ════════════════ SESSION HISTORY SIDEBAR ════════════════ */

#session-history-sidebar {
    width: 250px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    animation: slide-in-sidebar 0.3s ease;
}

@keyframes slide-in-sidebar {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

#session-history-sidebar .sidebar-header {
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#session-history-sidebar .sidebar-header h3 {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
}

#session-history-sidebar .sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#session-history-sidebar .sidebar-content::-webkit-scrollbar {
    width: 4px;
}

#session-history-sidebar .sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 2px;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.session-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background-color 0.2s ease;
}

.session-item:hover {
    background: var(--surface-hover);
    border-color: var(--border-glow);
    transform: translateX(2px);
}

.session-item.active {
    background: var(--accent-dim);
    border-color: var(--border-glow);
    color: var(--accent);
    box-shadow: var(--shadow);
}

.session-item.active::before {
    background-color: var(--accent);
}

.session-item-name {
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    padding-right: 8px;
    color: var(--text-dim);
}

.session-item.active .session-item-name {
    color: var(--text);
    font-weight: 600;
}

.session-item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.session-item:hover .session-item-delete {
    opacity: 0.7;
}

.session-item-delete:hover {
    opacity: 1 !important;
    background: rgba(220, 38, 38, 0.1);
    color: var(--red);
}

.sidebar-loading, .sidebar-empty, .sidebar-error {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding: 24px 8px;
}

.sidebar-error {
    color: var(--red);
}


/* ════════════════ CLEAN SLATE WELCOME BOX ════════════════ */

.welcome-box {
    margin: auto;
    max-width: 480px;
    text-align: center;
    padding: 32px 24px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: fadeIn 0.4s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.welcome-box-icon {
    font-size: 36px;
    animation: rotate-slow 20s infinite linear;
}

.welcome-box h3 {
    font-size: 16.5px;
    font-weight: 700;
    color: var(--text);
}

.welcome-box p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}