@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #0a0b0d;          /* Nero/grigio antracite Geopavia */
    --bg-secondary: #12141a;        /* Grigio scuro premium */
    --bg-surface: #1a1e26;          /* Superfici card */
    --bg-surface-hover: #252b36;    /* Stato hover */
    
    --text-primary: #ffffff;        /* Bianco per i testi principali */
    --text-secondary: #a0aec0;      /* Grigio chiaro */
    --text-muted: #5e6b7c;          /* Grigio scuro */
    
    --accent: #10b981;              /* Verde Geopavia */
    --accent-hover: #059669;        /* Verde scuro */
    --accent-glow: rgba(16, 185, 129, 0.15); /* Sfumatura verde */
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --border-color: #252b36;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    height: 100vh;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* LAYOUT CONTAINER */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* AUTHENTICATION VIEW */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at top right, var(--bg-secondary), var(--bg-primary));
    padding: 20px;
}

.auth-card {
    background: rgba(18, 20, 26, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 80px var(--accent-glow);
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

.auth-logo {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #a7f3d0, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-fast);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    box-shadow: none;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.error-message {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 15px;
    display: none;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--danger);
}

/* APP MAIN DASHBOARD */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-text {
    font-weight: 700;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #a5b4fc, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.badge-role {
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.75rem;
}

.nav-link {
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
}

.nav-dashboard-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.nav-dashboard-select:hover, .nav-dashboard-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* SPLIT PANEL VIEW (CHAT AREA) */
.main-workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* SIDEBAR - CONTRACT SELECTION */
.sidebar {
    width: 300px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.contract-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contract-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: left;
}

.contract-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.05);
}

.contract-item.active {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(19, 27, 46, 0.5));
    box-shadow: 0 4px 12px var(--accent-glow);
}

.contract-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.contract-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* CHAT CONTROLLER AREA */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    overflow: hidden;
    position: relative;
}

.chat-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(19, 27, 46, 0.5);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-active-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.chat-active-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

.welcome-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.message-bubble {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: slideUp 0.3s ease-out;
}

.message-bubble.user {
    align-self: flex-end;
}

.message-bubble.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-bubble.user .message-content {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-bubble.assistant .message-content {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    /* Il contenuto assistant è Markdown renderizzato: gli a-capo li fanno i blocchi. */
    white-space: normal;
}

/* Markdown renderizzato nelle bolle assistant */
.message-bubble.assistant .message-content p { margin: 0 0 6px; }
.message-bubble.assistant .message-content p:last-child { margin-bottom: 0; }
.message-bubble.assistant .message-content ul,
.message-bubble.assistant .message-content ol { margin: 4px 0 8px; padding-left: 22px; }
.message-bubble.assistant .message-content li { margin: 3px 0; }
.message-bubble.assistant .message-content h3,
.message-bubble.assistant .message-content h4,
.message-bubble.assistant .message-content h5 { margin: 8px 0 4px; font-size: 1rem; font-weight: 600; }
.message-bubble.assistant .message-content code {
    background: rgba(127, 127, 127, 0.15);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.85em;
}
.message-bubble.assistant .message-content .md-space { height: 6px; }
.message-bubble.assistant .message-content .md-table-wrap { overflow-x: auto; margin: 6px 0 8px; }
.message-bubble.assistant .message-content table {
    border-collapse: collapse;
    font-size: 0.85em;
    width: 100%;
}
.message-bubble.assistant .message-content th,
.message-bubble.assistant .message-content td {
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    text-align: left;
    white-space: nowrap;
}
.message-bubble.assistant .message-content th { background: rgba(127, 127, 127, 0.12); font-weight: 600; }

.message-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-bubble.user .message-meta {
    align-self: flex-end;
}

/* FONTI DELLA RISPOSTA (SOURCES) */
.sources-list {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.source-tag {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.source-tag:hover {
    background: rgba(99, 102, 241, 0.2);
}

/* CHAT INPUT AREA */
.chat-input-container {
    padding: 24px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.chat-input-form {
    display: flex;
    gap: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    transition: var(--transition-fast);
}

.chat-input-form:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 10px;
    resize: none;
    max-height: 120px;
}

.chat-send-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    align-self: flex-end;
}

.chat-send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

/* TYPING INDICATOR */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* PANEL RIGHT - INSPECTOR FONTI */
.inspector-panel {
    width: 320px;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.inspector-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.inspector-source-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 14px;
}

.source-card-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--accent);
    margin-bottom: 6px;
    font-weight: 600;
}

.source-card-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.source-card-snippet {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* DASHBOARD GRAFANA AREA */
.dashboard-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    overflow: hidden;
    position: relative;
    width: 100%;
    height: calc(100vh - 65px);
}

.dashboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

.dashboard-frame-container {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.grafana-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* ADMIN PANEL */
.admin-workspace {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: radial-gradient(circle at top right, var(--bg-secondary), var(--bg-primary));
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.admin-title {
    font-size: 1.8rem;
    font-weight: 700;
}

.admin-tabs {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.admin-tab {
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
}

.admin-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.admin-card {
    background: rgba(19, 27, 46, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    backdrop-filter: blur(10px);
}

.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

/* TABLES FOR LISTS */
.table-container {
    background: rgba(19, 27, 46, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 30px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th, .admin-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background: var(--bg-surface);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.action-link {
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    margin-right: 15px;
}

.action-link.danger {
    color: var(--danger);
}

/* MODAL STANDARD */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 550px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-weight: 700;
    font-size: 1.3rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ANIMATIONS */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* RESPONSIVE LAYOUT */
@media (max-width: 992px) {
    .main-workspace {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: 250px;
    }
    .inspector-panel {
        width: 100%;
        height: 200px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
}

/* GEOPAVIA BRANDING CUSTOMIZATIONS */
.brand-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    width: 100%;
}
.geopavia-logo-large {
    width: 280px;
    height: auto;
    max-width: 100%;
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.2));
}
.geopavia-logo-nav {
    width: 170px;
    height: auto;
    vertical-align: middle;
}
.assistant-badge {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 12px;
    display: inline-flex;
    align-items: center;
}
.logo-container {
    display: flex;
    align-items: center;
}

/* HIDE CHAT INSPECTOR TOGGLE ON DESKTOP */
.toggle-inspector-btn {
    display: none;
}
.inspector-panel-header {
    display: none;
}

/* RESPONSIVE LAYOUT FOR MOBILE AND TABLETS (< 768px) */
@media (max-width: 767px) {
    /* Main layout adjustment using 100dvh for mobile address bar compatibility */
    #app, #main-view {
        height: 100dvh !important;
    }

    .navbar {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .logo-container {
        flex: 1 1 auto;
    }
    .geopavia-logo-nav {
        width: 105px;
    }
    .assistant-badge {
        margin-left: 6px;
        font-size: 0.65rem;
        padding: 2px 4px;
    }
    .nav-actions {
        gap: 8px;
    }
    .user-badge {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    .badge-role {
        display: none; /* Hide role on mobile to save space */
    }
    .nav-link {
        font-size: 0.8rem;
    }

    /* Vertical stack for chat workspace */
    #chat-workspace.main-workspace {
        flex-direction: column !important;
        height: calc(100dvh - 56px) !important;
        min-height: 0;
        overflow: hidden;
    }

    /* Sidebar contracts as scrollable horizontal bar */
    #chat-workspace .sidebar {
        width: 100% !important;
        height: auto !important;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        background-color: var(--bg-secondary);
        flex-shrink: 0;
    }
    #chat-workspace .sidebar-header {
        padding: 6px 12px;
        border-bottom: none;
    }
    #chat-workspace .sidebar-title {
        font-size: 0.75rem;
        text-transform: uppercase;
        color: var(--text-secondary);
        letter-spacing: 0.05em;
    }
    #chat-workspace .contract-list {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 4px 12px 10px 12px;
        gap: 8px;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    #chat-workspace .contract-item {
        flex: 0 0 170px;
        padding: 8px 10px;
        border-radius: var(--radius-sm);
        white-space: normal;
        transform: none !important;
        box-shadow: none !important;
    }
    #chat-workspace .contract-name {
        font-size: 0.8rem;
        margin-bottom: 2px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    #chat-workspace .contract-desc {
        font-size: 0.7rem;
        -webkit-line-clamp: 1;
    }

    /* Chat Area filling remaining space */
    #chat-workspace .chat-container {
        flex: 1 !important;
        min-height: 0;
        display: flex;
        flex-direction: column;
        width: 100% !important;
    }
    #chat-workspace .chat-header {
        padding: 8px 12px;
    }
    #chat-workspace .chat-active-title {
        font-size: 0.9rem;
    }
    #chat-workspace .chat-active-desc {
        font-size: 0.7rem;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    #dashboard-workspace {
        height: calc(100dvh - 56px) !important;
    }

    /* Inspector toggle button visible on mobile */
    .toggle-inspector-btn {
        display: inline-flex !important;
        align-items: center;
        gap: 4px;
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        padding: 6px 10px;
        border-radius: var(--radius-sm);
        font-size: 0.75rem;
        font-weight: 500;
        cursor: pointer;
        transition: var(--transition-fast);
        margin-left: 8px;
        flex-shrink: 0;
    }
    .toggle-inspector-btn:hover {
        border-color: var(--accent);
        background: var(--bg-surface-hover);
    }

    /* Messages area adjustments */
    #chat-workspace .chat-history {
        padding: 12px;
        gap: 16px;
        flex: 1 !important;
        overflow-y: auto;
    }
    #chat-workspace .message-bubble {
        max-width: 90% !important;
    }
    #chat-workspace .message-content {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
    #chat-workspace .chat-welcome,
    #chat-workspace .dashboard-empty {
        padding: 20px;
    }
    #chat-workspace .welcome-icon {
        font-size: 2.5rem;
        margin-bottom: 12px;
    }
    #chat-workspace .welcome-title {
        font-size: 1.2rem;
    }

    /* Input area adjustments */
    #chat-workspace .chat-input-container {
        padding: 10px 12px;
    }
    #chat-workspace .chat-input-form {
        padding: 4px 8px;
        border-radius: var(--radius-md);
        gap: 8px;
    }
    #chat-workspace .chat-input {
        font-size: 0.85rem;
        padding: 6px;
        max-height: 80px;
    }
    #chat-workspace .chat-send-btn {
        width: 36px;
        height: 36px;
        border-radius: var(--radius-sm);
    }

    /* Inspector as a sliding drawer on mobile */
    #chat-workspace .inspector-panel {
        position: fixed !important;
        right: -100% !important;
        top: 0 !important;
        width: 80% !important;
        max-width: 320px !important;
        height: 100dvh !important;
        z-index: 1200 !important;
        background-color: var(--bg-secondary) !important;
        border-left: 1px solid var(--border-color) !important;
        border-top: none !important;
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6) !important;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        padding: 16px !important;
        display: flex !important;
        flex-direction: column !important;
    }
    #chat-workspace .inspector-panel.open {
        right: 0 !important;
    }
    #chat-workspace .inspector-panel-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-bottom: 12px !important;
        border-bottom: 1px solid var(--border-color) !important;
        padding-bottom: 6px !important;
    }
    #chat-workspace .inspector-title {
        font-size: 0.95rem !important;
        margin-bottom: 0 !important;
        border-bottom: none !important;
    }
    #chat-workspace .inspector-close-btn {
        background: transparent !important;
        border: none !important;
        color: var(--text-secondary) !important;
        font-size: 1.6rem !important;
        cursor: pointer !important;
        line-height: 1 !important;
        padding: 0 4px !important;
    }
}
