/* === TotalFlow CRM Stylesheet v5.4 === */

/* --- 1. Root Variables & Global Setup --- */
:root {
    --primary-color: #4361ee;
    --secondary-color: #6b7280;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --accent-color: #facc15;

    --bs-body-bg: #010409;
    --bs-body-color: #c9d1d9;
    --sidebar-bg: #0d1117;
    --card-bg: #0d1117;
    --header-bg: #0d1117;
    --menu-hover-bg: rgba(173, 186, 199, 0.1);
    --heading-text: #e6edf3;
    --light-text: #8b949e;
    --bs-border-color: #30363d;
    --border-color-2: #4b5563;
    --input-bg: #010409;
    --input-border: #30363d;
    --input-text: #c9d1d9;
    --input-placeholder: #6e7681;
    --bs-link-color: #60a5fa;
    --bs-link-hover-color: #82b5fb;

    --border-radius: 0.5rem;
    --border-radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.15);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.25);
    --transition-speed: 0.25s;
}

body.light-mode {
    --bs-body-bg: #f4f7fc;
    --bs-body-color: #212529;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --header-bg: #ffffff;
    --menu-hover-bg: #e9ecef;
    --heading-text: #343a40;
    --light-text: #6c757d;
    --bs-border-color: #dee2e6;
    --border-color-2: #d1d5db;
    --input-bg: #ffffff;
    --input-border: #ced4da;
    --input-text: #212529;
    --input-placeholder: #6c757d;
    --bs-link-color: #0d6efd;
    --bs-link-hover-color: #0a58ca;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter Tight', sans-serif; }
html { height: 100%; }
/* styles.css - AFTER */
body { 
  background-color: var(--bs-body-bg); 
  color: var(--bs-body-color); 
  font-size: 14px; 
  line-height: 1.6; 
  height: 100vh; 
  /* The overflow: hidden; property has been removed. */
  transition: background-color var(--transition-speed), color var(--transition-speed); 
}
.hidden {
  display: none !important;
}
a { color: var(--bs-link-color); text-decoration: none; }
a:hover { color: var(--bs-link-hover-color); }


/* =================================== */
/* === 2. AUTHENTICATION SCREEN    === */
/* =================================== */
body.auth-active {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 15px;
}
body.auth-active.light-mode {
    background-color: #f8f9fa;
}

#authContainer {
    width: 100%;
}
#authContainer .container.auth {
    width: 100%;
    max-width: 450px;
    background: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 35px 50px;
    margin: 20px auto;
    position: relative;
    overflow: visible;
}
.container.auth::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--primary-color);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}
.app-logo {
    display: block;
    margin: 0 auto 30px;
    max-width: 170px;
}
.container.auth h1.title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
    color: var(--heading-text);
}
.container.auth h1.title strong {
    color: var(--primary-color);
}
.google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    background: var(--input-bg);
    color: var(--input-text);
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 25px;
    cursor: pointer;
    transition: background-color var(--transition-speed), box-shadow var(--transition-speed);
}
.google-signin-btn:hover {
    background-color: var(--menu-hover-bg);
}
.google-signin-btn img {
    width: 18px;
    height: 18px;
}
.separator {
    display: flex;
    align-items: center;
    color: var(--light-text);
    font-size: 13px;
    margin: 0 5px 25px;
}
.separator::before, .separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-color-2);
}
.separator span {
    margin: 0 15px;
    font-weight: 500;
}
.form-group {
    margin-bottom: 22px;
    position: relative;
}
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--bs-body-color);
    margin-bottom: 8px;
}
.form-group .input-wrapper {
    position: relative;
}
.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    background-color: var(--input-bg);
    color: var(--input-text);
    font-size: 15px;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}
.form-group input[type="password"] {
    padding-right: 45px;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 25%, transparent);
}
.password-toggle-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--light-text);
}
.password-toggle-icon:hover {
    color: var(--primary-color);
}
.action-link {
    text-align: right;
    margin-bottom: 22px;
    margin-top: -10px;
}
.action-link a {
    font-weight: 500;
    font-size: 13px;
}
.container.auth .btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

.container.auth .btn:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--primary-color) 85%, black);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px color-mix(in srgb, var(--primary-color) 25%, transparent);
}
.container.auth .btn:disabled {
    background-color: var(--secondary-color);
    opacity: 0.65;
    cursor: not-allowed;
}
.spinner-border-sm {
    display: none;
    width: 1em;
    height: 1em;
    border: .2em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: .75s linear infinite spinner-border;
}
@keyframes spinner-border { to { transform: rotate(360deg); } }

.btn.loading .spinner-border-sm { display: inline-block; }
.btn.loading .btn-text { opacity: 0; }
.btn.loading { pointer-events: none; }

.feedback-message {
    padding: 10px 15px;
    margin-top: 15px;
    border-radius: var(--border-radius);
    font-size: 14px;
    text-align: left;
    border: 1px solid transparent;
    display: none; /* JS will add .show */
    align-items: center;
    gap: 8px;
}
.feedback-message.show { display: flex; }
.feedback-message.success { background-color: color-mix(in srgb, var(--success-color) 15%, transparent); color: var(--success-color); border-color: color-mix(in srgb, var(--success-color) 30%, transparent); }
.feedback-message.error { background-color: color-mix(in srgb, var(--danger-color) 15%, transparent); color: var(--danger-color); border-color: color-mix(in srgb, var(--danger-color) 30%, transparent); }

.switch-view {
    text-align: center;
    font-size: 14px;
    color: var(--light-text);
    margin-top: 15px;
}
.switch-view a {
    color: var(--bs-link-color);
    font-weight: 600;
}


/* =================================== */
/* === 3. APPLICATION SHELL        === */
/* =================================== */
#appWrapper { display: flex; height: 100vh; }
.sidebar { width: 240px; background-color: var(--sidebar-bg); border-right: 1px solid var(--bs-border-color); display: flex; flex-direction: column; padding: 1.5rem 0; flex-shrink: 0; transition: background-color var(--transition-speed), border-color var(--transition-speed); }
.sidebar-header {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--bs-border-color);
}
.sidebar-logo { height: 70px; margin-right: 10.75rem; }
.sidebar-title { font-weight: 600; font-size: 1.2rem; color: var(--heading-text); }
/* in styles.css, REPLACE the old rule */

.sidebar-nav .nav-link.active {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    font-weight: 600;
    /* The box-shadow property has been removed */
}
.sidebar-nav ul { list-style: none; }
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.5rem;
    margin: 0.1rem 1rem;
    border-radius: var(--border-radius);
    color: var(--light-text);
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s; /* Removed transform and border-left-color from transition */
    /* border-left property removed */
}

.sidebar-nav .nav-link i { margin-right: 1rem; width: 20px; text-align: center; font-size: 1.1rem; }
.sidebar-nav .nav-link span {
    white-space: normal;
    line-height: 1.4;
}

.sidebar-nav .nav-link:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
    /* transform property removed */
}
.sidebar-nav .nav-link.active {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    font-weight: 600;
    /* border-left-color property removed */
}
/* --- MODIFICATION START: Enhanced Centered & Styled Settings Link --- */
/* --- 7. SIDEBAR FOOTER (Revised for Dropdown) --- */

.sidebar-footer {
    padding: 1rem;
    margin-top: auto;
    border-top: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Container for the new dropdown to position the menu correctly */
.footer-dropdown-container {
    position: relative; 
    width: 100%;
}

/* This styles the trigger button ("Options") and the FlowCore AI button */
.sidebar-footer .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.6rem 1rem;
    margin: 0;
    background-color: var(--menu-hover-bg);
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    color: var(--light-text);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.sidebar-footer .nav-link:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #FFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

.sidebar-footer .nav-link i {
    margin-right: 0.75rem;
}

.footer-logo-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    object-fit: contain;
}

/* The dropdown menu itself */
.footer-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 8px); /* Position it above the button */
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    min-width: 100%;
    animation: fadeIn 0.2s ease;
}

/* Links inside the dropdown */
.footer-dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--bs-body-color);
    font-weight: 500;
    white-space: nowrap;
}

.footer-dropdown-link:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
}

.footer-dropdown-link i.fa-fw {
    width: 1.2em;
    text-align: center;
}

/* This is the container for the Upgrade button that is shown/hidden */
#upgradeBtnContainer {
    width: 100%;
}

/* This styles the "Upgrade Plan" button itself */
.btn-upgrade-plan {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: none;
    font-weight: 600;
    font-size: 1rem;
    color: #ffffff;
    cursor: pointer;
    background: linear-gradient(90deg, #4285F4, #9B59B6);
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-upgrade-plan:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    filter: brightness(1.1);
}
/* Incolla questo codice alla fine del tuo file styles.css */

/* --- CORREZIONE ALLINEAMENTO HEADER --- */

/* 1. Imposta un'altezza coerente per entrambe le intestazioni per garantire che i loro bordi inferiori si allineino. */
.top-header,
.sidebar-header {
    height: 70px;
    box-sizing: border-box;
}

/* 2. Rimuovi il padding verticale principale dalla sidebar che spinge il contenuto verso il basso. */
.sidebar {
    padding-top: 0;
    padding-bottom: 0;
}

/* 3. Aggiungi padding all'area di navigazione per ripristinare la spaziatura verticale. */
.sidebar-nav {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* styles.css - AFTER */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.top-header {
    /* FIX: Use min-height instead of a fixed height. 
       This allows the header to contain the dropdown without being stretched. */
    min-height: 70px; 
    
    /* FIX: Explicitly set overflow to visible to prevent clipping. */
    overflow: visible;

    /* These are your existing styles, which should remain. */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.search-bar,
.prompt-bar {
    display: flex;
    align-items: center;
    background-color: var(--input-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--input-border);
    padding: 0.6rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    gap: 0.5rem;
}

.search-bar:focus-within,
.prompt-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 25%, transparent);
}

.search-bar i { color: var(--light-text); }
.search-bar input,
.prompt-bar input {
    flex-grow: 1;
    border: none;
    background: none;
    outline: none;
    width: 100%;
    color: var(--input-text);
}
.search-bar input { margin-left: 0.75rem; }

.user-actions { display: flex; align-items: center; gap: 1.25rem; }
.icon-btn { font-size: 1.3rem; color: var(--light-text); cursor: pointer; position: relative; background: none; border: none; }
.notification-dot { position: absolute; top: 0; right: 0; width: 8px; height: 8px; background-color: var(--danger-color); border-radius: 50%; border: 1.5px solid var(--header-bg); }

/* Theme Toggle Switch */
.theme-switch-wrapper { display: flex; align-items: center; }
.theme-switch { position: relative; display: inline-block; width: 56px; height: 30px; cursor: pointer; }
.theme-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--input-bg); border: 1px solid var(--bs-border-color); border-radius: 34px; transition: all var(--transition-speed); }
.slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 3px; bottom: 3px; background-color: var(--card-bg); border: 1px solid var(--bs-border-color); border-radius: 50%; transition: all var(--transition-speed); box-shadow: var(--shadow-sm); }
.slider .icon { position: absolute; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--accent-color); transition: opacity 0.15s ease-in-out; z-index: 1; }
.slider .sun { left: 7px; opacity: 0; } .slider .moon { right: 7px; opacity: 1; }
input:checked + .slider { background-color: var(--primary-color); border-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(26px); background-color: white; border-color: transparent; }
input:checked + .slider .sun { opacity: 1; color: white; } input:checked + .slider .moon { opacity: 0; }

/* User Menu */
.user-menu-container { position: relative; }
.user-avatar-btn { background: none; border: none; padding: 0; cursor: pointer; border-radius: 50%; }
.user-avatar-btn img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--bs-border-color); }
/* in styles.css */

/* User Menu Dropdown Enhancement */
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1050;
    min-width: 240px; /* Increased min-width for better spacing */
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg); /* Softer, larger radius */
    /* Adds a modern, soft shadow for depth */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    padding: 0.75rem; /* Add padding around the entire dropdown */
    /* Smooth fade-in animation */
    animation: fadeIn 0.2s ease-out;
}

.user-menu-user-info {
    padding: 0.5rem 0.75rem; /* Adjust padding for the user info section */
    margin-bottom: 0.5rem; /* Add space below the user info */
}

#userMenuDisplayName {
    font-weight: 600;
    font-size: 1rem; /* Slightly larger font size */
    color: var(--heading-text);
}

#userMenuEmail {
    font-size: 0.85rem; /* Slightly larger font size */
    color: var(--light-text);
}

.dropdown-divider {
    height: 1px;
    margin: 0.75rem 0; /* Increased margin for more separation */
    background-color: var(--bs-border-color);
}

.user-menu-nav-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 1rem; /* Increased padding for links */
    text-decoration: none;
    color: var(--bs-body-color);
    border-radius: var(--border-radius); /* Add border-radius to links */
    transition: background-color 0.2s ease, color 0.2s ease;
}

.user-menu-nav-link:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
}

.user-menu-nav-link.logout-item:hover {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
}

.user-menu-nav-link i.fa-fw {
    width: 1.2em;
    text-align: center;
    font-size: 1rem; /* Consistent icon size */
}
.user-menu-nav-link i.fa-fw { width: 1.2em; text-align: center; }

/* =================================== */
/* === 4. MAIN CANVAS & DASHBOARD  === */
/* =================================== */
/* in styles.css */

/* REPLACE this rule */
.canvas {
    padding: 1rem 2rem; /* This was "padding: 2rem;" */
    overflow-y: auto;
    flex-grow: 1;
}
.content-section { display: none; }
.content-section.active:not(#chat-pm-section) {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px - 2rem); /* Altezza fissa */
    overflow-y: auto; /* Abilita lo scroll INTERNO alla sezione */
    animation: fadeIn 0.5s ease; 
}
#chat-pm-section.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px - 2rem); /* Altezza fissa */
    /* NON ha overflow-y: auto, perché lo gestisce internamente */
    animation: fadeIn 0.5s ease; 
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.grid-container { display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-rows: min-content; gap: 2rem; }
.grid-item { background-color: var(--card-bg); padding: 1.5rem; border-radius: var(--border-radius-lg); border: 1px solid var(--bs-border-color); box-shadow: var(--shadow-sm); transition: transform 0.2s, box-shadow 0.2s; }
.grid-item:hover {
    border-color: var(--border-color-2);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--input-border); }
.card-header h2 { font-size: 1.1rem; font-weight: 600; color: var(--heading-text); margin: 0; }
.card-header .badge { background-color: color-mix(in srgb, var(--primary-color) 20%, transparent); color: var(--primary-color); padding: 0.3rem 0.6rem; font-size: 0.8rem; border-radius: var(--border-radius); font-weight: 600; }
.kpi-strip { grid-column: span 12; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; padding: 0; background: none; border: none; box-shadow: none; }
.kpi-strip:hover { transform: none; box-shadow: none; }
.kpi-card { text-align: center; background-color: var(--card-bg); padding: 1.5rem; border-radius: var(--border-radius-lg); border: 1px solid var(--bs-border-color); }
.ai-activity { grid-column: span 8; }
.sales-funnel { grid-column: span 4; }
.quick-actions {
    grid-column: span 8;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.calendar { grid-column: span 4; }

/* =================================== */
/* === 5. COMPONENT STYLING        === */
/* =================================== */
.kpi-card h3 { font-size: 0.85rem; color: var(--light-text); margin-bottom: 0.75rem; text-transform: uppercase; font-weight: 500; }
.kpi-card .value { font-size: 2.5rem; font-weight: 600; color: var(--heading-text); margin-bottom: 0.25rem; line-height: 1.1; }
.kpi-card .change { font-size: 0.9rem; font-weight: 500; }
.kpi-card .change.positive { color: var(--success-color); }
.kpi-card .change.negative { color: var(--danger-color); }
.kpi-card .change.neutral { color: var(--secondary-color); }

.mission-list { list-style: none; }
.mission-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 0; border-bottom: 1px solid var(--input-border); font-size: 0.95rem; }
.mission-list li:last-child { border-bottom: none; }
.status { font-size: 0.8rem; font-weight: 600; padding: 0.2rem 0.5rem; border-radius: var(--border-radius); }
.status.running { background-color: color-mix(in srgb, var(--info-color) 20%, transparent); color: var(--info-color); }
.status.waiting { background-color: color-mix(in srgb, var(--warning-color) 25%, transparent); color: var(--warning-color); }
.status.done { background-color: color-mix(in srgb, var(--success-color) 20%, transparent); color: var(--success-color); }

.prompt-bar {
    margin-top: 1rem;
    padding: 0.5rem;
    padding-left: 1rem;
}

.btn-secondary-outline { background-color: transparent; border-color: var(--secondary-color); color: var(--secondary-color); }
.btn-secondary-outline:hover:not(:disabled) { background-color: var(--secondary-color); color: white; }

.funnel-chart { display: flex; flex-direction: column; gap: 4px; }
.funnel-stage { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 1rem; border-radius: 4px; color: #FFF; font-weight: 500; position: relative; background: var(--stage-color); width: var(--stage-value); transition: width 0.5s cubic-bezier(0.25, 1, 0.5, 1); }

/* --- 9. QUICK ACTIONS RE-STYLE (V3) --- */

/* The main container is now a seamless card. Padding is removed and overflow is hidden
   to contain the hover effect of its children within the rounded corners. */
.quick-actions {
    grid-column: span 8;
    display: block;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden; 
}

/* The title now has its own internal padding */
.quick-actions-title-main {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
}

.quick-action-list {
    display: flex;
    flex-direction: column;
}

.quick-action-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    /* Each item now has horizontal padding to make the hover effect edge-to-edge */
    padding: 1rem 1.5rem; 
    text-decoration: none;
    color: var(--bs-body-color);
    border-top: 1px solid var(--bs-border-color);
    transition: background-color 0.2s ease;
}

/* This is the new hover effect you requested */
.quick-action-item:hover {
    background-color: var(--menu-hover-bg); /* Standard grey hover color */
}

.quick-action-list a.quick-action-item:first-of-type {
    border-top: none;
}

.quick-action-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: transform 0.2s ease-in-out;
}

.quick-action-item:hover .quick-action-icon {
    transform: scale(1.08);
}

.quick-action-icon.soft-blue { background-color: #E9F2FF; color: #4A90E2; }
.quick-action-icon.soft-green { background-color: #E8FBF5; color: #2EBD85; }
.quick-action-icon.soft-orange { background-color: #FFF6E7; color: #F5A623; }
.quick-action-icon.soft-purple { background-color: #F8ECFD; color: #BD10E0; }

.quick-action-text {
    flex-grow: 1;
    align-self: center;
}

.quick-action-title {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--heading-text);
    margin-bottom: 2px;
}
    
.quick-action-subtitle {
    display: block;
    font-size: 0.8rem;
    color: var(--light-text);
}
    
.quick-action-chevron {
    color: var(--secondary-color);
    transition: transform 0.2s ease, color 0.2s ease;
}
    
.quick-action-item:hover .quick-action-chevron {
    transform: translateX(3px);
    color: var(--primary-color);
}
.calendar { text-align: center; }
/* in styles.css */

/* Replaces the old .mini-calendar style */
.mini-calendar {
    height: 220px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    padding: 0.75rem; /* Adds some internal spacing */
    overflow-y: auto;  /* THIS IS THE FIX: Adds a scrollbar when content overflows */
}
.open-agenda-btn {
    width: 100%;
    font-weight: 600;
    padding: 0.8rem;
    background-color: var(--primary-color);
    border: none;
    color: #fff;
    border-radius: var(--border-radius);
    transition: background-color 0.2s ease;
}
.open-agenda-btn:hover {
    background-color: color-mix(in srgb, var(--primary-color) 85%, black);
}

.help-beacon { position: fixed; bottom: 2rem; right: 2rem; width: 50px; height: 50px; background-color: var(--primary-color); color: #FFF; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; cursor: pointer; box-shadow: var(--shadow-lg); z-index: 1000; }
.placeholder-content { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; color: var(--light-text); background-color: var(--card-bg); border-radius: var(--border-radius-lg); padding: 2rem; }
.placeholder-content h2 { color: var(--heading-text); margin-bottom: 1rem; text-transform: capitalize; }

/* =================================== */
/* === 6. RESPONSIVE STYLES        === */
/* =================================== */
@media (max-width: 1300px) {
    .ai-activity { grid-column: span 12; }
    .sales-funnel { grid-column: span 12; }
    .quick-actions { grid-column: span 7; }
    .calendar { grid-column: span 5; }
}
@media (max-width: 992px) {
    .sidebar { display: none; }
    .top-header .search-bar input { width: 150px; }
    .kpi-strip { grid-template-columns: repeat(2, 1fr); }
    .quick-actions, .calendar { grid-column: span 12; }
}
@media (max-width: 768px) {
    .kpi-strip { grid-template-columns: 1fr; }
    /* FIX: Rimosso flex-direction: column e align-items: stretch */
    .top-header { gap: 0.75rem; padding: 1rem; }
    .canvas { padding: 1.5rem 1rem; }
}

/* Generic primary button style */
.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: var(--border-radius);
    font-weight: 500;
}
.btn-primary:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--primary-color) 85%, black);
}

/* Style for circle-squared ICON buttons */
.btn-create,
.prompt-bar .btn {
    height: 40px;
    width: 40px;
    padding: 0;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.user-avatar-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--bs-border-color);
    background-color: var(--secondary-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.user-avatar-initial {
    font-size: 1.2rem;
    font-weight: 600;
    color: #FFF;
    line-height: 1;
}
/* --- 8. CUSTOM SCROLLBAR STYLING --- */

/* This targets the main content area's scrollbar */
.canvas {
    /* For Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--input-bg);
}

/* For WebKit browsers (Chrome, Safari, Edge) */
.canvas::-webkit-scrollbar {
    width: 8px; /* Sets a thinner scrollbar */
}

.canvas::-webkit-scrollbar-track {
    background: var(--input-bg); /* Sets the color of the scrollbar's background track */
}

.canvas::-webkit-scrollbar-thumb {
    background-color: var(--primary-color); /* Sets the handle color to your theme's blue */
    border-radius: 10px; /* Makes the handle have rounded corners */
    border: 2px solid var(--input-bg); /* Adds a small border that matches the track */
}

.canvas::-webkit-scrollbar-thumb:hover {
    background-color: color-mix(in srgb, var(--primary-color) 85%, black); /* Makes the handle slightly darker on hover */
}
/* --- 10. AI COMMAND CENTER --- */
.page-header {
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--heading-text);
}
.page-header p {
    color: var(--light-text);
    font-size: 1rem;
}

.global-prompt-bar {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    gap: 0.75rem;
    margin-bottom: 2rem;
}
.global-prompt-bar input {
    flex-grow: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 1rem;
    color: var(--input-text);
}
.prompt-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.btn-run {
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Main Layout */
.ai-command-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}
.main-column, .sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Mission List */
.mission-list { list-style: none; }
.mission-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--input-border);
}
.mission-list li:last-child { border-bottom: none; }
.mission-info { flex-grow: 1; margin-right: 1rem; }
.goal-summary { font-weight: 500; }
.progress-bar {
    height: 6px;
    background: var(--input-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}
.progress-bar div {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 3px;
}
.mission-details { display: flex; align-items: center; gap: 1rem; }
.status-chip { font-size: 0.8rem; font-weight: 600; padding: 0.2rem 0.5rem; border-radius: var(--border-radius); text-transform: capitalize; }
.status-chip.queued { background-color: color-mix(in srgb, var(--secondary-color) 20%, transparent); color: var(--secondary-color); }
.status-chip.running { background-color: color-mix(in srgb, var(--info-color) 20%, transparent); color: var(--info-color); }
.status-chip.completed { background-color: color-mix(in srgb, var(--success-color) 20%, transparent); color: var(--success-color); }
.status-chip.error { background-color: color-mix(in srgb, var(--danger-color) 15%, transparent); color: var(--danger-color); }
.time-info { font-size: 0.85rem; color: var(--light-text); white-space: nowrap; }

/* Review Queue */
.review-queue { display: flex; flex-direction: column; gap: 1rem; }
.review-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--menu-hover-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--input-border);
}
.review-actions { display: flex; gap: 0.5rem; }
.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.8rem; }
.btn-success { background-color: var(--success-color); color: #fff; }
.btn-success:hover { background-color: color-mix(in srgb, var(--success-color) 85%, black); }

/* Table Styling */
.styled-table { width: 100%; border-collapse: collapse; }
.styled-table th, .styled-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--input-border);
}
.styled-table thead th { font-weight: 600; color: var(--light-text); }
.styled-table.compact td, .styled-table.compact th { padding: 0.5rem; }

/* Mini Theme Toggle for Skills */
.theme-switch.mini { width: 40px; height: 22px; }
.theme-switch.mini .slider:before { height: 16px; width: 16px; left: 2px; bottom: 2px; }
.theme-switch.mini input:checked + .slider:before { transform: translateX(18px); }

/* Playbook Library */
.playbook-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.playbook-card {
    background-color: var(--menu-hover-bg);
    border-radius: var(--border-radius);
    padding: 1rem;
    border: 1px solid var(--input-border);
}
.playbook-card strong, .playbook-card small { display: block; }
.playbook-card small { color: var(--light-text); margin-top: 0.25rem; }

/* Help List */
.card-subtle { background-color: var(--input-bg); border-color: transparent; }
.help-list { list-style: none; color: var(--light-text); font-size: 0.85rem; }
.help-list code { background: var(--bs-border-color); padding: 2px 4px; border-radius: 4px; }

/* Dropdown */
.dropdown-container { position: relative; }
.dropdown-toggle { display: flex; align-items: center; gap: 0.5rem; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    z-index: 10;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem 0;
    box-shadow: var(--shadow-md);
    min-width: 150px;
}
.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--bs-body-color);
    text-decoration: none;
}
.dropdown-item:hover { background-color: var(--menu-hover-bg); }

/* Details Drawer */
.details-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1090;
    
    /* Animation: Start hidden */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out; /* Controls fade in/out */
}
.details-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 500px;
    height: 100%;
    background-color: var(--sidebar-bg);
    z-index: 1100;
    box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}
.details-drawer.is-open {
    transform: translateX(0);
}
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}
.drawer-header h3 { font-size: 1.2rem; margin: 0; }
.close-drawer-btn { background: none; border: none; color: var(--light-text); font-size: 1.5rem; cursor: pointer; }
.drawer-content { padding: 1.5rem; overflow-y: auto; flex-grow: 1; }
.drawer-tabs { display: flex; gap: 0.5rem; border-bottom: 1px solid var(--bs-border-color); margin-bottom: 1rem; }
.tab-link {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    color: var(--light-text);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}
.steps-list { padding-left: 1.2rem; }
.steps-list li { margin-bottom: 0.5rem; }
/* --- 10. AI COMMAND CENTER (V3 - Final Button Polish) --- */

/* Page Header */
.ai-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.ai-page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--heading-text);
    margin-bottom: 0.25rem;
}
.ai-page-header p {
    color: var(--light-text);
    font-size: 1rem;
    max-width: 600px;
}

/* High-Visibility Prompt Bar */
.global-prompt-bar-v2 {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    background: linear-gradient(145deg, color-mix(in srgb, var(--card-bg) 95%, black), var(--card-bg));
    box-shadow: 0 4px 15px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.2);
    transition: all 0.2s ease-out;
}
.global-prompt-bar-v2:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 20%, transparent), 0 6px 20px rgba(0,0,0,0.15);
}
.global-prompt-bar-v2 .prompt-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    opacity: 0.8;
}
.global-prompt-bar-v2 input {
    flex-grow: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 1rem;
    color: var(--input-text);
    height: 48px;
}
.global-prompt-bar-v2 .prompt-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.global-prompt-bar-v2 .btn-run {
    height: 44px;
    border-radius: 12px; /* Consistent circle-squared shape */
}
.global-prompt-bar-v2 .btn-run span {
    margin-left: 0.5rem;
}


/* Tab Navigation */
.ai-command-tabs {
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 2rem;
}
.tab-nav {
    display: flex;
    gap: 0.5rem;
}
.tab-nav .tab-link {
    padding: 0.75rem 1.25rem;
    color: var(--light-text);
    font-weight: 600;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.tab-nav .tab-link:hover {
    color: var(--heading-text);
    background-color: var(--menu-hover-bg);
}
.tab-nav .tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Tab Content Panes */
.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}
.tab-pane.active {
    display: block;
}

/* Main Button & Badge Styling */
.btn-c-sq {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    border-radius: 12px; /* Main circle-squared shape */
    font-weight: 600;
    padding: 0.6rem 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
}
.btn-c-sq.icon-only {
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 1.1rem;
}
.btn-c-sq.soft-gray {
    background-color: var(--menu-hover-bg);
    color: var(--light-text);
}
.btn-c-sq.soft-gray:hover {
    background-color: var(--bs-border-color);
    color: var(--heading-text);
}
.btn-c-sq.soft-green {
    background-color: color-mix(in srgb, var(--success-color) 15%, transparent);
    color: var(--success-color);
}
.btn-c-sq.soft-green:hover {
    background-color: color-mix(in srgb, var(--success-color) 25%, transparent);
}
.btn-c-sq.soft-blue {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
}
.btn-c-sq.soft-blue:hover {
    background-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
}
.btn-c-sq.soft-red {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
}
.btn-c-sq.soft-red:hover {
    background-color: color-mix(in srgb, var(--danger-color) 25%, transparent);
}

/* --- MODIFICATION: New Badge Style --- */
.badge-soft {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 1rem; /* Pill shape for badges */
    background-color: color-mix(in srgb, var(--primary-color) 20%, transparent);
    color: color-mix(in srgb, var(--primary-color) 100%, white);
}


/* Missions Layout & Components */
.missions-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
.mission-list-v2 { list-style: none; }
.mission-list-v2 li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--input-border);
}
.mission-list-v2 li:last-child { border-bottom: none; }
.text-blue { color: #3b82f6; }
.text-green { color: #22c55e; }

/* Standalone Card Header for Tabs */
.card-header-standalone {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.card-header-standalone h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--heading-text);
}

/* Playbooks Grid */
.playbooks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}
.playbook-card-v2 {
    background: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}
.playbook-card-v2:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color-2);
}
.playbook-icon-v2 {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 1rem;
}
.bg-blue { background-color: #3b82f6; }
.bg-green { background-color: #22c55e; }
.bg-orange { background-color: #f97316; }

.playbook-card-v2 h3 { font-size: 1.1rem; font-weight: 600; color: var(--heading-text); margin-bottom: 0.5rem; }
.playbook-card-v2 p { color: var(--light-text); font-size: 0.9rem; flex-grow: 1; margin-bottom: 1rem; }
.playbook-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; border-top: 1px solid var(--input-border); font-size: 0.8rem; color: var(--light-text); font-weight: 500; }

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}
.skill-card { background: var(--card-bg); border: 1px solid var(--bs-border-color); border-radius: var(--border-radius-lg); padding: 1.5rem; }
.skill-card.disabled { opacity: 0.6; }
.skill-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.skill-icon { font-size: 1.2rem; color: var(--light-text); }
.skill-header h3 { flex-grow: 1; font-size: 1.1rem; font-weight: 600; color: var(--heading-text); }
.skill-card p { color: var(--light-text); font-size: 0.9rem; }

/* Table and Review Actions */
.table-responsive { overflow-x: auto; }
.review-actions { display: flex; gap: 0.75rem; } /* Increased gap */

/* --- MODIFICATION: Consistent Approve/Reject Buttons --- */
.btn-success { 
    background-color: var(--success-color); 
    color: #fff;
    border-radius: 12px; /* Consistent circle-squared shape */
    padding: 0.6rem 1.25rem;
}
.btn-success:hover { background-color: color-mix(in srgb, var(--success-color) 85%, black); }
/* --- V4 - Interactive Hover Effects --- */

/* Add a background color change to card hovers */
#ai-command-section .playbook-card-v2:hover,
#ai-command-section .skill-card:hover {
    background-color: var(--menu-hover-bg);
}

/* Add hover effect to mission lists, review cards, and table rows */
#ai-command-section .mission-list-v2 li:hover,
#ai-command-section .review-card:hover,
#ai-command-section .styled-table tbody tr:hover {
    background-color: var(--menu-hover-bg);
    border-radius: var(--border-radius); /* Add a slight radius for table rows on hover */
    cursor: pointer;
}

/* Ensure table row hover does not mess up table layout */
#ai-command-section .styled-table {
    border-collapse: separate; /* Required for border-radius on tr */
    border-spacing: 0;
}
/* --- V5 - Styled Filter Controls --- */
#ai-command-section .filter-bar {
    display: flex;
    gap: 0.75rem;
}

/* Base style for both input and select */
#ai-command-section .form-control-sm {
    background-color: var(--input-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    color: var(--bs-body-color);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    height: 40px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#ai-command-section .form-control-sm:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

/* Custom styling for the select dropdown */
#ai-command-section select.form-control-sm {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2rem; /* Make space for the custom arrow */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b949e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* Custom styling for the date input's calendar icon */
#ai-command-section input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

#ai-command-section input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Invert the calendar icon color for dark mode to make it visible */
body:not(.light-mode) #ai-command-section input[type="date"]::-webkit-calendar-picker-indicator {
   filter: invert(1);
}
/* --- 11. LEAD ENGINE SECTION --- */
.lead-engine-layout {
    display: grid;
    grid-template-columns: 1fr 320px; /* Main column and fixed-width sidebar */
    gap: 2rem;
    align-items: flex-start;
}

.lead-engine-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.lead-engine-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 2rem;
}

/* Lead Source Overview Cards */
.lead-source-overview {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

.source-card {
    position: relative; /* This parent rule is necessary */
    overflow: visible;  /* Allows the button's shadow to show */
}

.delete-source-icon {
    /* Sizing & Position */
    position: absolute;
    top: -8px;   /* Positions it slightly outside the card for prominence */
    right: -8px;  /* Positions it slightly outside the card */
    width: 28px;  /* Increased size for an easier click target */
    height: 28px;
    z-index: 2;   /* Ensures it sits on top of the card content */
    
    /* Appearance */
    background-color: var(--card-bg); /* Match the card background */
    border: 1px solid var(--bs-border-color);
    border-radius: 50%;
    color: var(--light-text);
    box-shadow: var(--shadow-sm); /* Adds a subtle lift */
    
    /* Icon Centering */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem; /* Larger icon */

    /* Interaction & Animation */
    cursor: pointer;
    opacity: 0; /* Hidden by default */
    transform: scale(0.8); /* Start slightly smaller for a "pop" effect */
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); /* A bouncy transition */
}
.source-icon.website { background-color: #4A90E2; }
.source-icon.hunter { background-color: #F5A623; }
.source-icon.idx { background-color: #7ED321; }
.source-icon.manual { background-color: #BD10E0; }

.source-info .count {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--heading-text);
}
.source-info .name {
    display: block;
    font-size: 0.8rem;
    color: var(--light-text);
}
.source-connect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1rem;
    background-color: var(--card-bg);
    border: 1px dashed var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    color: var(--light-text);
    cursor: pointer;
    transition: all 0.2s;
}
.source-connect-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--menu-hover-bg);
}

/* Filters Bar */
.lead-filters-bar {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.filter-group, .filter-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.filter-link {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Lead Table Enhancements */
.lead-table .lead-name {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.lead-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}
.lead-name .name-text {
    font-weight: 600;
    color: var(--heading-text);
    display: block;
}
.lead-name .email-text {
    font-size: 0.85rem;
    color: var(--light-text);
    display: block;
}
.owner-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    /* ADDED to center content (initials/icons) */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600; /* Good for initials */
    font-size: 0.8rem; /* Good for icons or initials */
    overflow: hidden; /* Important for containing child <img> tags correctly */
}
.tag-source {
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
}
.tag-source.website { background-color: color-mix(in srgb, #4A90E2 20%, transparent); color: #4A90E2; }
.tag-source.idx { background-color: color-mix(in srgb, #7ED321 20%, transparent); color: #7ED321; }
.tag-source.hunter { background-color: color-mix(in srgb, #F5A623 20%, transparent); color: #F5A623; }

.status-badge {
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 1rem; /* pill shape */
    font-size: 0.8rem;
    text-align: center;
    display: inline-block;
}
.status-badge.new { background-color: color-mix(in srgb, var(--info-color) 20%, transparent); color: var(--info-color); }
.status-badge.qualified { background-color: color-mix(in srgb, var(--success-color) 20%, transparent); color: var(--success-color); }
.status-badge.contact { background-color: color-mix(in srgb, var(--warning-color) 25%, transparent); color: var(--warning-color); }

.score-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 20px;
}
.score-bar .score-fill {
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 4px;
    min-width: 50px;
}
.score-bar span {
    font-weight: 600;
    color: var(--light-text);
    font-size: 0.9rem;
}
.table-footer {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--light-text);
}
.pagination {
    display: flex;
    gap: 0.5rem;
}

/* Sidebar Components */
.metrics-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    text-align: center;
}
.metric-item .metric-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--heading-text);
    display: block;
}
.metric-item .metric-label {
    font-size: 0.8rem;
    color: var(--light-text);
    display: block;
}
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.tags-list .tag {
    background-color: var(--menu-hover-bg);
    color: var(--light-text);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}
.feed-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.feed-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: var(--heading-text);
}
.feed-list .feed-status {
    font-size: 0.8rem;
    color: var(--light-text);
}
/* --- 11. LEAD ENGINE SECTION (Full & Consolidated) --- */

/* Main Layout & Components */
.lead-engine-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Lead Source Overview Cards */
.lead-source-overview {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

.source-card {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--card-bg);
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
}

.source-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.source-icon.website { background-color: #4A90E2; }
.source-icon.hunter { background-color: #F5A623; }
.source-icon.idx { background-color: #7ED321; }
.source-icon.manual { background-color: #BD10E0; }

.source-info .count {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--heading-text);
}
.source-info .name {
    display: block;
    font-size: 0.8rem;
    color: var(--light-text);
}
.source-connect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1rem;
    background-color: var(--card-bg);
    border: 1px dashed var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    color: var(--light-text);
    cursor: pointer;
    transition: all 0.2s;
}
.source-connect-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--menu-hover-bg);
}

/* Lead Table & Associated Elements */
#leadsTable tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}
#leadsTable tbody tr:hover {
    background-color: var(--menu-hover-bg);
}

.lead-table .lead-name {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.lead-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}
.lead-name .name-text {
    font-weight: 600;
    color: var(--heading-text);
    display: block;
}
.lead-name .email-text {
    font-size: 0.85rem;
    color: var(--light-text);
    display: block;
}
.owner-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}
.tag-source {
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
}
.tag-source.website { background-color: color-mix(in srgb, #4A90E2 20%, transparent); color: #4A90E2; }
.tag-source.idx { background-color: color-mix(in srgb, #7ED321 20%, transparent); color: #7ED321; }
.tag-source.hunter { background-color: color-mix(in srgb, #F5A623 20%, transparent); color: #F5A623; }

.status-badge {
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 1rem; /* pill shape */
    font-size: 0.8rem;
    text-align: center;
    display: inline-block;
}
.status-badge.new { background-color: color-mix(in srgb, var(--info-color) 20%, transparent); color: var(--info-color); }
.status-badge.qualified { background-color: color-mix(in srgb, var(--success-color) 20%, transparent); color: var(--success-color); }
.status-badge.contact { background-color: color-mix(in srgb, var(--warning-color) 25%, transparent); color: var(--warning-color); }

.score-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 20px;
}
.score-bar .score-fill {
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 4px;
    min-width: 50px;
}
.score-bar span {
    font-weight: 600;
    color: var(--light-text);
    font-size: 0.9rem;
}
.table-footer {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--light-text);
}
.pagination {
    display: flex;
    gap: 0.5rem;
}


/* Togglable Metrics Drawer */
.metrics-drawer-container {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    border-left: 1px solid var(--bs-border-color);
    z-index: 1040; /* Below modals but above content */
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 25px rgba(0,0,0,0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}
.metrics-drawer-container.is-open {
    transform: translateX(0);
}
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem 0.75rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}
.drawer-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
}
.drawer-content {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.metrics-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    text-align: center;
}
.metric-item .metric-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--heading-text);
    display: block;
}
.metric-item .metric-label {
    font-size: 0.8rem;
    color: var(--light-text);
    display: block;
}
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.tags-list .tag {
    background-color: var(--menu-hover-bg);
    color: var(--light-text);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}
.feed-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.feed-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: var(--heading-text);
}
.feed-list .feed-status {
    font-size: 0.8rem;
    color: var(--light-text);
}

/* Adjusts main content when drawer is open */
.main-content {
    transition: margin-right 0.3s ease-in-out;
}
.main-content.metrics-drawer-open {
    margin-right: 340px;
    transition: margin-right 0.3s ease-in-out;
}
/* In styles.css */

/*
  REPLACE the existing .modal-overlay and .modal-panel styles
  with this corrected block.
*/
/* In styles.css, replace the old modal styles with this entire block */

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: none; /* Start completely hidden */
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  z-index: 1050;

  /* --- Animation State (Start Hidden) --- */
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.modal-overlay.is-visible {
  /* --- Animation State (End Visible) --- */
  opacity: 1;
}

.modal-panel {
  background-color: var(--card-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;

  /* --- Animation State (Start Hidden) --- */
  opacity: 0;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1),
              opacity 0.2s ease-out;
}

.modal-overlay.is-visible .modal-panel {
  /* --- Animation State (End Visible) --- */
  opacity: 1;
  transform: scale(1);
}

/* Make sure you have a rule to hide any modal that might
   still have the .hidden class from the old logic. */
.modal-overlay.hidden {
  display: none;
}


/* Applica la larghezza massima specifica per ogni modale */
#leadProfileModal {
    max-width: 700px;
}
#connectSourceModal {
    max-width: 750px;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--input-border);
}
.modal-header .lead-name h2 {
    font-size: 1.25rem;
    font-weight: 600;
}
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
        max-height: calc(90vh - 200px); 

}
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--input-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background-color: var(--input-bg);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}
.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
    border: none;
}
.btn-danger:hover {
    background-color: color-mix(in srgb, var(--danger-color) 85%, black);
}
/* --- 12. UI REFINEMENTS (Buttons & Editable Cards) --- */

/* Fix "Add Lead" button dimensions in the header */
.header-actions .header-action-btn {
    height: 44px; /* Matches the height of circle-squared buttons */
    padding: 0 1.25rem;
    font-weight: 600;
}
.header-actions .header-action-btn i {
    margin-right: 0.6rem;
}


/* Styling for Editable KPI/Metrics Cards */
.card-editable .metrics-list {
    grid-template-columns: 1fr; /* Stack them in a single column */
    gap: 1rem;
    text-align: left;
}
.card-editable .metric-item {
    position: relative;
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    transition: background-color 0.2s;
}
.card-editable .metric-item:hover {
    background-color: var(--menu-hover-bg);
}
.metric-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.75rem;
    background-color: var(--card-bg);
    padding: 4px;
    border-radius: var(--border-radius);
    opacity: 0;
    transition: opacity 0.2s;
}
.metric-item:hover .metric-actions {
    opacity: 1;
}
.metric-actions i {
    cursor: pointer;
    color: var(--light-text);
}
.metric-actions i:hover {
    color: var(--primary-color);
}
.metric-actions i.fa-trash-alt:hover {
    color: var(--danger-color);
}


/* Well-styled Modal Buttons */
.modal-footer {
    justify-content: space-between; /* Pushes button groups to each side */
    align-items: center;
}
.footer-actions-left, .footer-actions-right {
    display: flex;
    gap: 0.75rem;
}
/* Styling for the new delete icon on source cards */
.source-card {
    position: relative; /* Needed to position the delete icon */
}
.source-card.is-deleting {
    opacity: 0;
    transform: scale(0.9);
}
.delete-source-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    cursor: pointer;
    color: var(--light-text);
    background-color: color-mix(in srgb, var(--card-bg) 50%, transparent);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    opacity: 0.5;
    transition: all 0.2s ease;
}

.source-card:hover .delete-source-icon {
    opacity: 1;
    transform: scale(1);
}

/* On button hover, it gets a more dramatic, clear effect */
.delete-source-icon:hover {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: #fff;
    transform: scale(1.15) rotate(90deg); /* Rotates for a dynamic feel */
    box-shadow: 0 4px 12px color-mix(in srgb, var(--danger-color) 40%, transparent); /* Adds a red glow */
}
/* --- Styles for the Connect Source Modal --- */
.modal-header-text .name-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--heading-text);
}
.modal-header-text .email-text {
    font-size: 0.9rem;
    color: var(--light-text);
}

.source-selection-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Creates a 2-column grid */
    gap: 1rem;
}

.source-selection-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.source-selection-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.source-selection-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--input-bg);
}

.source-selection-card.disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--bs-border-color);
}


.source-selection-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    flex-shrink: 0;
}
/* Define colors for the new selectable cards */
.source-selection-icon.prequalify { background-color: #4A90E2; }
.source-selection-icon.hunter { background-color: #F5A623; }
.source-selection-icon.flownetwork { background-color: #BD10E0; }
.source-selection-icon.flowinbox { background-color: #7ED321; }

.source-selection-text h3 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--heading-text);
}

.source-selection-text p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--light-text);
}
/* --- 12. AGENTIC WORKBENCH STYLES (FULL & FINAL) --- */

/* Main Prompt Bar on Dashboard */
.aw-prompt-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.75rem 0.5rem 1.25rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease-out;
}
.aw-prompt-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 20%, transparent), var(--shadow-lg);
}
.aw-prompt-bar .prompt-icon {
    font-size: 1.2rem;
    color: var(--primary-color);
}
.aw-prompt-bar input {
    flex-grow: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 1rem;
    color: var(--input-text);
    height: 48px;
}
.aw-prompt-bar .prompt-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.aw-prompt-bar .btn-c-sq.soft-gray {
    width: 44px;
    height: 44px;
}
.aw-prompt-bar .btn-run {
    height: 44px;
    padding: 0 1.25rem;
    border-radius: 12px;
    font-weight: 600;
}
.aw-prompt-bar .btn-run span {
    margin-left: 0.5rem;
}

/* Suggestion Cards */
.suggestion-card {
    cursor: pointer;
}
.suggestion-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}
.suggestion-card h3, .suggestion-card p {
    text-align: left;
}


/* General Layout & Tab Panes */
.sub-tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}
.sub-tab-pane.active {
    display: block;
}
.aw-grid-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    align-items: flex-start;
}
.aw-card-large { grid-column: span 2; }
.aw-card-small { grid-column: span 1; }

/* Active Runs List */
.aw-mission-list { padding: 0 1.5rem 1rem; list-style: none;}
.aw-mission-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--input-border);
}
.aw-mission-list li:last-child {
    border-bottom: none;
}
.progress-bar div.error {
    background-color: var(--danger-color);
}

/* Data Hub Drop Zone */
.ingestion-area { padding: 1.5rem; }
.drop-zone {
    border: 2px dashed var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    text-align: center;
    background-color: var(--input-bg);
    cursor: pointer;
    transition: all 0.2s ease-out;
}
.drop-zone:hover {
    border-color: var(--primary-color);
    transform: scale(1.02);
    background: radial-gradient(circle, color-mix(in srgb, var(--primary-color) 5%, transparent) 0%, transparent 70%);
}
.drop-zone i { color: var(--light-text); margin-bottom: 1rem; }
.drop-zone p { color: var(--heading-text); font-weight: 500; }

/* Workflows Card Actions */
.playbook-card-v2 p { flex-grow: 0; margin-bottom: 1rem; }
.playbook-actions {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--input-border);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Analytics KPIs and Chart */
.kpi-grid {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}
.kpi-card-alt {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
}
.kpi-card-alt span {
    display: block;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--heading-text);
}
.kpi-card-alt label {
    display: block;
    font-size: 0.8rem;
    color: var(--light-text);
}
.aw-chart-container {
    padding: 1.5rem;
    height: 300px;
}
/* --- 13. COMMUNICATION HUB (V4 - SMOOTHER ANIMATION) --- */

/* --- A. Collapsible Header --- */
#comm-hub-section.active { 
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px - 2rem); 
}
.comm-hub-header {
    flex-shrink: 0;
    position: relative;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    background-color: var(--card-bg);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-main-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#comm-hub-section.collapsed .comm-hub-header {
    margin-bottom: 1rem;
    height: 46px; /* Height of just the toggle button */
}

#comm-hub-section.collapsed .header-main-content {
    opacity: 0;
    transform: translateY(-20px);
    visibility: hidden;
    padding: 0 1.5rem;
}

.header-toggle-btn {
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 24px;
    border-radius: 8px 8px 0 0 !important;
    border: 1px solid var(--bs-border-color);
    border-bottom: none;
    z-index: 5;
}
.header-toggle-btn i {
    transition: transform 0.3s ease;
}

#comm-hub-section.collapsed .header-toggle-btn i {
    transform: rotate(180deg);
}

/* --- B. Main 3-Pane Container --- */
.comm-hub-main-container {
    flex-grow: 1;
    display: grid;
    /* Define the grid with a smooth transition for column resizing */
    grid-template-columns: minmax(280px, 20%) 5px 1fr 5px 280px; 
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    /* THIS IS THE KEY CHANGE for smoother animations */
    transition: grid-template-columns 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.comm-hub-main-container.details-hidden {
    /* The last column (details) and its resizer are smoothly animated to 0px */
    grid-template-columns: minmax(280px, 25%) 5px 1fr 0px 0px; /* List | Resizer | Reading | Resizer (hidden) | Details (hidden) */
}


.comm-hub-resizer {
    background-color: var(--bs-border-color);
    cursor: col-resize;
    transition: background-color 0.2s ease;
    z-index: 1; 
}

.comm-hub-resizer:hover {
    background-color: var(--primary-color);
}


.comm-hub-resizer-horizontal {
    background-color: var(--bs-border-color);
    height: 5px;
    cursor: row-resize; 
    transition: background-color 0.2s ease;
    z-index: 1; 
}

.comm-hub-resizer-horizontal:hover {
     background-color: var(--primary-color);
}

/* --- C. General Pane Styling --- */
.comm-hub-list-pane,
.comm-hub-reading-pane,
.comm-hub-details-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}
.comm-hub-list-pane { border-right: 1px solid var(--bs-border-color); }
.comm-hub-reading-pane { border-right: 1px solid var(--bs-border-color); }
/* Style for the "View Full Profile" button in Comm Hub details */
.comm-hub-details-pane .btn-view-profile {
    width: 100%;
    margin-top: auto; /* Keeps it at the bottom */
    /* Updated styles to match soft-blue buttons */
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent); /* Soft blue background */
    color: var(--primary-color); /* Primary color text */
    font-weight: 600;
    padding: 0.8rem 1.25rem;
    border-radius: var(--border-radius);
    box-shadow: none; /* Remove box-shadow for soft buttons */
    transition: all 0.2s ease-out;
    border: none;
    cursor: pointer;
}

.comm-hub-details-pane .btn-view-profile:hover {
    transform: translateY(-2px);
    /* Updated hover to match soft-blue buttons */
    background-color: color-mix(in srgb, var(--primary-color) 25%, transparent); /* Darker soft blue on hover */
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 10%, transparent); /* Subtle shadow on hover */
    color: var(--primary-color); /* Keep text color consistent on hover */
}
/* --- Styling for Custom Form Controls (e.g., Lead Status dropdown) --- */
.form-control-custom {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    color: var(--input-text);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.6rem 0.75rem;
    height: 38px;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s, color 0.2s;
}
select.form-control-custom {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b949e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}
input[type="datetime-local"] {
    position: relative;
    color: var(--input-text);
}

/* Hides the default browser text and allows our placeholder to show */
input[type="datetime-local"]::-webkit-datetime-edit {
    color: transparent;
}
input[type="datetime-local"]:focus::-webkit-datetime-edit {
    color: var(--input-text); /* Show the date/time text when the user focuses the input */
}

/* A pseudo-element to create a custom placeholder */
input[type="datetime-local"]::before {
    content: 'Select date and time'; /* The placeholder text */
    position: absolute;
    color: var(--input-placeholder);
    display: block;
    width: 100%;
}

/* Hide the placeholder when the user has selected a value */
input[type="datetime-local"]:focus::before,
input[type="datetime-local"]:valid::before {
    display: none;
}


.form-control-custom:focus {
    outline: none;
    border-color: var(--primary-color); /* Primary color border on focus */
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent); /* Subtle shadow on focus */
}

/* Ensure options are styled correctly in dark mode */
.form-control-custom option {
    background-color: var(--input-bg); /* Background for options */
    color: var(--input-text); /* Text color for options */
}
.pane-header {
    display: flex; /* <-- ADDED for flexbox alignment */
    align-items: center; /* <-- ADDED for vertical alignment */
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}
.pane-content {
    padding: 0;
    overflow-y: auto;
    flex-grow: 1;
}
.pane-content {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color-2) transparent;
}
.pane-content::-webkit-scrollbar { width: 6px; }
.pane-content::-webkit-scrollbar-track { background: transparent; }
.pane-content::-webkit-scrollbar-thumb { background-color: var(--border-color-2); border-radius: 6px; }

/* --- D. Pane 1: Conversation List --- */
.conversation-list { list-style: none; }
.conversation-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--input-border);
    cursor: pointer;
    display: flex;
    gap: 1rem;
    transition: background-color 0.2s ease;
}
.conversation-item:last-child { border-bottom: none; }
.conversation-item:hover { background-color: var(--menu-hover-bg); }
.conversation-item.active {
    background-color: var(--primary-color) !important;
    color: white;
}
.conversation-item.unread .convo-sender,
.conversation-item.unread .convo-subject {
    font-weight: 700;
    color: var(--heading-text);
}
.conversation-item.active .convo-sender,
.conversation-item.active .convo-subject,
.conversation-item.active .convo-preview,
.conversation-item.active .convo-timestamp {
    color: rgba(255, 255, 255, 0.9);
}
.conversation-item.active.unread::before {
    background-color: white;
}

.convo-channel-icon {
    font-size: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}
.convo-channel-icon.email { background-color: #4A90E2; }
.convo-channel-icon.chat { background-color: #2EBD85; }
.convo-channel-icon.sms { background-color: #f97316; }
.conversation-item.active .convo-channel-icon i,
.convo-channel-icon .fa-star { color: var(--accent-color); }
.conversation-item:not(.active) .convo-channel-icon.email .fa-star { color: white; }

.convo-details { flex-grow: 1; overflow: hidden; }
.convo-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.convo-sender { font-weight: 600; font-size: 0.9rem; color: var(--heading-text); }
.convo-timestamp { font-size: 0.75rem; color: var(--light-text); }
.convo-subject { font-size: 0.85rem; color: var(--light-text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-preview { font-size: 0.85rem; color: var(--light-text); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- E. Pane 2: Reading & Composer --- */
.comm-hub-reading-pane {
    display: grid; 
    grid-template-rows: auto 1fr 5px auto; 
    overflow: hidden;
    border-right: 1px solid var(--bs-border-color);
}
.reading-header-info {
    flex-grow: 1; /* <-- ADDED to take up available space */
}
.reading-header-info h3 { font-size: 1.1rem; margin: 0 0 4px; color: var(--heading-text); }
.reading-header-info p { margin: 0; color: var(--light-text); font-size: 0.85rem; }
.reading-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center; 
    margin-left: auto; /* <-- THIS IS THE KEY CHANGE to push the icons to the right */
}
/* in styles.css - AFTER (Replace the block above) */
.comm-hub-reading-pane .pane-content {
    padding: 1.5rem;
    /* THE FIX: Force this container to scroll vertically when content overflows */
    overflow-y: auto !important; 
    /* THE FIX: Force the grid to allow this item to shrink */
    min-height: 0 !important; 
}
.message { display: flex; gap: 1rem; margin-bottom: 1.5rem; max-width: 90%; }
.message.self { margin-left: auto; flex-direction: row-reverse; }
.message .avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.message-content { background: var(--input-bg); border-radius: 1rem; padding: 0.75rem 1.25rem; border: 1px solid var(--input-border); }
.message.self .message-content { background: var(--primary-color); color: #fff; border-color: transparent; }
.message.self .message-content p,
.message.self .message-header .sender-name,
.message.self .message-header .timestamp { color: #fff; }
.message-header { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 0.5rem; }

.composer-area { border-top: 1px solid var(--bs-border-color); padding: 1rem; background-color: var(--sidebar-bg); flex-shrink: 0; }
.composer-textarea { min-height: 80px; padding: 0.75rem; border: 1px solid var(--input-border); border-radius: var(--border-radius); margin-bottom: 1rem; background: var(--bs-body-bg); }
.composer-textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent); }
.composer-actions { display: flex; justify-content: space-between; align-items: center; }
.left-actions, .right-actions { display: flex; align-items: center; gap: 0.75rem; }
.composer-actions .btn-run { gap: 0.6rem; padding: 0 1rem; height: 44px; }

/* --- F. Pane 3: Details Pane --- */
.comm-hub-details-pane {
    display: flex; /* Keep flex for content layout */
    flex-direction: column;
    background-color: var(--sidebar-bg);
    /* Manages the fade-in/out effect AND sizing */
    transition: all 0.3s ease-out; /* Transition all properties for smooth hide/show */
    opacity: 1;
    pointer-events: auto; /* Allow interactions by default */
    width: 280px; /* Default width */
    flex-shrink: 0; /* Prevents it from shrinking by default */
}

.comm-hub-main-container.details-hidden .comm-hub-details-pane {
    /* When hidden, the panel becomes transparent, non-interactive, and effectively zero width */
    opacity: 0;
    pointer-events: none;
    width: 0; /* Collapse its width */
    overflow: hidden; /* Hide overflow content during transition */
    padding: 0; /* Remove padding when hidden */
    border-left: none; /* Remove border when hidden */
}

.comm-hub-details-pane .pane-content { display: flex; flex-direction: column; gap: 1.5rem; padding: 1.5rem; }
.comm-hub-details-pane .pane-header h3 { font-size: 1.1rem; color: var(--heading-text); }
.details-contact-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1rem; }
.details-contact-card .lead-avatar { width: 64px; height: 64px; font-size: 2rem; }
.details-contact-card .name-text { font-size: 1.1rem; font-weight: 600; color: var(--heading-text); }
.details-contact-card .email-text { font-size: 0.9rem; color: var(--light-text); }
.details-section h4 { font-size: 0.8rem; font-weight: 600; color: var(--light-text); margin-bottom: 0.75rem; text-transform: uppercase; }
.quick-action-list.stacked .quick-action-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    color: var(--bs-body-color);
}
.quick-action-list.stacked .quick-action-item:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
}
/* --- 14. ENHANCED BUTTON & COMPOSE MODAL --- */

/* A more prominent, solid button style */
.btn-primary-filled {
    background-color: var(--primary-color);
    color: #fff;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 20%, transparent);
    transition: all 0.2s ease-out;
}
.btn-primary-filled:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px color-mix(in srgb, var(--primary-color) 30%, transparent);
    background-color: color-mix(in srgb, var(--primary-color) 90%, black);
}

/* Styles for the compose modal itself */
.compose-modal-panel {
    max-width: 800px;
    height: 80vh;
    max-height: 700px;
}

.compose-modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.compose-modal-body .form-group {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--input-border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.compose-modal-body .form-group label {
    font-weight: 600;
    color: var(--light-text);
}

.compose-modal-body .form-group input {
    flex-grow: 1;
    border: none;
    background: none;
    outline: none;
    color: var(--input-text);
    font-size: 1rem;
    height: 40px;
}

.compose-modal-body .form-group-textarea {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem;
}

.compose-modal-body .form-group-textarea label {
     font-weight: 600;
     color: var(--light-text);
     margin-bottom: 0.75rem;
     flex-shrink: 0;
}

.compose-modal-body .composer-textarea {
    flex-grow: 1;
    border: none;
    padding: 0;
    background-color: transparent;
    min-height: 200px;
}
.compose-modal-body .composer-textarea:focus {
    box-shadow: none;
}

.compose-modal-panel .modal-footer {
    justify-content: space-between;
}
/* --- Styles for the new composer prompt container (COMM HUB) --- */
.composer-prompt-container {
    display: flex;
    align-items: center; /* Changed from flex-end to center for better vertical alignment */
    gap: 0.5rem;
    padding: 0.5rem 0.5rem 0.5rem 1.25rem; /* Adjusted padding to match the image */
    border: 1px solid var(--input-border);
    border-radius: 1rem; /* More rounded corners */
    background: linear-gradient(145deg, color-mix(in srgb, var(--card-bg) 95%, black), var(--card-bg)); /* Matching background gradient */
    box-shadow: 0 4px 15px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.2); /* Matching shadow */
    margin-bottom: 1rem;
    transition: all 0.2s ease-out; /* Smooth transition for hover/focus */
}

.composer-prompt-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 20%, transparent), 0 6px 20px rgba(0,0,0,0.15); /* Focus shadow */
}

/* Style for the new plus button */
.composer-prompt-container .plus-btn {
    height: 44px; /* Ensure consistent button height */
    width: 44px; /* Ensure consistent button width */
    font-size: 1.2rem; /* Adjust icon size */
    flex-shrink: 0;
}


.composer-prompt-container .composer-textarea {
    flex-grow: 1;
    margin-bottom: 0;
    padding: 0; /* No internal padding for the textarea, it's now handled by parent */
    min-height: 44px; /* Ensure a minimum height for the textarea to match buttons */
    max-height: 150px;
    overflow-y: auto;
    border: none; /* Remove border from textarea itself */
    background: none; /* Remove background from textarea itself */
    color: var(--input-text); /* Ensure text color is consistent */
    font-size: 1rem; /* Consistent font size */
    outline: none; /* Remove outline on focus */
    resize: none; /* Disable manual resizing by user */
}

/* Styles for the attachment/template buttons on the right of the input */
.composer-prompt-container .composer-prompt-actions { /* New class name */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.composer-prompt-container .composer-prompt-actions .btn-c-sq {
    height: 44px; /* Consistent height for these buttons */
    width: 44px; /* Consistent width for these buttons */
    font-size: 1.1rem; /* Adjust icon size */
}

/* Adjust the overall composer-area's padding if necessary, it should mostly contain the prompt container and send actions */
.composer-area {
    padding: 1rem 1.5rem;
    background-color: var(--sidebar-bg);
}

/* Ensure the main composer-actions (Send/AI Draft) remain on the right */
.composer-actions {
    display: flex;
    justify-content: flex-end; /* Push action buttons to the right */
    align-items: center;
    gap: 0.75rem;
    /* Removed padding here, as it's now on the .composer-area */
    /* If you want space between prompt container and these buttons, keep a margin-top on these buttons or a padding-bottom on the prompt container */
}

/* Ensure the AI Draft and Send buttons also have consistent heights */
.composer-actions .btn-c-sq,
.composer-actions .btn-primary {
    height: 44px;
    border-radius: 12px; /* Consistent with other btn-c-sq */
    font-weight: 600;
}
.composer-actions .btn-primary {
    padding: 0 1.25rem; /* Adjust padding for text and icon */
}
/* Further refined composer area for icon-only buttons */
.composer-prompt-container {
    /* Existing styles for the container */
    justify-content: space-between; /* Ensures the plus button is left, and actions are right */
}

.composer-prompt-container .composer-prompt-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Gap between AI Draft and Send buttons */
    flex-shrink: 0;
}

.composer-prompt-container .composer-prompt-actions .btn-c-sq.icon-only,
.composer-prompt-container .composer-prompt-actions .btn.icon-only-send {
    width: 44px; /* Ensure consistent width for icon-only buttons */
    height: 44px; /* Ensure consistent height for icon-only buttons */
    padding: 0; /* Remove padding for icon-only buttons */
    font-size: 1.1rem; /* Adjust icon size */
    flex-shrink: 0;
}

.composer-prompt-container .composer-prompt-actions .btn.icon-only-send {
    /* Specific styles for the send button if needed, e.g., to override btn-primary padding */
    background-color: var(--primary-color);
    color: #fff;
    border: none;
}

.composer-prompt-container .composer-prompt-actions .btn.icon-only-send:hover {
     background-color: color-mix(in srgb, var(--primary-color) 85%, black);
}

/* Ensure the main composer-actions div, now empty, doesn't take up space if not needed */
.composer-area .composer-actions {
    display: none; /* Hide if it's no longer used for buttons */
}
/* --- 15. LISTING STUDIO --- */

/* Make table avatars square for property images */
#listingsTable .lead-avatar {
    border-radius: var(--border-radius);
    width: 48px;
    height: 48px;
    background-color: var(--input-bg);
}

/* Wizard Styles */
.wizard-content {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex-grow: 1;
}

.wizard-step {
    display: none;
    animation: fadeIn 0.5s ease;
}
.wizard-step.active {
    display: block;
}

.wizard-step h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--heading-text);
}
.wizard-step p {
    font-size: 1rem;
    color: var(--light-text);
    margin-bottom: 2rem;
}

/* Form Grid for Wizard */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}
.form-grid .form-group {
    margin-bottom: 0;
}
.form-grid .form-group.span-2 {
    grid-column: span 2;
}

/* Compliance & Syndication Lists */
.compliance-checklist, .syndication-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.compliance-checklist li, .syndication-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--input-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--input-border);
}
.compliance-checklist li label, .syndication-list li label {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
/* --- Style updates for Listing Studio --- */

.filter-bar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
}

.filter-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Make form controls match the image */
#listing-studio-section .form-control-sm {
    border: 1px solid var(--border-color-2);
    width: 140px; /* Give them a consistent width */
}

/* Kebab Menu Dropdown Styles */
.action-cell {
    position: relative;
    text-align: right; /* Aligns the kebab button to the right of the cell */
}

/* in styles.css */

.action-cell .dropdown-menu {
    display: none; /* Hidden by default */
    position: absolute; /* FIX: Takes the menu out of the layout flow */
    top: calc(100% + 5px); /* FIX: Positions it 5px below the parent cell */
    right: 0; /* FIX: Aligns it to the right of the cell */
    z-index: 10; /* FIX: Ensures it appears on top of other card content */
    min-width: 180px;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    animation: fadeIn 0.1s ease-out;
}
/* in styles.css */

#leadsTable tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}
#leadsTable tbody tr:hover {
    background-color: var(--menu-hover-bg);
}

.action-cell .dropdown-item {
    display: flex; /* Use flex to align icon and text */
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: var(--bs-body-color);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
}

.action-cell .dropdown-item:hover {
    background-color: var(--menu-hover-bg);
}

.action-cell .dropdown-item.delete-btn:hover {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
    font-weight: 500;
}
/* --- Enhanced Filter Control Styles for Listing Studio --- */

.filter-controls .form-control-sm {
    background-color: var(--menu-hover-bg); /* Gives the soft gray background color */
    border: 1px solid transparent;           /* Removes the hard border line */
    border-radius: 12px;                     /* Creates the "circle-squared" effect */
    color: var(--bs-body-color);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem; /* A bit more horizontal padding */
    height: 40px;
    width: 150px;
    transition: all 0.2s ease;
}

/* Add a subtle hover effect */
.filter-controls .form-control-sm:hover {
    background-color: var(--bs-border-color);
}

/* Keep the focus style clear and consistent */
.filter-controls .form-control-sm:focus {
    background-color: var(--input-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

/* Ensure the custom arrow in the select dropdowns remains visible */
.filter-controls select.form-control-sm {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.5rem; /* Make space for arrow */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b949e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
}
/* --- 16. DEAL ROOM STYLES --- */
.pipeline-overview {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
}
.stage-counter {
    flex-grow: 1;
    padding: 1rem;
    text-align: center;
    border-radius: 12px;
    background-color: var(--menu-hover-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}
.stage-counter:hover {
    background-color: var(--bs-border-color);
}
.stage-counter.active {
    border-color: var(--primary-color);
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
}
.stage-counter span { display: block; }
.stage-counter span.count { font-size: 1.75rem; font-weight: 600; color: var(--heading-text); }

#dealsTable .deal-row { cursor: pointer; }
#dealsTable .deal-row:hover { background-color: var(--menu-hover-bg); }

/* Drawer Styles */
.compliance-ribbon {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    flex-shrink: 0;
}
.compliance-ribbon.good { background-color: color-mix(in srgb, var(--success-color) 20%, transparent); color: var(--success-color); }
.compliance-ribbon.warning { background-color: color-mix(in srgb, var(--warning-color) 25%, transparent); color: var(--warning-color); }
.compliance-ribbon.danger { background-color: color-mix(in srgb, var(--danger-color) 15%, transparent); color: var(--danger-color); }

.drawer-tab-pane { display: none; }
.drawer-tab-pane.active { display: block; animation: fadeIn 0.3s; }

/* Bulk Actions Bar */
.bulk-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: #fff;
    border-radius: 12px;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s;
}
.bulk-actions-bar.hidden { display: none; }
.bulk-actions-bar span { font-weight: 600; }
.bulk-actions-bar .actions { display: flex; gap: 0.5rem; }
.bulk-actions-bar .btn-c-sq { background-color: rgba(255,255,255,0.1); color: #fff; }
.bulk-actions-bar .btn-c-sq:hover { background-color: rgba(255,255,255,0.2); }
.bulk-actions-bar .btn-c-sq.soft-red { background-color: var(--danger-color); }
/* --- Assign Lead Modal Styles --- */
.assign-lead-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex-grow: 1; /* Allows the list to take available space */
}
.assign-lead-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid var(--input-border);
}
.assign-lead-list li:last-child {
    border-bottom: none;
}
.assign-lead-list li:hover {
    background-color: var(--menu-hover-bg);
}
.assign-lead-list li.selected {
    background-color: color-mix(in srgb, var(--primary-color) 20%, transparent);
    font-weight: 600;
}
.assign-lead-list .lead-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}
.assign-lead-list .lead-info .name-text {
    font-weight: 600;
    color: var(--heading-text);
}
.assign-lead-list .lead-info .email-text {
    font-size: 0.85rem;
    color: var(--light-text);
}
.assign-lead-list .placeholder {
    padding: 2rem;
    text-align: center;
    color: var(--light-text);
}
/* --- 17. ENHANCED MODAL FOOTER BUTTONS --- */

/* Base style for all buttons inside the Assign Lead modal footer */
/* --- 19. ENHANCED DEAL WIZARD FOOTER BUTTONS (Soft Color Style) --- */

/* Style for the modal footer container */
#newDealModalFooter {
    background-color: var(--sidebar-bg);
    border-top: 1px solid var(--bs-border-color);
    box-shadow: 0 -5px 15px -5px rgba(0,0,0,0.1);
}

/* Base style for ALL buttons in the wizard footer */
#newDealModalFooter .btn {
    border-radius: 12px; /* Creates the "squared circle" shape */
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    transition: all 0.2s ease-out;
}

/* Specific styling for the "Back" button (already a soft style) */
#newDealModalFooter #dealWizardBackBtn {
    background-color: var(--menu-hover-bg);
    color: var(--bs-body-color);
}

#newDealModalFooter #dealWizardBackBtn:hover:not(:disabled) {
    background-color: var(--bs-border-color);
    transform: translateY(-1px);
}

/* Clear disabled state for the "Back" button */
#newDealModalFooter #dealWizardBackBtn:disabled {
    background-color: var(--input-bg);
    color: var(--light-text);
    opacity: 0.7;
    cursor: not-allowed;
}

/* --- NEW "SOFT COLOR" STYLES for the primary buttons --- */
#newDealModalFooter #dealWizardNextBtn,
#newDealModalFooter #dealWizardCreateBtn {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    border-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
}

#newDealModalFooter #dealWizardNextBtn:hover:not(:disabled),
#newDealModalFooter #dealWizardCreateBtn:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--primary-color) 10%, transparent);
}
/* Style for the "Cancel" button */
#assignLeadModal #cancelAssignLeadBtn {
    background-color: var(--menu-hover-bg); /* Soft gray background */
    color: var(--bs-body-color);
}

#assignLeadModal #cancelAssignLeadBtn:hover {
    background-color: var(--bs-border-color); /* Slightly darker gray on hover */
    transform: translateY(-1px);
}

/* Style for the main "Assign Selected Lead" button */
#assignLeadModal #confirmAssignLeadBtn {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

#assignLeadModal #confirmAssignLeadBtn:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--primary-color) 85%, black);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px color-mix(in srgb, var(--primary-color) 30%, transparent);
}

/* Style for the "Assign" button when it is DISABLED */
#assignLeadModal #confirmAssignLeadBtn:disabled {
    background-color: var(--bs-border-color);
    color: var(--light-text);
    box-shadow: none;
    cursor: not-allowed;
}
/* --- 18. NEW DEAL WIZARD MODAL --- */

#newDealModal.modal-panel {
    display: flex !important;
    flex-direction: column !important;
    height: 85vh; /* Keeps the modal from being taller than the screen */
}

/* 2. This tells the header, stepper, and footer to maintain their
      natural height and not shrink, even if content is large. */
#newDealModal .modal-header,
#newDealModal .deal-wizard-stepper,
#newDealModal .modal-footer {
    flex-shrink: 0; /* Prevents the footer from shrinking */
    display: flex !important; /* Forcefully ensures the footer is visible */
}

/* 3. This is the main fix. It tells the modal's body to:
      - Grow to fill all available vertical space (flex-grow: 1).
      - Add a vertical scrollbar ONLY if its content is too tall (overflow-y: auto).
      This prevents the modal itself from growing off-screen.
*/
#newDealModal .modal-body {
    overflow-y: auto;
    flex-grow: 1;    
}

/* Stepper Navigation */
.deal-wizard-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--bs-border-color);
    background-color: var(--input-bg);
    flex-shrink: 0; /* Prevents the stepper from shrinking */
}


/* Modal Footer */
#newDealModalFooter {
    flex-shrink: 0; /* Prevents the footer from shrinking */
}
.step-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--light-text);
    font-weight: 600;
    transition: color 0.3s ease;
}

.step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--card-bg);
    border: 2px solid var(--bs-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: all 0.3s ease;
}

.step-item.active .step-icon {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 10px color-mix(in srgb, var(--primary-color) 40%, transparent);
}
.step-item.active .step-label {
    color: var(--heading-text);
}
.step-item.completed .step-icon {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: #fff;
}
.step-item.completed .step-label {
    color: var(--light-text);
}


.step-connector {
    flex-grow: 1;
    height: 2px;
    background-color: var(--bs-border-color);
    margin: 0 1rem;
}

/* Wizard Step Content */
.deal-wizard-step {
    display: none;
    animation: fadeIn 0.2s ease-out;
}
.deal-wizard-step.active {
    display: block;
}

/* Re-usable form styles within the wizard */
.deal-wizard-step .form-group {
    margin-bottom: 1.5rem;
}
.deal-wizard-step .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.deal-wizard-step .form-group input,
.deal-wizard-step .form-group select {
    width: 100%;
    height: 44px;
    padding: 0 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    color: var(--input-text);
}
.deal-wizard-step .form-group input:focus,
.deal-wizard-step .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}
.input-with-link {
    display: flex;
    align-items: center;
}
.input-with-link input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}
.input-with-link a {
    display: inline-block;
    padding: 0 1rem;
    height: 44px;
    line-height: 44px;
    background-color: var(--menu-hover-bg);
    border: 1px solid var(--input-border);
    border-left: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    white-space: nowrap;
    font-weight: 500;
}

/* Review Step Panel */
.review-summary-panel {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.review-section {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
}
.review-section h4 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
}
.review-section p {
    margin-bottom: 0.5rem;
    color: var(--light-text);
}
.review-section p strong {
    color: var(--bs-body-color);
    margin-right: 0.5rem;
}

.key-dates-timeline {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}
/* --- 20. DEAL WIZARD - LISTING SELECTION CARDS --- */

#dealListingSelectionContainer {
    margin-bottom: 1.5rem;
}

.listing-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    max-height: 350px;
    overflow-y: auto;
    padding: 1rem;
    margin-top: 1rem;
    background-color: var(--input-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--input-border);
}

.listing-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    border: 2px solid var(--bs-border-color);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.listing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color-2);
}

.listing-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-4px) scale(1.02);
}

.listing-card-image {
    height: 120px;
    background-size: cover;
    background-position: center;
    background-color: var(--menu-hover-bg);
}

.listing-card-info {
    padding: 0.75rem;
}

.listing-card-info .address {
    font-weight: 600;
    color: var(--heading-text);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listing-card-info .price {
    font-size: 0.85rem;
    color: var(--light-text);
}

.listing-cards-container .placeholder-card {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--light-text);
    font-weight: 500;
}

/* Manual Entry Header */
.manual-entry-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1rem;
    height: 24px; /* Reserve space to prevent layout shift */
}

.manual-entry-header a {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--bs-link-color);
}
.manual-entry-header a i {
    margin: 0 0.5rem;
}
/* --- 21. DEAL WIZARD ENHANCED CHECKBOXES (IMPROVED) --- */

.syndication-list {
  display: flex;
  align-items: center;
  gap: 1rem;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius-lg);
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 500;
  color: var(--light-text);
  transition: all 0.25s ease-out;
}

/* On hover, the border becomes the primary color for a clear highlight */
.syndication-list:hover {
  transform: translateY(-2px);
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px color-mix(in srgb, var(--primary-color) 10%, transparent);
}

.syndication-list input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  flex-shrink: 0;
  width: 22px;  /* Slightly larger */
  height: 22px; /* Slightly larger */
  background-color: var(--card-bg);
  border: 2px solid var(--bs-border-color);
  border-radius: 6px;
  display: grid;
  place-content: center;
  transition: all 0.2s ease-in-out;
}

/* The checkmark icon inside the box */
.syndication-list input[type="checkbox"]::before {
  content: '';
  width: 12px; /* Larger checkmark */
  height: 12px; /* Larger checkmark */
  transform: scale(0);
  transition: 0.15s transform ease-in-out;
  box-shadow: inset 1em 1em #fff; /* White checkmark */
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

/* When the checkbox is checked, the background fills with the primary color */
.syndication-list input[type="checkbox"]:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  /* Add a glow effect when checked */
  box-shadow: 0 0 10px color-mix(in srgb, var(--primary-color) 40%, transparent);
}

/* When checked, the checkmark scales into view */
.syndication-list input[type="checkbox"]:checked::before {
  transform: scale(1);
}

/* When the entire label is clicked and the checkbox becomes checked, the label text style changes */
.syndication-list:has(input:checked) {
  border-color: var(--primary-color);
  background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
}

.syndication-list:has(input:checked) span {
    color: var(--heading-text);
    font-weight: 600;
}
/* =================================================================== */
/* === 22. CALENDAR & APPOINTMENTS TAB (PERFORMANCE & STYLE REMAKE) === */
/* =================================================================== */

/* --- A. Main Layout & View Switcher --- */
.calendar-layout {
    display: grid;
    grid-template-columns: 280px 1fr; /* Fixed sidebar, flexible main content */
    gap: 1.5rem;
    /* Full viewport height minus header, canvas padding top/bottom */
    height: calc(100vh - 70px - 4rem); 
}

.calendar-main {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#calendarViewSwitcher .btn-group .btn-c-sq.active {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    font-weight: 600;
}

/* --- B. Calendar Sidebar --- */
.calendar-sidebar {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
}

.sidebar-widget .widget-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--light-text);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
}

/* Custom Checkbox Filters in Sidebar */
.filter-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.filter-list label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: background-color 0.2s;
}

.filter-list label:hover {
    background-color: var(--menu-hover-bg);
}

.filter-list input[type="checkbox"] {
    appearance: none;
    margin: 0;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    background-color: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 6px;
    display: grid;
    place-content: center;
    transition: all 0.2s ease-in-out;
}

.filter-list input[type="checkbox"]::before {
    content: '';
    width: 9px;
    height: 9px;
    transform: scale(0);
    transition: 0.1s transform ease-in-out;
    box-shadow: inset 1em 1em #fff;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.filter-list input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.filter-list input[type="checkbox"]:checked::before {
    transform: scale(1);
}

/* Upcoming Reminders List */
.reminder-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.reminder-list li {
    position: relative;
    padding-left: 1.25rem;
    font-weight: 500;
    color: var(--heading-text);
}

.reminder-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-color);
}

.reminder-list li small {
    display: block;
    color: var(--light-text);
    font-size: 0.85rem;
    font-weight: 400;
}

/* --- C. Main Calendar Grid & View Switching (Performance Fix) --- */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

.calendar-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--heading-text);
    text-align: center;
    flex-grow: 1;
}

.calendar-body-container {
    position: relative;
    flex-grow: 1;
    overflow: visible; /* <-- Change from hidden to visible */
}

.calendar-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background-color: var(--card-bg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-in-out;
}

.calendar-view.active {
    opacity: 1;
    pointer-events: auto;
}

#monthView {
    display: flex;
    flex-direction: column;
}

.calendar-grid-header, .calendar-grid-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    width: 100%;
}

.calendar-grid-header {
    font-weight: 600;
    color: var(--light-text);
    text-align: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

.calendar-grid-body {
    flex-grow: 1;
}

.calendar-day {
    border-right: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0.5rem;
    transition: background-color 0.2s ease;
    position: relative;
    cursor: pointer;
}
.calendar-day:nth-child(7n) { border-right: none; }
.calendar-day.not-current-month {
    background-color: var(--input-bg);
    pointer-events: none;
}
.calendar-day:not(.not-current-month):hover { 
    background-color: var(--menu-hover-bg); 
}

.day-number {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--light-text);
    text-align: right;
    margin-bottom: 0.5rem;
}

.calendar-day.today .day-number {
    color: #fff;
    background-color: var(--primary-color);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    float: right;
}

/* --- D. Modals & Drawers (Performance Fix) --- */

/* Base Overlay for all popups in this section */
#newAppointmentModalOverlay,
#dayDetailDrawerOverlay,
#eventDrawerOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Animation properties */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}

/* Active (visible) state for overlays */
#newAppointmentModalOverlay.is-visible,
#dayDetailDrawerOverlay.is-open,
#eventDrawerOverlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Modal Panel Animation */
#newAppointmentModalOverlay .modal-panel {
    transform: scale(0.95) translateY(15px);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

#newAppointmentModalOverlay.is-visible .modal-panel {
    transform: scale(1) translateY(0);
}

/* Drawer Animation */
#dayDetailDrawer, #eventDrawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    background-color: var(--sidebar-bg);
    box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--bs-border-color);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#dayDetailDrawerOverlay.is-open #dayDetailDrawer,
#eventDrawerOverlay.is-open #eventDrawer {
    transform: translateX(0);
}

/* --- E. New Appointment Modal Styling --- */

.form-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.participants-container {
    position: relative;
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    background-color: var(--input-bg);
    transition: all 0.2s ease;
}
.participants-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

.selected-participants-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
}

.participant-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--menu-hover-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
}
.participant-pill .lead-avatar-sm {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 0.7rem;
}
.participant-pill .remove-pill-btn {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--light-text);
}
.participant-pill .remove-pill-btn:hover {
    color: var(--danger-color);
}

.participant-search-wrapper #participantSearchInput {
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--input-border);
    background-color: transparent;
}
.participant-search-wrapper #participantSearchInput:focus {
    box-shadow: none;
}

.participant-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    z-index: 10;
    list-style: none;
    box-shadow: var(--shadow-md);
}

.participant-search-results li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
}
.participant-search-results li:hover {
    background-color: var(--menu-hover-bg);
}

/* Modal Footer Buttons */
#newAppointmentModalOverlay .modal-footer {
    background-color: var(--sidebar-bg);
    border-top: 1px solid var(--bs-border-color);
}

#newAppointmentModalOverlay .modal-footer .btn {
    border-radius: 12px;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border: none;
    transition: all 0.2s ease-out;
}

#newAppointmentModalOverlay .modal-footer .btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}
#newAppointmentModalOverlay .modal-footer .btn-primary:hover {
    background-color: color-mix(in srgb, var(--primary-color) 85%, black);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

/* --- F. Day Detail Drawer Styling --- */
.appointment-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
/* In styles.css */

.appointment-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--input-bg);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--secondary-color);
    cursor: pointer; /* <-- Add this for the hand cursor */
    transition: all 0.2s ease;
}

.appointment-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    background-color: var(--menu-hover-bg); /* <-- Add this for the grey hover state */
}

/* This is the new rule for the selected state */
.appointment-item.selected {
    background-color: var(--menu-hover-bg);
    border-color: var(--primary-color) !important; /* Use important to override other border colors */
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}



.appointment-time {
    font-weight: 600;
    color: var(--heading-text);
    width: 70px;
}

.appointment-details .appointment-title {
    font-weight: 600;
    color: var(--bs-body-color);
}

.appointment-details .appointment-participants {
    font-size: 0.85rem;
    color: var(--light-text);
}

.no-appointments-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--light-text);
    font-style: italic;
}

.conflict-alert {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    font-weight: 600;
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
    border: 1px solid color-mix(in srgb, var(--danger-color) 30%, transparent);
}
/* === 23. CALENDAR VIEWS & EVENTS (WEEK, DAY, AGENDA) === */

/* === 23. CALENDAR VIEWS & EVENTS (WEEK, DAY, AGENDA) === */

/* --- A. Timeline View (For Week & Day) --- */
.timeline-view {
    display: flex;
    /* The "height: 100%;" rule has been removed to allow the timeline to expand vertically. */
}   

.time-labels {
    flex-shrink: 0;
    width: 80px;
    padding-top: 90px; /* This is the second key change: 30px (header) + 60px (all-day row) */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--light-text);
    text-align: right;
    border-right: 1px solid var(--bs-border-color);
}

/* New styles for perfect grid alignment */
.time-label {
    height: 60px; /* Match the .hour-slot height */
    flex-shrink: 0; /* Prevent flex from resizing it */
    box-sizing: border-box;
    position: relative;
    text-align: right;
    padding-right: 10px;
    /* Pull the text up so it sits ON the line, not inside the box */
    transform: translateY(-0.5em);
    line-height: 1;
    color: var(--light-text);
    font-size: 0.8rem;
    font-weight: 500;
}

/* The first label (12 AM) should not be pulled up out of view */
.time-label:first-child {
    transform: translateY(0);
    visibility: hidden; /* Hide the 12 AM label at the very top for a cleaner look */
}

/* Re-align the tick mark with the transformed text */
.time-label::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0.5em; /* This should now align with the text's new position */
    width: 10px;
    height: 1px;
    background-color: var(--border-color-2);
}

.timeline-grid {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative; /* For event positioning */
}

.timeline-header {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr)); /* 7 days for week view */
    flex-shrink: 0;
    height: 30px;
    border-bottom: 1px solid var(--bs-border-color);
}
#dayView .timeline-header {
    grid-template-columns: 1fr; /* 1 day for day view */
}

.timeline-header-day {
    text-align: center;
    font-weight: 600;
    color: var(--heading-text);
    border-right: 1px solid var(--bs-border-color);
}
.timeline-header-day:last-child {
    border-right: none;
}

.timeline-body {
    flex-grow: 1;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}
/* This new rule targets the specific container for timed events */
.timeline-day-grid-body {
    position: relative;
    flex-grow: 1;
    background-image: linear-gradient(var(--bs-border-color) 1px, transparent 1px);
    background-size: 100% 60px;
}
#dayView .timeline-body {
    grid-template-columns: 1fr; /* 1 day for day view */
}

/* styles.css */

/* --- FIX: This rule ensures all day columns have equal width --- */
.timeline-day-column {
    border-right: 1px solid var(--bs-border-color);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* This correctly hides overflowing content now */
    min-width: 0; /* This is the crucial addition that allows columns to shrink */
}
.timeline-day-column:last-child {
    border-right: none;
}

.hour-slot {
    height: 60px; /* This defines the row height for one hour */
    border-top: 1px solid var(--bs-border-color);
    box-sizing: border-box;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.hour-slot:last-child {
    border-bottom: none; /* No bottom border on the last row */
}

.hour-slot:hover {
    background-color: var(--menu-hover-bg); /* The grey highlight on hover */
}
.timeline-day-column:last-child {
    border-right: none;
}

/* --- B. Agenda View --- */
.agenda-view-content {
    padding: 1.5rem;
    overflow-y: auto;
}

.agenda-day-group {
    margin-bottom: 2rem;
}

.agenda-day-header {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--heading-text);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.agenda-event-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.agenda-event-item {
    display: flex;
    gap: 1rem;
    background-color: var(--input-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
    border-left: 5px solid; /* The colored priority border */
    transition: all 0.2s ease-out;
    cursor: pointer;
}
.agenda-event-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    background-color: var(--menu-hover-bg);
}

.agenda-event-time {
    font-weight: 600;
    color: var(--light-text);
    width: 120px;
}

.agenda-event-details h4 {
    font-weight: 600;
    color: var(--bs-body-color);
    margin: 0 0 4px 0;
}
.agenda-event-details p {
    font-size: 0.9rem;
    color: var(--light-text);
    margin: 0;
}

/* --- C. Event Styling & Prioritization Colors --- */
.calendar-event {
    position: absolute;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    color: #fff;
    font-weight: 500;
    font-size: 0.8rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    cursor: pointer;
}
.calendar-event:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
    box-shadow: var(--shadow-md);
}
.event-title {
    font-weight: 600;
    display: block;
}
.event-time {
    opacity: 0.8;
}

/* Soft Color Palette for Event Types */
.event-showing, .agenda-event-item.event-showing {
    background-color: color-mix(in srgb, #3b82f6 80%, black); /* Soft Blue */
    border-color: #3b82f6;
}
.event-meeting, .agenda-event-item.event-meeting {
    background-color: color-mix(in srgb, #16a34a 80%, black); /* Soft Green */
    border-color: #16a34a;
}
.event-task, .agenda-event-item.event-task {
    background-color: color-mix(in srgb, #f97316 80%, black); /* Soft Orange */
    border-color: #f97316;
}
.event-deadline, .agenda-event-item.event-deadline {
    background-color: color-mix(in srgb, #dc2626 80%, black); /* Soft Red */
    border-color: #dc2626;
}
.event-personal, .agenda-event-item.event-personal {
    background-color: color-mix(in srgb, #7c3aed 80%, black); /* Soft Purple */
    border-color: #7c3aed;
}

/* Month view event indicators */
.day-events {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.event-dot.event-showing { background-color: #3b82f6; }
.event-dot.event-meeting { background-color: #16a34a; }
.event-dot.event-task { background-color: #f97316; }
.event-dot.event-deadline { background-color: #dc2626; }
.event-dot.event-personal { background-color: #7c3aed; }
/* === 24. ENHANCED AGENDA VIEW STYLES === */

.agenda-event-item {
    display: flex;
    align-items: center;
    gap: 1.5rem; /* Increased gap for better spacing */
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-lg); /* Softer, larger radius */
    border: 1px solid transparent; /* Prepare for hover border */
    border-left-width: 5px; /* Keep the colored left border for emphasis */
    transition: all 0.2s ease-out;
    cursor: pointer;
}

.agenda-event-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color-2);
}

.agenda-event-time {
    font-weight: 600;
    color: var(--heading-text);
    width: 130px; /* Give it a fixed width */
    flex-shrink: 0;
    text-align: right;
    font-size: 0.9rem;
}

/* NEW: Icon styles */
.agenda-event-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%; /* Circular icon background */
    flex-shrink: 0;
    font-size: 1rem;
}

.agenda-event-details h4 {
    margin: 0 0 2px 0; /* Adjust margin */
    font-weight: 600;
    font-size: 1rem;
}

.agenda-event-details p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--light-text);
}


/* --- New Soft Color Palette --- */

/* Showing (Blue) */
.agenda-event-item.event-showing {
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    border-left-color: var(--primary-color);
}
.agenda-event-item.event-showing .agenda-event-icon {
    background-color: color-mix(in srgb, var(--primary-color) 20%, transparent);
    color: var(--primary-color);
}
.agenda-event-item.event-showing .agenda-event-details h4 {
    color: var(--primary-color);
}


/* Meeting (Green) */
.agenda-event-item.event-meeting {
    background-color: color-mix(in srgb, var(--success-color) 10%, transparent);
    border-left-color: var(--success-color);
}
.agenda-event-item.event-meeting .agenda-event-icon {
    background-color: color-mix(in srgb, var(--success-color) 20%, transparent);
    color: var(--success-color);
}
.agenda-event-item.event-meeting .agenda-event-details h4 {
    color: var(--success-color);
}

/* Task (Orange) */
.agenda-event-item.event-task {
    background-color: color-mix(in srgb, var(--warning-color) 15%, transparent);
    border-left-color: var(--warning-color);
}
.agenda-event-item.event-task .agenda-event-icon {
    background-color: color-mix(in srgb, var(--warning-color) 25%, transparent);
    color: var(--warning-color);
}
.agenda-event-item.event-task .agenda-event-details h4 {
    color: var(--warning-color);
}

/* Deadline (Red) */
.agenda-event-item.event-deadline {
    background-color: color-mix(in srgb, var(--danger-color) 10%, transparent);
    border-left-color: var(--danger-color);
}
.agenda-event-item.event-deadline .agenda-event-icon {
    background-color: color-mix(in srgb, var(--danger-color) 20%, transparent);
    color: var(--danger-color);
}
.agenda-event-item.event-deadline .agenda-event-details h4 {
    color: var(--danger-color);
}

/* Personal (Purple) */
.agenda-event-item.event-personal {
    background-color: color-mix(in srgb, #7c3aed 10%, transparent);
    border-left-color: #7c3aed;
}
.agenda-event-item.event-personal .agenda-event-icon {
    background-color: color-mix(in srgb, #7c3aed 20%, transparent);
    color: #7c3aed;
}
.agenda-event-item.event-personal .agenda-event-details h4 {
    color: #7c3aed;
}
.calendar-event {
    position: absolute;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: none; /* Use border instead of shadow for a flatter look */
    transition: all 0.2s ease;
    cursor: pointer;
}

.calendar-event .event-title {
    font-weight: 600;
    display: block;
    font-size: 0.85rem;
}

.calendar-event .event-time {
    font-weight: 500;
    opacity: 0.8;
}

/* --- Base Style for Events in AGENDA View --- */
.agenda-event-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-lg);
    border: 1px solid transparent;
    border-left-width: 5px; /* Keeps the colored left accent bar */
    transition: all 0.2s ease-out;
    cursor: pointer;
}

.agenda-event-item:hover {
    transform: translateY(-2px);
    border-color: var(--border-color-2);
}

.agenda-event-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 1rem;
}

.agenda-event-details h4 {
    margin: 0 0 2px 0;
    font-weight: 600;
    font-size: 1rem;
}


/* --- DYNAMIC SOFT COLOR THEME --- */

/* Showing (Blue) */
.calendar-event.event-showing,
.agenda-event-item.event-showing {
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 30%, transparent);
    color: var(--primary-color);
}
.agenda-event-item.event-showing .agenda-event-icon {
    background-color: color-mix(in srgb, var(--primary-color) 20%, transparent);
    color: var(--primary-color);
}
.agenda-event-item.event-showing .agenda-event-details h4 {
    color: var(--primary-color);
}


/* Meeting (Green) */
.calendar-event.event-meeting,
.agenda-event-item.event-meeting {
    background-color: color-mix(in srgb, var(--success-color) 10%, transparent);
    border-color: color-mix(in srgb, var(--success-color) 30%, transparent);
    color: var(--success-color);
}
.agenda-event-item.event-meeting .agenda-event-icon {
    background-color: color-mix(in srgb, var(--success-color) 20%, transparent);
    color: var(--success-color);
}
.agenda-event-item.event-meeting .agenda-event-details h4 {
    color: var(--success-color);
}


/* Task (Orange) */
.calendar-event.event-task,
.agenda-event-item.event-task {
    background-color: color-mix(in srgb, var(--warning-color) 15%, transparent);
    border-color: color-mix(in srgb, var(--warning-color) 40%, transparent);
    color: color-mix(in srgb, var(--warning-color) 85%, black); /* Darker text for yellow */
}
.agenda-event-item.event-task .agenda-event-icon {
    background-color: color-mix(in srgb, var(--warning-color) 25%, transparent);
    color: color-mix(in srgb, var(--warning-color) 85%, black);
}
.agenda-event-item.event-task .agenda-event-details h4 {
    color: color-mix(in srgb, var(--warning-color) 85%, black);
}


/* Deadline (Red) */
.calendar-event.event-deadline,
.agenda-event-item.event-deadline {
    background-color: color-mix(in srgb, var(--danger-color) 10%, transparent);
    border-color: color-mix(in srgb, var(--danger-color) 30%, transparent);
    color: var(--danger-color);
}
.agenda-event-item.event-deadline .agenda-event-icon {
    background-color: color-mix(in srgb, var(--danger-color) 20%, transparent);
    color: var(--danger-color);
}
.agenda-event-item.event-deadline .agenda-event-details h4 {
    color: var(--danger-color);
}


/* Personal (Purple) */
.calendar-event.event-personal,
.agenda-event-item.event-personal {
    background-color: color-mix(in srgb, #7c3aed 10%, transparent);
    border-color: color-mix(in srgb, #7c3aed 30%, transparent);
    color: #7c3aed;
}
.agenda-event-item.event-personal .agenda-event-icon {
    background-color: color-mix(in srgb, #7c3aed 20%, transparent);
    color: #7c3aed;
}
.agenda-event-item.event-personal .agenda-event-details h4 {
    color: #7c3aed;
}
/* =================================== */
/* === 26. WORKFLOW AUTOMATION (AGENT-BASED) === */
/* =================================== */

/* --- A. Sub-Navbar --- */
.sub-navbar {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 2rem;
}

.sub-nav-link {
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    color: var(--light-text);
    border-bottom: 3px solid transparent;
    margin-bottom: -1px; /* Aligns with the parent border */
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.2s ease;
}

.sub-nav-link:hover {
    color: var(--heading-text);
    background-color: var(--menu-hover-bg);
}

.sub-nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.automation-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.automation-pane.active {
    display: block;
}


/* --- B. Agent Roster --- */
.agent-roster-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.agent-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--card-bg);
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    transition: all 0.2s ease-out;
    cursor: pointer;
    position: relative;
}

.agent-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color-2);
}

.agent-avatar {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    flex-shrink: 0;
}

.agent-info {
    flex-grow: 1;
}

.agent-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    margin: 0 0 4px;
}

.agent-info p {
    font-size: 0.9rem;
    color: var(--light-text);
    margin: 0;
}

.agent-status-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin: 0 0.5rem;
    flex-shrink: 0;
}

.agent-status-light.running {
    background-color: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

.agent-status-light.paused {
    background-color: var(--warning-color);
    box-shadow: 0 0 8px var(--warning-color);
}

.agent-menu-btn {
    height: 36px;
    width: 36px;
}

/* --- C. Playbook Board (Kanban) --- */
.playbook-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
    min-height: 500px;
}

.kanban-column {
    background-color: var(--input-bg);
    border-radius: var(--border-radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.kanban-header {
    font-size: 1rem;
    font-weight: 600;
    color: var(--light-text);
    padding: 0 0.5rem 1rem;
    border-bottom: 1px solid var(--input-border);
    margin-bottom: 1rem;
}

.kanban-header .item-count {
    background-color: var(--menu-hover-bg);
    color: var(--light-text);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.kanban-list {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.playbook-capsule {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: grab;
    transition: box-shadow 0.2s ease;
}
.playbook-capsule:active {
    cursor: grabbing;
    box-shadow: var(--shadow-lg);
}

.capsule-agent-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.capsule-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 2px;
}

.capsule-info span {
    font-size: 0.8rem;
    color: var(--light-text);
}


/* --- D. Drawers, Modals & Run Monitor --- */
.summary-list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.summary-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--light-text);
}
.summary-item strong {
    color: var(--heading-text);
    font-weight: 600;
}
.linked-playbook-list {
    list-style: none;
    padding: 0 1rem 1rem;
}
.linked-playbook-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--input-border);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.linked-playbook-list li:last-child {
    border-bottom: none;
}


.run-monitor-panel {
    position: fixed;
    right: 0;
    top: 70px; /* Below top header */
    width: 320px;
    height: auto;
    max-height: calc(100vh - 90px);
    background-color: var(--sidebar-bg);
    border: 1px solid var(--bs-border-color);
    border-right: none;
    border-radius: 12px 0 0 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1045;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
}
.run-monitor-panel:not(.hidden) {
    transform: translateX(0);
}

.run-monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}
.run-monitor-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--heading-text);
}
#closeRunMonitorBtn {
    background: none; border: none; font-size: 1.1rem; color: var(--light-text); cursor: pointer;
}

.run-monitor-list {
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.run-item {
    display: flex;
    gap: 0.75rem;
}
.run-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.run-item-details {
    flex-grow: 1;
}
.run-playbook-name, .run-current-step { display: block; }
.run-playbook-name { font-weight: 600; font-size: 0.9rem; }
.run-current-step { font-size: 0.8rem; color: var(--light-text); }
.run-item.error .run-current-step { color: var(--danger-color); }

.run-progress-bar {
    height: 4px;
    background-color: var(--input-border);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}
.run-progress-bar div {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.run-item-time {
    font-size: 0.8rem;
    color: var(--light-text);
    font-weight: 500;
}

/* --- E. Playbook Builder --- */
.trigger-selection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}
.trigger-card {
    padding: 2rem;
    border: 2px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-out;
}
.trigger-card:hover {
    border-color: var(--border-color-2);
    transform: translateY(-5px);
}
.trigger-card.selected {
    border-color: var(--primary-color);
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    transform: translateY(-5px);
    box-shadow: 0 0 15px color-mix(in srgb, var(--primary-color) 20%, transparent);
}
.trigger-card i { color: var(--primary-color); margin-bottom: 1rem; }
.trigger-card h4 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--heading-text); }
.trigger-card p { color: var(--light-text); font-size: 0.9rem; }
/* =================================== */
/* === 27. AUTOMATION SETTINGS PANE === */
/* =================================== */

.settings-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.settings-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--heading-text);
}
.settings-header p {
    color: var(--light-text);
    font-size: 1rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: flex-start;
}

.settings-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-column .card .card-header {
    padding-bottom: 1rem;
    margin-bottom: 0;
    border-bottom: 1px solid var(--input-border);
}
.settings-column .card .card-content {
    padding: 1.5rem;
}

.settings-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.settings-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.settings-list li span {
    font-weight: 500;
    color: var(--bs-body-color);
}

.settings-divider {
    height: 1px;
    background-color: var(--input-border);
    margin: 1.5rem 0;
}

.settings-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    cursor: pointer;
}
.settings-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.settings-column .form-group {
    margin-bottom: 1.5rem;
}
.settings-column .form-group.inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.settings-column .form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}
.settings-column .form-group.inline label {
    margin-bottom: 0;
}


.time-window-inputs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.time-window-inputs span {
    font-weight: 600;
    color: var(--light-text);
}

.metric-display {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--heading-text);
    background-color: var(--input-bg);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--input-border);
}

.notification-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--input-border);
}
.notification-group:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.notification-group h4 {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 1rem;
}
.channel-toggles {
    display: flex;
    gap: 1.5rem;
}
.channel-toggles label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}
.channel-toggles input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary-color);
}

/* --- 28. ENHANCED SETTINGS FOOTER BUTTONS (Soft Style) --- */

/* Base style for both buttons in the settings footer */
.settings-footer .btn {
    border-radius: 12px; /* Consistent "circle-squared" shape */
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    transition: all 0.2s ease-out;
}

/* "Reset to Defaults" - Soft Gray Secondary Button */
.settings-footer .btn.btn-secondary-outline {
    background-color: var(--menu-hover-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

.settings-footer .btn.btn-secondary-outline:hover {
    background-color: var(--bs-border-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* "Save Changes" - Soft Blue Primary Button */
.settings-footer .btn.btn-primary {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    border-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
}

.settings-footer .btn.btn-primary:hover {
    background-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 10%, transparent);
}

@media (max-width: 992px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}
/* =================================== */
/* === 29. AGENT ROSTER ENHANCEMENTS === */
/* =================================== */

/* Wrapper for agent card action buttons */
.agent-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto; /* Pushes buttons to the right */
    flex-shrink: 0;
}

/* Info button specific style */
.agent-info-btn {
    height: 36px;
    width: 36px;
}

/* --- Soft Agent Avatar Backgrounds --- */
.agent-avatar.soft-red {
    background-color: color-mix(in srgb, #e54d4d 20%, var(--card-bg));
    color: #fca5a5;
}
.agent-avatar.soft-green {
    background-color: color-mix(in srgb, #479e53 20%, var(--card-bg));
    color: #86efac;
}
.agent-avatar.soft-yellow {
    background-color: color-mix(in srgb, #f2c94c 20%, var(--card-bg));
    color: #fde047;
}
.agent-avatar.soft-cyan {
    background-color: color-mix(in srgb, #56ccf2 20%, var(--card-bg));
    color: #67e8f9;
}
.agent-avatar.soft-purple {
    background-color: color-mix(in srgb, #9b51e0 20%, var(--card-bg));
    color: #d8b4fe;
}

/* --- Agent Description Modal --- */
#agentDescriptionModal .modal-body {
    line-height: 1.7;
    font-size: 1rem;
    color: var(--light-text);
}

#agentDescriptionModal .modal-header-text .name-text {
    color: var(--heading-text);
}

#agentDescriptionModal .modal-header-text .email-text {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
}
/* --- Agent Description Modal Footer Buttons (Soft Style) --- */

/* Targets the footer container itself */
#agentDescriptionModal .modal-footer {
    justify-content: flex-end; /* Aligns buttons to the right */
    background-color: var(--input-bg); /* Gives a slightly different background */
    border-top: 1px solid var(--input-border);
}

/* Base style for both buttons in this specific footer */
#agentDescriptionModal .modal-footer .btn {
    border-radius: 12px; /* Consistent "circle-squared" shape */
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    transition: all 0.2s ease-out;
}

/* "Close" button - Soft Gray Style */
#agentDescriptionModal .modal-footer #closeAgentDescriptionFooterBtn {
    background-color: var(--menu-hover-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

#agentDescriptionModal .modal-footer #closeAgentDescriptionFooterBtn:hover {
    background-color: var(--bs-border-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* "Watch Video" button - Soft Blue Style */
#agentDescriptionModal .modal-footer #watchVideoBtn {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    border-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
}

#agentDescriptionModal .modal-footer #watchVideoBtn:hover {
    background-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 10%, transparent);
}
/* Aligns icon and text in modal footer primary buttons */
.modal-footer .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}
/* In styles.css */

/* --- Video Modal Styles (V3 - Cinema Size) --- */

#videoModalPanel {
    /* This is the main change: We're making the modal much wider 
      to match the shape you drew.
    */
    width: 90vw;       /* It will now use 90% of the viewport's width. */
    max-width: 1800px;   /* A very generous limit for extra-large screens. */

    /* These styles remain to keep the dark aesthetic */
    background-color: #000;
    border: 1px solid var(--bs-border-color);
    
    /* We let the video content define the height automatically */
    height: auto; 
}

/* --- In styles.css --- */

/* Add these new rules for the video container and iframe */

.video-container {
    position: relative;
    width: 100%;
    /* This is the key: It forces the container to be a 16:9 rectangle */
    aspect-ratio: 16 / 9; 
    background-color: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
 /* The extra brace has been removed from here. */

#videoModalPanel {
    /* These styles will now be applied correctly. */
    width: 90vw;
    max-width: 1800px;
    background-color: #000;
    border: 1px solid var(--bs-border-color);
    height: auto;
}
/* =================================== */
/* === 30. FINANCE & TAX SECTION === */
/* =================================== */

/* Re-using .calendar-layout for the finance section's sidebar/main content structure */
#finance-section .calendar-layout {
    height: auto; /* Allow height to be determined by content */
    align-items: flex-start;
}

/* Vertical Sub-Navbar for Finance Section */
#finance-section .sub-navbar {
    flex-direction: column; /* Stack links vertically */
    border-bottom: none;
    border-right: 1px solid var(--bs-border-color); /* Vertical divider */
    margin-bottom: 0;
    padding-right: 1.5rem;
    height: 100%;
}

#finance-section .sub-nav-link {
    border-bottom: none; /* Remove bottom border */
    border-left: 3px solid transparent; /* Prepare for active indicator */
    margin-bottom: 0.25rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

#finance-section .sub-nav-link.active {
    border-left-color: var(--primary-color); /* Use left border as active indicator */
    border-bottom-color: transparent;
    background-color: var(--menu-hover-bg);
}

/* Ledger & Settings Panes (re-using .automation-pane) */
#finance-section .automation-pane {
    padding: 0 1.5rem;
}

/* Standalone Header for each pane */
#finance-section .card-header-standalone {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 1.5rem;
}
#finance-section .card-header-standalone h2 {
    font-size: 1.5rem;
}

/* Ledger Table Specifics */
#finance-section .styled-table td[style*="--success-color"] {
    font-weight: 600;
}
#finance-section .styled-table td[style*="--danger-color"] {
    font-weight: 600;
}
#finance-section .styled-table .fa-receipt {
    font-size: 1.1rem;
}

/* Tax Center Layout (re-using .settings-grid) */
#tax-center-pane .settings-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

#tax-center-pane .card .card-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--heading-text);
}

#tax-center-pane input[type="range"] {
    width: 100%;
    accent-color: var(--primary-color);
}

/* Tax Compliance Alert */
#tax-center-pane .compliance-ribbon {
    border-radius: var(--border-radius);
    margin-top: 1rem;
}
/* --- 31. FINANCE MODAL ENHANCEMENTS --- */

/* Ensures custom controls inside modals have consistent styling */
.modal-body .form-control-custom {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    color: var(--input-text);
    padding: 0.75rem 1rem;
    height: 44px;
    transition: all 0.2s ease;
}

.modal-body .form-control-custom:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

.modal-body textarea.form-control-custom {
    height: auto;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

/* Fixes the file input button text color */
.modal-body input[type="file"].form-control-custom {
    padding: 0.6rem 1rem;
}

/* Styles for the green checkmark in the ledger table */
#incomeLedgerTable .fa-check-circle.text-green {
    color: var(--success-color);
    font-size: 1.1rem;
}
/* In styles.css */

/* — Make New Income Modal Larger — */
#newIncomeModal {
  max-width: 900px;
  width: 90%;
  height: auto;
  max-height: 90vh;
}

/* — Soft-Style Footer Buttons — */
#newIncomeModal .modal-footer {
  justify-content: flex-end;
  background-color: var(--input-bg);
  border-top: 1px solid var(--input-border);
}

#newIncomeModal .modal-footer .btn {
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid transparent;
  transition: all 0.2s ease-out;
}

/* Cancel (Soft Gray) */
#newIncomeModal .modal-footer #cancelNewIncomeBtn {
  background-color: var(--menu-hover-bg);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}
#newIncomeModal .modal-footer #cancelNewIncomeBtn:hover {
  background-color: var(--bs-border-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Save (Soft Blue) */
#newIncomeModal .modal-footer #saveNewIncomeBtn {
  background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
  color: var(--primary-color);
  border-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
}
#newIncomeModal .modal-footer #saveNewIncomeBtn:hover {
  background-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
  border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 10%, transparent);
}
/* ─── Income Modal Listing Cards ─── */
#incomeListingContainer .listing-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  max-height: 300px;        /* adjust as needed */
  overflow-y: auto;
  padding: 1rem 0;
}

#incomeListingContainer .listing-card {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--border-radius);
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#incomeListingContainer .listing-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

#incomeListingContainer .listing-card.selected {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}
/* styles.css */

/* Add these new styles to your styles.css file */

/* Analytics Vault Specific Styles */

/* Filter & Context Bar */
.analytics-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: var(--border-radius-lg);
}

.analytics-filter-bar .filter-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Ensure filter dropdowns and inputs use the custom form-control-sm style */
.analytics-filter-bar .form-control-sm {
    background-color: var(--menu-hover-bg);
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--bs-body-color);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    height: 40px;
    width: auto; /* Allow width to adjust to content */
    min-width: 150px;
    transition: all 0.2s ease;
}

.analytics-filter-bar .form-control-sm:hover {
    background-color: var(--bs-border-color);
}

.analytics-filter-bar .form-control-sm:focus {
    background-color: var(--input-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

/* Specific styling for select dropdown arrows */
.analytics-filter-bar select.form-control-sm {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b949e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
}

.analytics-overview .kpi-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

.analytics-overview .kpi-card:hover {
    /* Instead of elevating, change background and border color */
    background-color: var(--menu-hover-bg); /* Use a subtle grey from your variables */
    border-color: var(--border-color-2); /* Slightly darker border on hover */
    transform: none; /* Remove elevation */
    box-shadow: none; /* Remove shadow */
}

.analytics-overview .kpi-card .trend-sparkline {
    /* Placeholder for actual sparkline charts */
    display: inline-block;
    width: 60px;
    height: 20px;
    background-color: rgba(126, 211, 33, 0.2); /* Example background for positive trend */
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 0.5rem;
}

/* styles.css */

/* Analytics Tabs Styling - Reverted to match .ai-command-tabs */
.analytics-tabs {
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 2rem;
    /* No specific background, padding, or border-radius here to keep it subtle */
}

/* Individual tab links within the analytics section will now inherit from .tab-nav .tab-link
   This assumes your .ai-command-tabs styling is providing the default
   behavior (e.g., color, font-weight, border-bottom).
*/
.analytics-tabs .tab-nav .tab-link {
    /* Ensure no conflicting styles are overriding the main tab-link styles */
    border-radius: 0; /* Remove specific border-radius if inherited from previous iteration */
    padding-bottom: 0.75rem; /* Reset padding-bottom for consistent height */
    margin-bottom: -1px; /* Maintain alignment with bottom border */
    box-shadow: none; /* Remove box-shadow */
    background-color: transparent; /* Ensure no background on non-active tabs */
}

.analytics-tabs .tab-nav .tab-link:hover {
    background-color: var(--menu-hover-bg); /* Use a standard hover background */
    border-color: transparent; /* No special border color on hover */
    border-radius: 0; /* Remove specific border-radius if inherited from previous iteration */
}

.analytics-tabs .tab-nav .tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: transparent; /* No background for active tab */
    box-shadow: none; /* No shadow for active tab */
    border-radius: 0; /* No special border-radius for active tab */
    padding-bottom: 0.75rem; /* Ensure consistent padding with other tabs */
}

/* Specific Table Row Hover Effect for the Conversion Funnel table */
#funnel-performance-tab .styled-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#funnel-performance-tab .styled-table tbody tr:hover {
    background-color: var(--menu-hover-bg); /* Turns grey on hover */
}
.analytics-tab-content .analytics-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}




.analytics-tab-content .analytics-pane.active {
    display: block;
}

/* styles.css */

/* Update the .funnel-chart-horizontal and .funnel-stage-h styles */
.funnel-chart-horizontal {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Slightly reduced gap for a tighter funnel look */
    padding: 1.5rem;
}

.funnel-stage-h {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.25rem;
    border-radius: 6px;
    color: #fff; /* Keep text white for contrast */
    font-weight: 500;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: width 0.5s cubic-bezier(0.25, 1, 0.5, 1), background-color 0.3s ease; /* Add transition for background */
    border: 1px solid transparent; /* Add a transparent border for consistency */
}
.funnel-chart-horizontal .funnel-stage-h:nth-child(1) { /* Prospects */
    background: color-mix(in srgb, var(--primary-color) 15%, transparent); /* Even softer blue */
    border-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
    color: var(--primary-color); /* Primary text color for contrast */
}

.funnel-chart-horizontal .funnel-stage-h:nth-child(2) { /* Qualified */
    background: color-mix(in srgb, var(--info-color) 15%, transparent); /* Softer info blue */
    border-color: color-mix(in srgb, var(--info-color) 25%, transparent);
    color: var(--info-color);
}

.funnel-chart-horizontal .funnel-stage-h:nth-child(3) { /* Showing */
    background: color-mix(in srgb, var(--warning-color) 15%, transparent); /* Softer warning orange */
    border-color: color-mix(in srgb, var(--warning-color) 25%, transparent);
    color: var(--warning-color);
}

.funnel-chart-horizontal .funnel-stage-h:nth-child(4) { /* Offer */
    background: color-mix(in srgb, var(--success-color) 15%, transparent); /* Softer success green */
    border-color: color-mix(in srgb, var(--success-color) 25%, transparent);
    color: var(--success-color);
}

.funnel-chart-horizontal .funnel-stage-h:nth-child(5) { /* Closed */
    background: color-mix(in srgb, var(--accent-color) 15%, transparent); /* Softer accent yellow */
    border-color: color-mix(in srgb, var(--accent-color) 25%, transparent);
    color: var(--accent-color);
}

.funnel-stage-h span:first-child {
    font-weight: 600;
}

/* Charts Placeholder Styling */
canvas {
    max-width: 100%;
    height: auto;
    padding: 1rem;
}
/* styles.css */
/* styles.css */
/* styles.css */

/* Networking & Referrals Layout */
/* THIS IS THE KEY FIX: The styles now only apply when the section is .active */
#networking-section.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px - 2rem); /* Ensure it takes available height */
}

/* New Sub-Navbar for Networking Section */
.networking-sub-navbar {
    margin-bottom: 2rem;
    /* This will inherit styles from .sub-navbar already defined */
}

.networking-tab-content {
    flex-grow: 1; /* Allows content to expand */
    display: flex; /* Use flex to manage inner panes */
    flex-direction: column;
}

.networking-pane {
    display: none;
    flex-grow: 1; /* Allow panes to take full height */
    animation: fadeIn 0.4s ease;
    overflow-y: auto; /* Enable scrolling for pane content */
    padding-bottom: 1.5rem; /* Add some bottom padding for content */
}

.networking-pane.active {
    display: flex; /* Use flex for inner content layout */
    flex-direction: column;
}

/* Main Layout for Dashboard Pane */
.networking-main-layout {
    display: grid;
    grid-template-columns: 280px 1fr 280px; /* Left sidebar, main content, right sidebar */
    gap: 1.5rem;
    flex-grow: 1; /* Allow this grid to fill available height */
    overflow: hidden; /* Hide overflow within the grid */
}

.agent-feed-panel,
.badge-ranking-panel {
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden; /* Ensure content doesn't spill */
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

.pane-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pane-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Agent Feed Specific */
.activity-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Slightly reduced gap */
}

.activity-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Reduced gap */
    background-color: color-mix(in srgb, var(--primary-color) 5%, transparent); /* Softer background */
    border: 1px solid color-mix(in srgb, var(--primary-color) 15%, transparent); /* Softer border */
    padding: 0.75rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.activity-list li:hover {
    background-color: var(--menu-hover-bg);
    border-color: var(--border-color-2);
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}
.activity-icon.soft-green {
    background-color: color-mix(in srgb, #2EBD85 80%, black); /* Soft background, strong icon color */
    color: #FFF;
}
.activity-icon.soft-blue {
    background-color: color-mix(in srgb, #4A90E2 80%, black);
    color: #FFF;
}
.activity-icon.soft-purple {
    background-color: color-mix(in srgb, #BD10E0 80%, black);
    color: #FFF;
}


.activity-details {
    flex-grow: 1;
}

.activity-details strong {
    display: block;
    font-weight: 600;
    color: var(--heading-text);
}

.activity-details .activity-time {
    font-size: 0.8rem;
    color: var(--light-text);
}

/* Map & Discovery Specific */
.map-discovery-panel {
    position: relative;
    display: flex;
    flex-direction: column;
}

.map-overlay-search {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    width: 100%;
    max-width: 400px; /* Constrain width */
    z-index: 10;
}

.map-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--input-bg);
    color: var(--light-text);
    font-size: 1.2rem;
    border-radius: var(--border-radius-lg);
    overflow: hidden; /* Important for embedded map later */
}

.map-controls {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 10;
}

/* Badge & Ranking Panel Specific */
.badge-ranking-panel {
    transition: transform 0.3s ease-in-out;
}

/* Collapsed state for the panel */
.badge-ranking-panel.collapsed {
    transform: translateX(calc(100% - 40px)); /* Hide all but a sliver */
}

.badge-ranking-panel.collapsed .pane-content {
    display: none;
}

.badge-ranking-panel.collapsed .pane-header .btn-c-sq i {
    transform: rotate(180deg);
}

.badge-progress-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.badge-progress-item h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--heading-text);
    margin-bottom: 0.5rem;
}

.badge-progress-item .progress-bar {
    height: 8px;
    background-color: var(--input-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.badge-progress-item .progress-bar div {
    height: 100%;
    border-radius: 4px;
}

.badge-progress-item span {
    font-size: 0.8rem;
    color: var(--light-text);
    font-weight: 500;
}

/* Referral Exchange Board */
.referral-exchange-board {
    padding: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    flex-grow: 1; /* Allow this card to fill available height in its pane */
}

.referral-tabs {
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 0; /* Remove default margin */
    padding: 0 1.5rem; /* Add horizontal padding to tabs container */
}

.referral-tab-content {
    padding: 1.5rem; /* Padding for the content inside tabs */
    flex-grow: 1; /* Allow content to grow */
    display: flex;
    flex-direction: column;
}

.referral-pane-inner {
    display: none;
    flex-grow: 1; /* Allow inner panes to fill height */
}

.referral-pane-inner.active {
    display: block;
}


.referral-table .lead-name .name-text {
    font-size: 0.95rem;
}
.referral-table .lead-name .email-text {
    font-size: 0.8rem;
}

/* Referral Exchange Table Row Styling with Soft Colors */
.referral-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent; /* Base border */
    background-color: color-mix(in srgb, var(--primary-color) 5%, transparent); /* Soft background */
}

.referral-table tbody tr:hover {
    background-color: var(--menu-hover-bg); /* Standard grey on hover */
    border-color: var(--border-color-2); /* Subtle border on hover */
}

/* Referral Exchange Card Actions */
.referral-table button.btn-c-sq {
    height: 32px; /* Smaller action buttons for table rows */
    font-size: 0.8rem;
    padding: 0 0.8rem;
}

/* Earnings Dashboard KPIs - NO soft colors on these specific KPI cards */
.referral-kpi {
    cursor: pointer;
    transition: all 0.2s ease;
}
.referral-kpi:hover {
    background-color: var(--menu-hover-bg);
    border-color: var(--border-color-2);
    transform: none;
    box-shadow: none;
}

/* Agent Profile Drawer */
#agentProfileDrawer .drawer-header .lead-name {
    display: flex;
    align-items: center;
    gap: 1rem;
}
#agentProfileDrawer .drawer-header .lead-name .lead-avatar {
    width: 60px;
    height: 60px;
    font-size: 2rem;
}
#agentProfileDrawer .drawer-header .lead-name h3 {
    font-size: 1.5rem;
    font-weight: 700;
}

#agentProfileDrawer .details-section h4,
#networkingSettingsDrawer .details-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--light-text);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

#agentProfileDrawer .kpi-grid {
    grid-template-columns: 1fr; /* Stack KPIs vertically in drawer for more space */
    gap: 1rem;
}

#agentProfileDrawer .quick-action-list.stacked .quick-action-item {
    padding: 0.8rem 1rem;
    font-weight: 500;
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent); /* Soft background */
    border: 1px solid color-mix(in srgb, var(--primary-color) 20%, transparent); /* Soft border */
}
#agentProfileDrawer .quick-action-list.stacked .quick-action-item:hover {
    background-color: var(--menu-hover-bg);
    border-color: var(--border-color-2);
}


/* Referral Contract Drawer */
#referralContractDrawer .timeline-list {
    list-style: none;
    padding-left: 1rem;
    border-left: 2px solid var(--bs-border-color);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
#referralContractDrawer .timeline-list li {
    position: relative;
    padding-left: 1.5rem;
    font-weight: 500;
    color: var(--heading-text);
}
#referralContractDrawer .timeline-list li i {
    position: absolute;
    left: -1.2rem;
    top: 2px;
    background-color: var(--sidebar-bg); /* Match drawer background to hide line */
    border-radius: 50%;
    padding: 2px;
}
#referralContractDrawer .timeline-list .timeline-date {
    display: block;
    font-size: 0.8rem;
    color: var(--light-text);
    font-weight: 400;
    margin-top: 0.2rem;
}
/* For the "Digital Contract Preview" card */
.card.soft-background {
    background-color: var(--input-bg); /* Use input background for softer look */
    border: 1px solid var(--input-border); /* Match input border */
}


/* Alerts & Notifications Modal */
.notification-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Reduced gap */
}
.notification-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: color-mix(in srgb, var(--primary-color) 5%, transparent); /* Soft background */
    border: 1px solid color-mix(in srgb, var(--primary-color) 15%, transparent); /* Soft border */
    border-radius: var(--border-radius);
    cursor: pointer;
}
.notification-list li:hover {
    background-color: var(--menu-hover-bg);
    border-color: var(--border-color-2);
}
.notification-list li i {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 3px; /* Align icon better with text */
}
.notification-list .notification-content strong {
    display: block;
    font-weight: 600;
    color: var(--heading-text);
    margin-bottom: 2px;
}
.notification-list .notification-content a {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Networking Settings Drawer */
#networkingSettingsDrawer .form-group .btn-group {
    display: flex;
    gap: 0; /* Remove gap between buttons */
}
#networkingSettingsDrawer .form-group .btn-group .btn-c-sq {
    border-radius: var(--border-radius); /* Default roundness */
    flex-grow: 1; /* Make them fill space */
}
#networkingSettingsDrawer .form-group .btn-group .btn-c-sq:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
#networkingSettingsDrawer .form-group .btn-group .btn-c-sq:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none; /* Remove border between them */
}
#networkingSettingsDrawer .channel-toggles label {
    background-color: color-mix(in srgb, var(--primary-color) 5%, transparent); /* Soft background */
    border: 1px solid color-mix(in srgb, var(--primary-color) 15%, transparent); /* Soft border */
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
}
#networkingSettingsDrawer .channel-toggles label:hover {
    background-color: var(--menu-hover-bg);
    border-color: var(--border-color-2);
}
/* styles.css */

/* Education Hub Layout */
#education-hub-section.active {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px - 2rem); /* Full height minus header and padding */
}

.education-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr; /* Main content wider, sidebar narrower */
    gap: 1.5rem;
    flex-grow: 1; /* Make the grid fill available space */
    overflow: hidden; /* Hide overflow */
}

.education-main-column, .education-sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding-bottom: 1.5rem; /* Padding for the bottom of the grid content */
}

/* Academy Launcher */
.academy-launcher {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
    flex-shrink: 0; /* Prevent shrinking */
}

.academy-launcher-btn {
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 5px 15px color-mix(in srgb, var(--primary-color) 25%, transparent);
}
.academy-launcher-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px color-mix(in srgb, var(--primary-color) 30%, transparent);
}

.academy-launcher-btn i {
    margin-right: 1rem;
    font-size: 1.3rem;
}

.academy-progress {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.academy-progress .progress-text {
    font-size: 0.95rem;
    color: var(--light-text);
    font-weight: 500;
}
.academy-progress .progress-text strong {
    color: var(--heading-text);
}

.academy-progress .progress-bar {
    height: 8px;
    background-color: var(--input-border);
    border-radius: 4px;
    overflow: hidden;
}
.academy-progress .progress-bar div {
    height: 100%;
    background-color: var(--success-color); /* Green progress bar */
    border-radius: 4px;
}

.academy-progress .last-lesson {
    font-size: 0.85rem;
    color: var(--light-text);
}
.academy-progress .last-lesson strong {
    color: var(--bs-body-color);
}


/* Learning Paths (Accordions) */
.learning-paths-accordions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Smaller gap between accordion items */
}

.accordion-item {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    background-color: var(--card-bg);
    overflow: hidden; /* Hide overflow for content */
    transition: background-color 0.2s ease;
}

.accordion-item.active {
    border-color: var(--primary-color);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.accordion-item.active .accordion-header {
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
}

.accordion-header:hover {
    background-color: var(--menu-hover-bg);
}

.accordion-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
}

.accordion-header i {
    transition: transform 0.3s ease;
}
.accordion-item.active .accordion-header i {
    transform: rotate(180deg);
}

.accordion-content {
    display: none; /* Controlled by JS */
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--input-border); /* Top border for content */
}

.track-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.track-list li a {
    display: block;
    padding: 0.5rem 0.75rem;
    background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary-color) 15%, transparent);
    border-radius: var(--border-radius);
    color: var(--primary-color);
    font-weight: 500;
    transition: all 0.2s ease;
}
.track-list li a:hover {
    background-color: var(--menu-hover-bg);
    border-color: var(--border-color-2);
    color: var(--heading-text);
}


/* Current Course Card */
.current-course-card {
    padding: 1.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.current-course-card .course-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
}

.current-course-card .course-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--heading-text);
}

.current-course-card .completion-percent {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--success-color);
}

.current-course-card .lesson-title {
    font-size: 1rem;
    color: var(--light-text);
    font-weight: 500;
}
.current-course-card .lesson-title strong {
    color: var(--bs-body-color);
}

.current-course-card .course-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--input-border);
}

.current-course-card .btn {
    flex-grow: 1;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
}

.current-course-card .audio-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    color: var(--light-text);
    font-weight: 500;
    font-size: 0.9rem;
}
.current-course-card .audio-mode-toggle .theme-switch.mini {
    width: 44px;
    height: 24px;
}
.current-course-card .audio-mode-toggle .slider:before {
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
}
.current-course-card .audio-mode-toggle input:checked + .slider:before {
    transform: translateX(20px);
}


/* Badge & Certificate Shelf */
.badge-certificate-shelf {
    padding: 1.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
}

.shelf-content {
    display: flex;
    overflow-x: auto;
    padding-bottom: 1rem; /* Space for scrollbar */
    gap: 1.5rem;
}
.shelf-content::-webkit-scrollbar { height: 6px; }
.shelf-content::-webkit-scrollbar-track { background: transparent; }
.shelf-content::-webkit-scrollbar-thumb { background-color: var(--input-border); border-radius: 3px; }
.shelf-content::-webkit-scrollbar-thumb:hover { background-color: var(--primary-color); }

.badge-item {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
    border: 3px solid transparent;
}
.badge-item:hover { transform: scale(1.05); }
.badge-item img { width: 100%; height: 100%; object-fit: cover; }
.badge-item.earned { border-color: var(--accent-color); box-shadow: 0 0 15px color-mix(in srgb, var(--accent-color) 40%, transparent); }
.badge-item.locked { filter: grayscale(100%) brightness(50%); opacity: 0.6; cursor: not-allowed; border-color: var(--light-text); }
.badge-item.locked:hover { transform: none; }

.certificate-icon {
    position: absolute;
    bottom: 5px; right: 5px;
    background-color: var(--primary-color);
    color: #FFF;
    border-radius: 50%;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}


/* Live Sessions Calendar */
.live-sessions-calendar {
    padding: 1.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
}

.session-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.session-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: color-mix(in srgb, var(--info-color) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--info-color) 15%, transparent);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    font-weight: 500;
    color: var(--heading-text);
}

.session-list li:hover {
    background-color: var(--menu-hover-bg);
    border-color: var(--border-color-2);
}

.session-list li span { font-size: 0.85rem; color: var(--light-text); white-space: nowrap; flex-shrink: 0; }
.session-list li h4 { flex-grow: 1; font-size: 0.95rem; font-weight: 600; margin: 0; color: var(--heading-text); }
.session-list li h4 strong { color: var(--primary-color); }
.session-list li .btn-c-sq { flex-shrink: 0; padding: 0.4rem 0.8rem; font-size: 0.85rem; height: auto; width: auto; }


/* AI Tutor - FlowCoach (Floating Chat Icon) */
.flowcoach-ai-tutor {
    position: fixed;
    bottom: 2rem; right: 2rem;
    width: 60px; height: 60px;
    background-color: var(--primary-color);
    color: #FFF;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; cursor: pointer;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: all 0.3s ease;
}
.flowcoach-ai-tutor:hover {
    transform: translateY(-3px) scale(1.05);
    background-color: color-mix(in srgb, var(--primary-color) 90%, black);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

/* AI Tutor Side Drawer */
#flowcoachDrawer .chat-messages { display: flex; flex-direction: column; gap: 1rem; padding: 1.5rem; flex-grow: 1; overflow-y: auto; }
#flowcoachDrawer .message { max-width: 85%; padding: 0.75rem 1rem; border-radius: var(--border-radius); font-size: 0.95rem; line-height: 1.5; word-wrap: break-word; }
#flowcoachDrawer .message.incoming { align-self: flex-start; background-color: var(--input-bg); border: 1px solid var(--input-border); color: var(--bs-body-color); border-bottom-left-radius: 4px; }
#flowcoachDrawer .message.outgoing { align-self: flex-end; background-color: var(--primary-color); color: #fff; border-bottom-right-radius: 4px; }
#flowcoachDrawer .chat-link-lesson { display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; padding: 0.5rem 0.75rem; background-color: color-mix(in srgb, var(--primary-color) 15%, transparent); color: var(--primary-color); border-radius: var(--border-radius); font-size: 0.85rem; font-weight: 600; transition: background-color 0.2s ease; }
#flowcoachDrawer .chat-link-lesson:hover { background-color: color-mix(in srgb, var(--primary-color) 25%, transparent); }
#flowcoachDrawer .drawer-footer { padding: 1rem; border-top: 1px solid var(--bs-border-color); background-color: var(--sidebar-bg); flex-shrink: 0; }
#flowcoachDrawer .drawer-footer .composer-prompt-container { margin-bottom: 0; }

/* Academy Overlay (iframe) */
.academy-iframe-modal { max-width: 90vw; height: 90vh; border-radius: var(--border-radius-lg); overflow: hidden; }
.academy-iframe-modal .modal-header { border-bottom: 1px solid var(--bs-border-color); flex-shrink: 0; }
.academy-iframe-modal .modal-body { flex-grow: 1; padding: 0; }
/* =================================== */
/* === SETTINGS SECTION === */
/* =================================== */

.settings-layout {
    display: grid;
    grid-template-columns: 240px 1fr; /* Fixed nav, flexible content */
    gap: 2rem;
    align-items: flex-start;
}

/* --- Settings Navigation (Left) --- */
.settings-nav ul {
    list-style: none;
    position: sticky;
    top: 2rem; /* Sticks below the canvas padding */
}

.settings-nav-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    color: var(--light-text);
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.settings-nav-link:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
}

.settings-nav-link.active {
    background-color: var(--menu-hover-bg);
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
}

/* --- Settings Content (Right) --- */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-pane {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.settings-pane.active {
    display: flex;
}

.settings-content .card .card-header {
    padding-bottom: 1rem;
    margin-bottom: 0;
}

.settings-card-content {
    padding: 1.5rem;
}

.settings-content .form-group {
    margin-bottom: 1.5rem;
}
.settings-content .form-group:last-child {
    margin-bottom: 0;
}

.settings-content .form-group label {
    display: block;
    font-weight: 500;
    color: var(--bs-body-color);
    margin-bottom: 0.5rem;
}
.settings-content .form-control-custom {
    background-color: var(--input-bg);
    border-color: var(--input-border);
}

.settings-pane .inline-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
}
.settings-pane .inline-setting label:not(.theme-switch) {
    margin: 0;
}


/* Integration List */
.integration-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}
.integration-list li {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--input-border);
}
.integration-list li:last-child {
    border-bottom: none;
}
.integration-list i {
    font-size: 1.8rem;
    color: var(--light-text);
    width: 30px;
    text-align: center;
}
.integration-list h3 {
    margin: 0 0 4px;
    color: var(--heading-text);
}
.integration-list p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--light-text);
}
.integration-list button {
    margin-left: auto;
}
/* ======================================= */
/* === V2: REDESIGNED APPOINTMENT MODAL === */
/* ======================================= */

.appointment-modal-v2 {
    background-color: var(--sidebar-bg);
    border-radius: 12px;
}

.modal-header-v2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.modal-title-text {
    font-size: 1.1rem;
    font-weight: 600;
}
.btn-icon-only {
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 1.1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}
.btn-icon-only:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
}

.modal-body-v2 {
    padding: 0.5rem 1.5rem 1.5rem 1.5rem;
    background-color: color-mix(in srgb, var(--primary-color) 5%, var(--sidebar-bg));
}

/* Mega Title Input */
.mega-input-wrapper {
    padding: 1rem 0 1.5rem 0;
}
.mega-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--heading-text);
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease;
}
.mega-input::placeholder {
    color: var(--light-text);
    font-weight: 600;
}
.mega-input:focus {
    border-bottom-color: var(--primary-color);
}

/* Form Sections and Rows */
.form-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.form-section-divider {
    height: 1px;
    background-color: var(--bs-border-color);
    margin: 1rem 0;
}
.form-row {
    position: relative; /* For search results positioning */
}

/* New Input Group Style */
.input-group-v2 {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--sidebar-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 0 0.75rem;
    transition: all 0.2s ease;
}
.input-group-v2:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}
.input-group-v2 .icon-prefix {
    color: var(--light-text);
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* Generic Form Control Style */
.form-control-v2 {
    flex-grow: 1;
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--input-text);
    height: 48px;
    padding: 0 0.5rem;
}
select.form-control-v2 {
    cursor: pointer;
}
textarea.form-control-v2 {
    height: auto;
    padding: 0.75rem 0.5rem;
    resize: vertical;
}

/* Time Inputs */
.time-inputs-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-grow: 1;
}
.time-inputs-wrapper .form-control-v2 {
    height: 44px; /* Slightly smaller for datetime */
}
.all-day-toggle-v2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
    cursor: pointer;
    font-weight: 500;
}
.all-day-toggle-v2 input {
    accent-color: var(--primary-color);
}

/* Pills / Chips Input (Participants, Reminders) */
.pills-input-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0;
}
.pills-input-container.reminders {
    min-height: 48px;
}
.selected-pills-v2 {
    display: contents; /* Makes children part of the flex layout */
}
.pills-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--input-text);
    min-width: 150px;
    padding: 0.25rem 0.5rem;
}
.add-reminder-btn-v2 {
    background: none;
    border: none;
    color: var(--bs-link-color);
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}
.add-reminder-btn-v2:hover {
    color: var(--bs-link-hover-color);
}
/* ======================================= */
/* === V3: APPOINTMENT MODAL REDESIGN   === */
/* ======================================= */

.appointment-modal-v3 .notes-group {
    align-items: flex-start;
}
.appointment-modal-v3 .notes-group .icon-prefix {
    margin-top: 12px;
}

/* AI Tip Button */
.btn-ai-tip {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background-color: transparent;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}
.btn-ai-tip:hover {
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
}
.btn-ai-tip img {
    width: 20px;
    height: 20px;
}

/* New Softer Footer Buttons */
.modal-footer-v2 {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background-color: var(--sidebar-bg);
    border-top: 1px solid var(--bs-border-color);
}
.btn-footer-v2 {
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-footer-v2.save {
    background-color: color-mix(in srgb, var(--primary-color) 90%, black);
    color: #fff;
    box-shadow: 0 4px 15px -5px color-mix(in srgb, var(--primary-color) 40%, transparent);
}
.btn-footer-v2.save:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -5px color-mix(in srgb, var(--primary-color) 40%, transparent);
}
.btn-footer-v2.cancel {
    background-color: var(--menu-hover-bg);
    color: var(--bs-body-color);
}
.btn-footer-v2.cancel:hover {
    background-color: var(--bs-border-color);
    color: var(--heading-text);
}
/* This new block makes the soft red color the default state */
.btn-footer-v2.delete {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
    font-weight: 600; /* Makes the text slightly bolder */
}

.btn-footer-v2.delete:hover {
    /* A new, slightly darker hover effect to provide user feedback */
    background-color: color-mix(in srgb, var(--danger-color) 25%, transparent);
    transform: translateY(-1px); /* Adds a subtle lift on hover */
}



/* FlowCore AI Chat Modal */
.ai-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
}
.ai-modal-header img {
    width: 28px;
    height: 28px;
}
.ai-chat-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: var(--input-bg);
}
.ai-chat-bubble {
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    max-width: 80%;
    line-height: 1.6;
}
.ai-chat-bubble.ai {
    background-color: var(--sidebar-bg);
    border: 1px solid var(--input-border);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.ai-chat-bubble.user {
    background-color: var(--primary-color);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.ai-chat-input-area {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid var(--bs-border-color);
}
#aiChatInput {
    flex-grow: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    height: 44px;
    padding: 0 1rem;
    color: var(--input-text);
    outline: none;
}
#aiChatInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}
#aiChatSendBtn {
    flex-shrink: 0;
    width: 44px;
    padding: 0;
    font-size: 1.1rem;
}
/* styles.css */

/* ======================================= */
/* === V4: ENHANCED AI CHAT INTERFACE   === */
/* ======================================= */

/* Container for an entire message (avatar + bubble) */
.chat-message-row {
    display: flex;
    gap: 0.75rem;
    max-width: 90%;
}

/* Align AI messages to the left */
.chat-message-row.ai {
    align-self: flex-start;
}

/* Align User messages to the right */
.chat-message-row.user {
    align-self: flex-end;
    flex-direction: row-reverse; /* Flips the order for avatar on the right */
}

/* Styling for the circular avatars */
.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background-color: var(--input-bg);
    margin-top: 4px; /* Align with top of bubble */
}
.chat-avatar img,
.chat-avatar span {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Styling for the "reasoning..." bubble */
.reasoning-bubble {
    font-style: italic;
    color: var(--light-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Animation for the three dots */
.reasoning-bubble .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--light-text);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.reasoning-bubble .dot:nth-child(1) { animation-delay: -0.32s; }
.reasoning-bubble .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}
/* styles.css */

/* ======================================= */
/* === V5: SOFTER AI CHAT BUTTON STYLE  === */
/* ======================================= */

.ai-chat-input-area .btn-footer-v2.save {
    background-color: color-mix(in srgb, var(--primary-color) 20%, transparent); /* Soft blue background */
    color: var(--primary-color);
    border: 1px solid color-mix(in srgb, var(--primary-color) 30%, transparent);
    box-shadow: none; /* Remove the default prominent shadow */
}

.ai-chat-input-area .btn-footer-v2.save:hover {
    background-color: color-mix(in srgb, var(--primary-color) 30%, transparent); /* Slightly darker on hover */
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    color: var(--primary-color); /* Keep the text color the same */
    transform: translateY(-1px); /* Add a very subtle lift on hover */
    box-shadow: 0 4px 10px -5px rgba(0,0,0,0.1); /* A much softer shadow on hover */
}
/* styles.css */

/* ======================================= */
/* === V6: FINAL AI CHAT UI POLISH      === */
/* ======================================= */

/* Add a subtle background gradient to the chat log for depth */
.ai-chat-log {
    background-image: radial-gradient(circle at top, color-mix(in srgb, var(--primary-color) 3%, transparent) 0%, transparent 40%);
}

/* Add a soft dividing line between the chat log and input area */
.ai-chat-input-area {
    border-top: 1px solid;
    border-image: linear-gradient(to right, transparent, var(--input-border), transparent) 1;
}

/* Preset Prompt Suggestions Container */
.ai-prompt-suggestions {
    padding: 0.5rem 0 1rem 55px; /* Aligns with the chat bubbles */
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Individual Preset Prompt Button Styling */
.prompt-suggestion-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background-color: var(--sidebar-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: var(--light-text);
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.prompt-suggestion-btn:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
    border-color: var(--bs-border-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.prompt-suggestion-btn i {
    color: var(--primary-color);
}
/* styles.css */

/* ================================================== */
/* === V7: APPOINTMENT MODAL HEADER UI ENHANCEMENT === */
/* ================================================== */

.modal-header-v2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Style for the new AI Tip icon button in the header */
#askAItipBtn img {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

#askAItipBtn:hover img {
    transform: scale(1.1);
}

/* Remove the old, now-unused text button style */
.btn-ai-tip {
    display: none;
}
/* styles.css */

/* ================================================== */
/* === V8: NOTICEABLE GRADIENT AI BUTTON           === */
/* ================================================== */

/* Wrapper for the new AI button to control its position */
.ai-prompt-button-wrapper {
    padding: 0.5rem 0 1.5rem 0;
}

/* The main button style */
.btn-ai-gradient {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary-color) 20%, transparent);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
}



.btn-ai-gradient img {
    width: 22px;
    height: 22px;
}

/* The magic for the gradient text */
.gradient-text {
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

/* Clean up the old, unused header button style */
.modal-header-actions #askAItipBtn {
    display: none;
}
/* ================================================== */
/* === V9: MODAL OVERFLOW & SIZING FIX             === */
/* ================================================== */

/* 1. Make the modal slightly wider as requested for more breathing room. */
#newAppointmentModal.appointment-modal-v3 {
    max-width: 740px; /* Increased from 680px */
}

/* 2. Make the modal body scrollable. THIS IS THE MAIN FIX. */
.modal-body-v2 {
    overflow-y: auto; /* Add vertical scrollbar ONLY when needed. */
    
    /* Set a max-height that accounts for the header and footer.
       This prevents the modal from being too tall on shorter screens. */
    max-height: calc(85vh - 130px);
    
    /* Slightly increase right padding to make room for the scrollbar */
    padding-right: 1.25rem;
}

/* 3. Improve the layout of the time inputs row to be more robust. */
.time-inputs-wrapper {
    min-width: 0; /* Allows flex items to shrink properly if needed */
}

.all-day-toggle-v2 {
    flex-shrink: 0; /* Prevent the 'All day' checkbox from being squished */
    white-space: nowrap;
}
/* ================================================== */
/* === V12: PRODUCTION MONTH VIEW STYLES           === */
/* ================================================== */

/* styles.css */

/* ================================================== */
/* === V12: PRODUCTION MONTH VIEW STYLES           === */
/* ================================================== */

/* Container for events within a day cell */
.day-events-list {
    margin-top: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

/* Individual event pills in the month view */
.month-event {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.month-event:hover {
    filter: brightness(1.15);
}

/* "+ X more" indicator styling */
.month-event-more {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--light-text);
    padding: 2px 6px;
    cursor: pointer;
}
.month-event-more:hover {
    color: var(--bs-link-color);
}

/* Soft Color Palette for Month View Events (re-using existing types) */
.month-event.event-showing { background-color: var(--primary-color); }
.month-event.event-meeting { background-color: var(--success-color); }
.month-event.event-task { background-color: var(--warning-color); color: #000; }
.month-event.event-deadline { background-color: var(--danger-color); }
.month-event.event-personal { background-color: #7c3aed; }

/* Ensure day cells have enough height */
.calendar-day {
    min-height: 120px;
}
/* styles.css */
/* ================================================== */
/* === V13: SELECTABLE COLOR PALETTE STYLES        === */
/* ================================================== */

/* This targets the container for the color picker and dropdown */
.input-group-v2.color-picker-group {
    padding: 0; /* Remove padding to make it seamless */
}

/* Wrapper for just the color swatch buttons */
.color-palette-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.75rem; /* Add padding inside */
}

/* Individual color swatch button */
.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    /* A very subtle default border that matches the input background */
    border: 2px solid var(--input-border);
    cursor: pointer;
    background-clip: content-box;
    padding: 2px;
    transition: all 0.2s ease-in-out;
}

.color-swatch:hover {
    transform: scale(1.15);
    border-color: var(--border-color-2);
}

/* Style for the selected/active color swatch */
.color-swatch.active {
    transform: scale(1.2);
    border-color: var(--primary-color);
    /* Add a soft glow to enhance the "soft" feel */
    box-shadow: 0 0 10px -2px var(--primary-color);
}
/* This styles the dropdown to have a left border, acting as a separator */
#appointmentTypeSelect.form-control-v2 {
    border-left: 1px solid var(--input-border) !important;
    border-radius: 0;
    max-width: 150px; /* Give it a max width */
}
/* ================================================== */
/* === V16: DYNAMIC AGENDA & OVERLAP STYLES        === */
/* ================================================== */

/* --- Dynamic Agenda View Item Styling --- */
.agenda-event-item {
    /* Uses the --event-color variable set by JavaScript */
    background-color: color-mix(in srgb, var(--event-color, #8E9DCC) 10%, transparent);
    border-left-color: var(--event-color, #8E9DCC);
}
.agenda-event-item .agenda-event-icon {
    background-color: color-mix(in srgb, var(--event-color, #8E9DCC) 20%, transparent);
    color: var(--event-color, #8E9DCC);
}
.agenda-event-item .agenda-event-details h4 {
    color: var(--event-color, #8E9DCC);
}


/* --- Timeline Overlap Indicator ("+X more") --- */
.timeline-event-more {
    position: absolute;
    left: 10px;
    right: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--light-text);
    padding: 2px 6px;
    border-radius: 4px;
    background-color: var(--menu-hover-bg);
    text-align: center;
    cursor: pointer;
    z-index: 5; /* Sit on top of grid lines but below events */
}

.timeline-event-more:hover {
    color: var(--bs-link-color);
    background-color: var(--bs-border-color);
}

/* --- Remove old static CSS rules --- */
/* You can safely delete these old rules if they exist, 
   as color is now handled dynamically */
.calendar-event.event-showing, .calendar-event.event-meeting,
.calendar-event.event-task, .calendar-event.event-deadline, 
.calendar-event.event-personal {
    background-color: initial;
    border-color: initial;
    color: initial;
}
/* ================================================== */
/* === V17: ALL-DAY EVENT RENDERING FIX           === */
/* ================================================== */

/* This new container will sit between the day header and the timed grid */
.all-day-events-container {
    padding: 4px;
    height: 60px; /* This is the key change to match other rows */
    box-sizing: border-box; /* Ensures padding is included in the height */
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto; /* Adds a scrollbar if there are too many all-day events */
}

/* Styling for the new "pills" that represent all-day events */
.all-day-event-pill {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.2);
}
/* Styling for the All-Day Event pills */
.all-day-event-pill {
    /* ... existing styles ... */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.all-day-pill-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px; /* Add some space between title and label */
}

.all-day-pill-label {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.75;
    padding: 1px 4px;
    border-radius: 3px;
    background-color: rgba(0,0,0,0.15); /* A subtle background for the label */
    flex-shrink: 0; /* Prevent the label from shrinking */
}
/* ================================================== */
/* === V19: EVENT CARD DELETE BUTTON STYLES        === */
/* ================================================== */

/* Position the delete icon in the top-right of the event card */
.calendar-event .event-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background-color: rgba(0,0,0,0.2);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0; /* Hidden by default */
    transform: scale(0.8);
    transition: all 0.2s ease-in-out;
}

/* Make the delete icon appear on hover */
.calendar-event:hover .event-delete-btn {
    opacity: 1;
    transform: scale(1);
}

.event-delete-btn:hover {
    background-color: var(--danger-color);
    transform: scale(1.15) !important;
}
/* In styles.css */

/* ================================================== */
/* === V20: WEEK VIEW ALL-DAY OVERFLOW FIX         === */
/* ================================================== */

/* This is the key fix to prevent the grid columns from resizing */
.timeline-day-column {
    overflow: hidden;
}

/* Improve the styling of all-day event pills to handle long text */
.all-day-event-pill {
    /* ... keep existing styles ... */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* This will add "..." if the title is too long */
}

/* Styling for the new "+X more" link */
.all-day-more-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--light-text);
    padding: 2px 8px;
    margin-top: 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.all-day-more-link:hover {
    background-color: var(--menu-hover-bg);
    color: var(--bs-link-color);
}
/* In styles.css */

/* ================================================== */
/* === V20: WEEK VIEW ALL-DAY OVERFLOW FIX         === */
/* ================================================== */

/* This is the key fix to prevent the grid columns from resizing */
.timeline-day-column {
    overflow: hidden;
}

/* Improve the styling of all-day event pills to handle long text */
.all-day-event-pill {
    /* ... keep existing styles ... */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* This will add "..." if the title is too long */
}

/* Styling for the new "+X more" link */
.all-day-more-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--light-text);
    padding: 2px 8px;
    margin-top: 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.all-day-more-link:hover {
    background-color: var(--menu-hover-bg);
    color: var(--bs-link-color);
}
/* In styles.css, add this new block */

/* ================================================== */
/* === V8: NOTICEABLE GRADIENT AI BUTTON           === */
/* ================================================== */

/* Wrapper for the new AI button to control its position */
.ai-prompt-button-wrapper {
    padding: 0.5rem 0 1.5rem 0;
}
/* In styles.css, find and replace the existing .btn-ai-gradient block */

/* The main button style - now with smaller padding */
.btn-ai-gradient {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem; /* Slightly smaller gap */
    background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary-color) 20%, transparent);
    border-radius: 8px;
    padding: 0.6rem; /* CHANGED: Reduced padding to make the button shorter */
    cursor: pointer;
    transition: all 0.3s ease;
}

/* The hover effect - now without the elevation */
.btn-ai-gradient:hover {
    background-color: color-mix(in srgb, var(--primary-color) 12%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 30%, transparent);
    /* REMOVED: transform: translateY(-2px); */
    /* REMOVED: box-shadow: 0 6px 20px -5px color-mix(in srgb, var(--primary-color) 10%, transparent); */
}

/* Making the icon smaller */
.btn-ai-gradient img {
    width: 20px; /* CHANGED: Was 22px */
    height: 20px; /* CHANGED: Was 22px */
}

/* Making the text smaller */
.gradient-text {
    font-size: 0.9rem; /* CHANGED: Was 1rem */
    font-weight: 600;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

/* Clean up the old, unused header button style */
.modal-header-actions #askAItipBtn {
    display: none;
}
/* styles.css */

/* Styling for the new button container in the calendar sidebar */
.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* Increased from 0.75rem for more distance */
}
/* ======================================= */
/* === V7: GEMINI-INSPIRED REASONING UI === */
/* ======================================= */

/* This is the main bubble for the "reasoning" message */
.reasoning-bubble {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Space between icon and text */
    background-color: var(--input-bg); /* Use a soft, neutral background */
    border: 1px solid var(--bs-border-color);
    color: var(--light-text);
    font-weight: 500;
    overflow: hidden; /* Important for the shimmer effect */
    position: relative; /* Also for the shimmer effect */
}

/* This creates the shimmering highlight effect */
.reasoning-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%; /* Start the shimmer off-screen to the left */
    width: 100%;
    height: 100%;
    background: linear-gradient(
        110deg,
        transparent 30%,
        var(--menu-hover-bg) 50%,
        transparent 70%
    );
    animation: shimmer 1.5s infinite linear;
}

/* Add a new, dedicated icon for the reasoning state */
.reasoning-bubble .reasoning-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

/* The @keyframes animations for the effects */
@keyframes shimmer {
    to {
        left: 150%; /* Move the shimmer across the bubble to the right */
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Remove the old dot-based animation */
.reasoning-bubble .dot {
    display: none;
}
/* ======================================= */
/* === V8: STANDALONE REASONING INDICATOR === */
/* ======================================= */

/* This is the new container for the indicator, WITHOUT bubble styling */
.reasoning-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Space between icon and text */
    padding: 0.75rem 1.25rem; /* Give it the same padding as a real bubble for alignment */
    color: var(--light-text);
    font-weight: 500;
}

/* The spinning gradient icon (no changes needed here) */
.reasoning-indicator .reasoning-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

/* Keyframes for the spinning animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
/* ================================================== */
/* === V12: TEXT-ONLY REASONING INDICATOR        === */
/* ================================================== */

/* Styling for the reasoning text with the "wave" effect */
.reasoning-text {
    font-weight: 500;
    font-size: 1rem;
    align-self: center; /* Vertically aligns the text with the avatar */

    /* 1. Create a gradient background */
    background: linear-gradient(
      90deg,
      var(--light-text),
      #fff,
      var(--light-text)
    );
    
    /* 2. Make the background much wider than the text */
    background-size: 200% auto;

    /* 3. Clip the background to the shape of the text */
    -webkit-background-clip: text;
    background-clip: text;

    /* 4. Make the text color transparent to reveal the gradient */
    -webkit-text-fill-color: transparent;
    color: transparent;

    /* 5. Apply the wave animation */
    animation: text-shimmer 2s linear infinite;
}

/* Keyframe for the text wave effect */
@keyframes text-shimmer {
    to {
        background-position: -200% center;
    }
}
/* ======================================= */
/* === V13: SOFT MODAL FOOTER BUTTONS   === */
/* ======================================= */

/* === V14: GENERIC SOFT BUTTON STYLES === */
.btn-soft {
    display: inline-flex;       /* ADD THIS */
    align-items: center;        /* ADD THIS */
    justify-content: center;    /* ADD THIS */
    gap: 0.6rem;                /* ADD THIS for spacing */
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    transition: all 0.2s ease-out;
    cursor: pointer;
}

/* Soft blue style for "Save Changes" */
.btn-soft.primary {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    border-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
}

.btn-soft.primary:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 10%, transparent);
}

/* Soft red style for "Delete" */
.btn-soft.danger {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
    border-color: color-mix(in srgb, var(--danger-color) 25%, transparent);
}

.btn-soft.danger:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--danger-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--danger-color) 40%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--danger-color) 10%, transparent);
}
/* in styles.css */

/* The dark overlay behind the drawer */
.details-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1090;
    
    /* Animation: Start hidden */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out; /* Controls fade in/out */
}
.details-drawer-overlay.is-open {
    /* Animation: End visible */
    opacity: 1;
    pointer-events: auto;
}

.details-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    /* max-width is set on the element's style attribute */
    height: 100%;
    background-color: var(--sidebar-bg);
    z-index: 1100;
    box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    
    /* Animation: Start off-screen to the right */
    transform: translateX(100%); 
    /* This transition is the key for the smooth slide animation */
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.details-drawer.is-open {
    /* Animation: Slide into view */
    transform: translateX(0); 
}
/* Styling for the new Deal Room Analytics filter */
#dealAnalyticsTimespan {
    min-width: 140px;
    width: auto;
}
/* Add this new class for the soft green button style */
.btn-soft.green {
    background-color: color-mix(in srgb, var(--success-color) 15%, transparent);
    color: var(--success-color);
    border-color: color-mix(in srgb, var(--success-color) 25%, transparent);
}

.btn-soft.green:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--success-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--success-color) 40%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--success-color) 10%, transparent);
}
/* === V14: GENERIC SOFT BUTTON STYLES === */
.btn-soft {
    display: inline-flex;       /* ADD THIS */
    align-items: center;        /* ADD THIS */
    justify-content: center;    /* ADD THIS */
    gap: 0.6rem;                /* ADD THIS for spacing */
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    transition: all 0.2s ease-out;
    cursor: pointer;
}
/* Soft blue style for primary actions like "Save" */
.btn-soft.primary {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    border-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
}

.btn-soft.primary:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 10%, transparent);
}

/* --- ADD THIS NEW CLASS --- */
/* Soft gray style for secondary actions like "Cancel" */
.btn-soft.secondary {
    background-color: var(--menu-hover-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

.btn-soft.secondary:hover:not(:disabled) {
    background-color: var(--bs-border-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
/* -------------------------- */

/* Soft red style for "Delete" */
.btn-soft.danger {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
    border-color: color-mix(in srgb, var(--danger-color) 25%, transparent);
}

.btn-soft.danger:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--danger-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--danger-color) 40%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px color-mix(in srgb, var(--danger-color) 10%, transparent);
}
/* ======================================= */
/* === V15: CUSTOM MODAL SCROLLBAR      === */
/* ======================================= */

/* This targets the scrollable area inside all of your modals */
.modal-body {
  /* For Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) var(--input-bg);
}

/* For WebKit browsers (Chrome, Safari, Edge, etc.) */
.modal-body::-webkit-scrollbar {
  width: 8px; /* Makes the scrollbar thin */
}

/* The "track" or background of the scrollbar */
.modal-body::-webkit-scrollbar-track {
  background: var(--input-bg); /* A subtle background that matches the inputs */
}

/* The draggable "thumb" of the scrollbar */
.modal-body::-webkit-scrollbar-thumb {
  background-color: var(--primary-color); /* The primary blue color */
  border-radius: 10px; /* Fully rounded corners */
  border: 2px solid var(--input-bg); /* Creates a nice padding effect */
}

/* Makes the scrollbar slightly darker when you hover over it */
.modal-body::-webkit-scrollbar-thumb:hover {
  background-color: color-mix(in srgb, var(--primary-color) 85%, black);
}
/* ======================================= */
/* === V16: STYLED FILE INPUT & PREVIEW === */
/* ======================================= */

/* Hides the default, un-stylable file input button */
#expenseReceipt {
    display: none;
}

/* Styles the <label> to look like our custom button */
.file-upload-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--menu-hover-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-label:hover {
    background-color: var(--bs-border-color);
    color: var(--heading-text);
}

/* New container for the receipt image preview */
.receipt-preview-container {
    height: 150px;
    width: 100%;
    border-radius: var(--border-radius);
    border: 2px dashed var(--input-border);
    background-color: var(--input-bg);
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light-text);
    font-weight: 500;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transition: border-color 0.3s ease;
}

.receipt-preview-container.has-image {
    border-style: solid;
    border-color: var(--bs-border-color);
}
#newExpenseModal {
    max-width: 1140px; /* New, larger width */
}
/* In styles.css */

/* ======================================= */
/* === V17: CUSTOM SEARCHABLE INPUTS    === */
/* ======================================= */

.custom-select-wrapper {
    position: relative;
}

.custom-select-wrapper .search-input {
    padding-right: 2.5rem; /* Make space for the clear button */
}

/* The 'x' button to clear a selection */
.custom-select-wrapper .clear-selection-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--light-text);
    transition: color 0.2s ease, transform 0.2s ease;
}

.custom-select-wrapper .clear-selection-btn:hover {
    color: var(--danger-color);
    transform: translateY(-50%) scale(1.1);
}

/* The dropdown list for search results */
/* in styles.css */

.search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: block; /* This line fixes the layout issue. */
}

.search-results-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Individual items in the search results */
.search-results-list li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--input-border);
}

.search-results-list li:last-child {
    border-bottom: none;
}

.search-results-list li:hover {
    background-color: var(--menu-hover-bg);
}

.search-results-list li .item-name {
    font-weight: 500;
    color: var(--heading-text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-results-list li .item-subtext {
    font-size: 0.8rem;
    color: var(--light-text);
    display: block;
    margin-top: 2px;
}

/* Message for when no results are found */
.search-results-list .no-results {
    padding: 1rem;
    color: var(--light-text);
    text-align: center;
    font-style: italic;
}
/* ======================================= */
/* === AI-ASSIST LINK BUTTON             === */
/* ======================================= */

.btn-ai-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background-color: transparent;
    border: none;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-ai-link:hover:not(:disabled) {
    background-color: var(--menu-hover-bg);
}

.btn-ai-link:disabled {
    cursor: not-allowed;
}

.btn-ai-link img,
.btn-ai-link .fa-spinner,
.btn-ai-link .fa-check-circle {
    width: 20px;
    height: 20px;
}

.btn-ai-link .gradient-text {
    font-size: 0.9rem;
    font-weight: 600;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}

.btn-ai-link .status-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--light-text);
}

.btn-ai-link .success-text {
    color: var(--success-color);
}
/* styles.css */

/* =================================== */
/* === 32. TAX CENTER STYLES         === */
/* =================================== */

.tax-center-tab-content {
    margin-top: 1.5rem;
}

.tax-tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}
.tax-tab-pane.active {
    display: block;
}

/* Accordion for Estimates */
.tax-center-tab-content .accordion-item {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
}

.tax-center-tab-content .accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tax-center-tab-content .accordion-header:hover {
    background-color: var(--menu-hover-bg);
}

.tax-center-tab-content .accordion-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
}

.tax-center-tab-content .accordion-content {
    display: none; /* JS will toggle this */
    padding: 1.5rem;
    border-top: 1px solid var(--input-border);
}

.tax-center-tab-content .accordion-content p {
    margin-bottom: 1rem;
    color: var(--light-text);
}
.tax-center-tab-content .accordion-content p strong {
    color: var(--bs-body-color);
}

/* Tax Profile Summary Styles */
#taxProfileSummary {
    padding: 1.5rem;
    color: var(--light-text);
}
#taxProfileSummary .summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--input-border);
}
#taxProfileSummary .summary-item:last-child {
    border-bottom: none;
}
#taxProfileSummary .summary-item span {
    font-weight: 500;
}
#taxProfileSummary .summary-item strong {
    font-weight: 600;
    color: var(--heading-text);
}
/* Add this to the end of styles.css */

.settings-pane-footer {
    padding: 1rem 0;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid var(--bs-border-color);
    margin-top: 1.5rem;
}

.settings-pane-footer .btn {
    font-size: 1rem;
    padding: 0.8rem 1.8rem;
    border-radius: 12px;
}
/* Add these new styles to the end of styles.css */

/* --- ENHANCED "ADD NEW LEAD" MODAL STYLES --- */

/* Give the modal body more breathing room */
#newLeadModal .modal-body {
    padding: 1.5rem 2.5rem 2.5rem 2.5rem; /* Increased padding */
}

/* Style the headers for each section (Core Info, AI, etc.) */
#newLeadModal .modal-section-header {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--heading-text);
    margin: 2rem 0 1.25rem 0; /* Increase vertical spacing between sections */
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
    display: flex;
    align-items: center;
}

/* Remove extra top margin from the very first header */
#newLeadModal .modal-section-header:first-of-type {
    margin-top: 0;
}

/* Increase the spacing between form elements */
#newLeadModal .form-grid {
    gap: 1.5rem; /* More space between columns and rows */
}

/* Refine the AI Follow-up options container */
#aiFollowUpOptions {
    background-color: var(--input-bg); /* Use a subtle background */
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

/* Style the AI toggle switch to look like a proper form element for alignment */
.settings-pane-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 44px; /* Matches the height of .form-control-custom */
    padding: 0 0.75rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
}

.settings-pane-toggle .toggle-label {
    font-weight: 500;
    color: var(--bs-body-color);
}

#newLeadModal .form-group .switch-container span {
    color: var(--text-color);
}

/* Improve the AI disclaimer text style */
.disclaimer-text {
    font-size: 0.85rem;
    color: var(--light-text);
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    background-color: color-mix(in srgb, var(--warning-color) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--warning-color) 25%, transparent);
    border-left: 4px solid var(--warning-color);
    border-radius: var(--border-radius);
}

.disclaimer-text i {
    margin-right: 8px;
    color: var(--warning-color);
}
/* ADD THIS TO styles.css */

/* in styles.css */

/* --- LEAD & LISTING TABLE ACTION MENU STYLES --- */
.action-cell {
    position: relative;
    text-align: right;
}

.action-cell .kebab-btn {
    /* Ensures the button itself doesn't have a background when the menu is open */
    position: relative;
    z-index: 11;
}

.action-cell .dropdown-menu {
    display: none; /* Hidden by default */
    min-width: 180px;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    animation: fadeIn 0.1s ease-out;
}

.action-cell .dropdown-menu.is-open {
    display: block;
    position: fixed; /* Takes the menu out of the table's overflow context */
    transform: translateX(-100%); /* This aligns the menu's right edge with the button's right edge */
    z-index: 1100; /* High z-index to ensure it's on top of everything */
}

.action-cell .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: var(--bs-body-color);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
}

.action-cell .dropdown-item:hover {
    background-color: var(--menu-hover-bg);
}

.action-cell .dropdown-item.delete-btn:hover {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
    font-weight: 500;
}

/* --- Lead Engine Bulk Actions Bar --- */
.bulk-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: #fff;
    border-radius: 12px;
    margin-top: 1.5rem; /* Give it some space from the header */
    animation: fadeIn 0.3s;
    box-shadow: var(--shadow-md);
}

.bulk-actions-bar span {
    font-weight: 600;
}

.bulk-actions-bar .actions {
    display: flex;
    gap: 0.5rem;
}

.bulk-actions-bar .btn-c-sq {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
}

.bulk-actions-bar .btn-c-sq:hover {
    background-color: rgba(255,255,255,0.2);
}

.bulk-actions-bar .btn-c-sq.soft-red {
    background-color: var(--danger-color);
}


.action-cell .dropdown-menu.is-open {
    display: block;
    position: fixed; /* Takes the menu out of the table's overflow context */
    z-index: 1100; /* High z-index to ensure it's on top of everything */
}
/* in styles.css */

/* =================================== */
/* === LEAD PROFILE MODAL STYLES     === */
/* =================================== */

.lead-profile-modal {
    max-width: 800px;
    width: 90%;
}

.lead-profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background-color: var(--input-bg);
}

.lead-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.lead-header-info {
    flex-grow: 1;
}

.lead-profile-header .name-text {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--heading-text);
    margin: 0;
}

.lead-profile-header .email-text {
    font-size: 1rem;
    color: var(--bs-link-color);
    margin: 0;
}

.lead-profile-header .btn-c-sq {
    align-self: flex-start; /* Aligns close button to the top */
}

.lead-profile-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    padding: 2rem 2.5rem;
}

.profile-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.profile-data-group .profile-data-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.profile-data-group .profile-data-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--bs-body-color);
    margin: 0;
}

.profile-data-value.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.profile-data-value.tags-list .tag {
    background-color: var(--menu-hover-bg);
    padding: 4px 10px;
    border-radius: 6px;
}

.profile-data-value .status-badge {
    font-size: 0.9rem;
}

.profile-data-value.note-box {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    min-height: 50px;
    white-space: pre-wrap; /* Preserves line breaks in notes */
}

.lead-profile-modal .modal-footer {
    justify-content: flex-end;
}
#appWrapper.hidden {
    display: none;
}
/* styles.css */

/* styles.css */

/* ======================================= */
/* === FINAL LOG TOAST NOTIFICATION STYLES === */
/* ======================================= */

/* in styles.css */
.log-toast-container {
    position: fixed;
    bottom: 1.5rem; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999; /* This ensures it's on top of all other content */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.log-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 320px;
    background-color: var(--card-bg);
    color: var(--bs-body-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--bs-border-color);
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.21, 1.02, 0.73, 1);
}

.log-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.log-toast .toast-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.log-toast.loading .toast-icon {
    color: var(--primary-color);
}
.log-toast.success .toast-icon {
    color: var(--success-color);
}
.log-toast.error .toast-icon {
    color: var(--danger-color);
}

.fa-spin {
    animation: fa-spin 1.5s linear infinite;
}

@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* styles.css */

/* --- Add this entire new block to the end of your CSS file --- */

/* Spinner Animation */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.source-selection-card .spinner {
  display: none; /* Hidden by default */
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3); /* Light border */
  border-top-color: #fff; /* White spinner color */
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: auto; /* Pushes the spinner to the right */
}

/* --- Loading State for the Card --- */
.source-selection-card.loading {
  pointer-events: none; /* Prevent clicking while loading */
  background-color: color-mix(in srgb, var(--primary-color) 80%, black); /* Darken the card */
  border-color: var(--primary-color);
}

.source-selection-card.loading .spinner {
  display: block; /* Show the spinner */
}

.source-selection-card.loading .source-selection-icon,
.source-selection-card.loading .source-selection-text {
  opacity: 0.25; /* Fade out the original content */
}
/* styles.css */

/* ======================================================= */
/* === SOURCE CARD LOADING & IMPORT STATUS (FINAL FIX) === */
/* ======================================================= */

.source-card {
    position: relative; /* Needed to position child elements absolutely */
    transition: all 0.3s ease;
    overflow: hidden; /* Prevents content from spilling out during animations */
}

/* The container for the main content (icon, count, name) */
.source-card .source-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* The spinner element, now perfectly centered */
.source-card .card-spinner {
    display: none; /* Hidden by default */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* The key to perfect centering */
    width: 28px;
    height: 28px;
    border: 4px solid color-mix(in srgb, var(--primary-color) 20%, transparent);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 2; /* Ensures spinner is on top */
}

/* NEW: The container for the success message (e.g., "✓ 5 leads imported") */
.source-card .import-status {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    background-color: transparent;
    color: var(--success-color);
    opacity: 0; /* Hidden by default */
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1;
}

/* --- Loading State --- */
.source-card.is-loading {
    cursor: wait;
}

/* When loading, fade out the normal content */
.source-card.is-loading .source-content {
    opacity: 0.2;
}

/* And show the spinner */
.source-card.is-loading .card-spinner {
    display: block;
}

/* --- NEW: Imported State --- */
.source-card.is-imported {
    background-color: color-mix(in srgb, var(--success-color) 10%, var(--card-bg));
    border-color: var(--success-color);
}

/* When imported, hide the content */
.source-card.is-imported .source-content {
    opacity: 0;
    transform: scale(0.95);
}

/* And show the status message */
.source-card.is-imported .import-status {
    opacity: 1;
    transform: scale(1);
}
/* in styles.css */

/* =================================== */
/* === LEAD ENGINE METRICS DRAWER    === */
/* =================================== */

/* The dark overlay behind the drawer */
#leadMetricsDrawerOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1090; /* High z-index */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}

/* This class makes the overlay visible */
#leadMetricsDrawerOverlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* The drawer panel itself */
#leadMetricsDrawer {
    position: fixed;
    top: 0;
    right: 0; /* Positioned on the right */
    width: 100%;
    max-width: 400px;
    height: 100%;
    background-color: var(--sidebar-bg);
    z-index: 1100;
    box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    transform: translateX(100%); /* Start off-screen */
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* This class slides the drawer into view */
#leadMetricsDrawer.is-open {
    transform: translateX(0);
}
/* Add this to the end of styles.css */

.lead-engine-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.lead-engine-pane.active {
    display: block;
}
/* Add this to the end of styles.css */
.table-footer .footer-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}
/* Add this to the end of styles.css */

/* ======================================= */
/* === CUSTOM FOOTER SELECT DROPDOWN    === */
/* ======================================= */

.footer-select {
  /* Reset browser default styles */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  /* Sizing and Spacing */
  height: 40px;
  padding: 0 2.5rem 0 1rem; /* top/bottom | right (for arrow) | left */
  font-size: 0.9rem;
  font-weight: 500;
  width: auto; /* Let the dropdown size to its content */

  /* Background, Border, and Color */
  background-color: var(--menu-hover-bg); /* Use the soft gray from your theme */
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
  border-radius: 12px; /* Softer, more rounded corners */
  
  /* Custom Dropdown Arrow Icon */
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238b949e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px 12px;

  /* Transitions and Interaction States */
  cursor: pointer;
  transition: all 0.2s ease-out;
}

.footer-select:hover {
  background-color: var(--bs-border-color);
  border-color: var(--border-color-2);
}

.footer-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

/* Ensure options are styled correctly in dark mode */
.footer-select option {
    background-color: var(--card-bg);
    color: var(--input-text);
}
/* REPLACE the previous #newLeadModal block with this one */

/* --- ENHANCED "ADD NEW LEAD" MODAL STYLES (V3 - MAXIMUM SPACING) --- */

/* Give the modal body more breathing room */
#newLeadModal .modal-body {
    padding: 1.5rem 2.5rem 2.5rem 2.5rem;
}

/* Style the headers for each section with SIGNIFICANTLY MORE vertical margin */
#newLeadModal .modal-section-header {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--heading-text);
    margin: 3rem 0 1.5rem 0; /* INCREASED top margin to push sections apart */
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
    display: flex;
    align-items: center;
}

/* Remove extra top margin from the very first header */
#newLeadModal .modal-section-header:first-of-type {
    margin-top: 0;
}

/* SIGNIFICANTLY INCREASED the spacing between form elements */
#newLeadModal .form-grid {
    gap: 2.5rem 2.25rem; /* INCREASED row and column gap */
}

/* This adds a large extra bottom margin to each form group for more vertical space */
#newLeadModal .form-group {
    margin-bottom: 1rem; /* INCREASED margin for a very spaced-out feel */
}

/* Style the AI toggle switch to look like a proper form element for alignment */
.settings-pane-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 44px; /* Matches the height of .form-control-custom */
    padding: 0 0.75rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
}

.settings-pane-toggle .toggle-label {
    font-weight: 500;
    color: var(--bs-body-color);
}

/* Container for the AI options that appear when toggled */
#aiFollowUpOptions {
    background-color: var(--input-bg); /* Use a subtle background */
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

/* Improve the disclaimer text style */
.disclaimer-text {
    font-size: 0.85rem;
    color: var(--light-text);
    margin-top: 2rem;
    padding: 0.75rem 1rem;
    background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius);
}

.disclaimer-text i {
    margin-right: 8px;
    color: var(--primary-color);
}
#aiFollowUpOptions {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 0 1.5rem 1.5rem 1.5rem;
    margin-top: 1rem;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: all 0.4s ease-in-out;
}

/* When the container is not hidden, it will expand and fade in */
#aiFollowUpOptions:not(.hidden) {
    max-height: 500px; /* A large enough value to not clip content */
    opacity: 1;
    padding-top: 1.5rem;
}
/* ADD THIS TO THE END of styles.css */

/* Animation for the spinning status light */
@keyframes light-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* This class will be added by JavaScript to trigger the animation */
.agent-status-light.is-running {
  animation: light-spin 1.2s linear infinite;
}
/* REMOVE the old spinner CSS and ADD this block to styles.css */

/* Keyframe animation for the spinner */
@keyframes button-spinner-animation {
  to {
    transform: rotate(360deg);
  }
}

/* This is the spinner element inside the button */
.run-agent-btn .btn-spinner {
  display: none; /* The spinner is hidden by default */
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--primary-color);
  border-top-color: transparent; /* Makes it a "C" shape instead of a full circle */
  border-radius: 50%;
  animation: button-spinner-animation 0.75s linear infinite;
}

/* When the button has the .loading class... */
.run-agent-btn.loading .btn-spinner {
  display: block; /* ...show the spinner. */
}

.run-agent-btn.loading .btn-icon {
  display: none; /* ...and hide the original play icon. */
}
/* styles.css */

/* ======================================================= */
/* === 33. SENTINEL ACTIVATION MODAL STYLES            === */
/* ======================================================= */

.details-section {
    margin-bottom: 1.5rem;
}
.details-section:last-child {
    margin-bottom: 0;
}
.details-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--light-text);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.sentinel-doc-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 1rem;
    border-radius: var(--border-radius);
}
.sentinel-doc-info .fa-file-alt {
    font-size: 1.5rem;
    color: var(--light-text);
}
.sentinel-doc-info .doc-details {
    flex-grow: 1;
}
.sentinel-doc-info .doc-details strong {
    display: block;
    color: var(--heading-text);
    font-weight: 600;
}
.sentinel-doc-info .doc-details span {
    font-size: 0.85rem;
    color: var(--light-text);
}
.sentinel-doc-info .btn-c-sq {
    height: 38px;
    width: auto;
    padding: 0 1rem;
}

.sentinel-options-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sentinel-options-grid .settings-pane-toggle {
    height: auto;
    padding: 0.75rem 1rem;
}
.sentinel-helper-text {
    font-size: 0.8rem;
    color: var(--light-text);
    padding-left: 1rem;
    margin-top: -0.25rem;
    margin-bottom: 0.5rem;
}

.sentinel-credits-info {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--light-text);
    font-weight: 500;
}
.credits-progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bs-border-color);
    border-radius: 4px;
    margin: 0.5rem 0;
    overflow: hidden;
}
.credits-progress-bar .progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 4px;
    transition: width 0.5s ease;
}
.credits-text {
    text-align: right;
    font-weight: 600;
}

.credit-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
    font-weight: 600;
}
.credit-warning a {
    margin-left: auto;
    text-decoration: underline;
    color: var(--danger-color);
}

#sentinelStartBtn .fa-spinner {
    display: none;
}
#sentinelStartBtn.loading .btn-text {
    display: none;
}
#sentinelStartBtn.loading .fa-spinner {
 
    display: inline-block;
}
/* styles.css */

/* ======================================= */
/* === AGENT BUTTON LOADING STATES      === */
/* ======================================= */

/* Hides the original icon when loading */
#startQuillSentinelBtn.loading > i,
.run-agent-btn.loading .btn-icon {
  display: none;
}

/* Creates and shows a spinner element using CSS pseudo-elements */
#startQuillSentinelBtn.loading::after,
.run-agent-btn.loading .btn-spinner {
    content: '';
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid currentColor; /* Uses the button's text color */
    border-top-color: transparent;
    border-radius: 50%;
    animation: button-spinner-animation 0.75s linear infinite;
}

/* Spinner Keyframe Animation */
@keyframes button-spinner-animation {
  to {
    transform: rotate(360deg);
  }
}
/* ======================================= */
/* === SENTINEL CONTRACT SELECTION CARDS === */
/* ======================================= */

.contract-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    max-height: 280px;
    overflow-y: auto;
    padding: 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
}

.contract-selection-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    border: 2px solid var(--bs-border-color);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease-out;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contract-selection-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-color-2);
}

.contract-selection-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 30%, transparent);
    background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
}

.contract-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.contract-card-header .contract-name {
    font-weight: 600;
    color: var(--heading-text);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contract-card-header input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
    flex-shrink: 0;
}

.contract-card-footer {
    font-size: 0.8rem;
    color: var(--light-text);
    margin-top: auto; /* Pushes footer to the bottom */
}
/* styles.css */

/* ======================================= */
/* === SENTINEL RESULTS MODAL STYLES     === */
/* ======================================= */

/* --- Loading Spinner --- */
.sentinel-loader {
    width: 60px;
    height: 60px;
    border: 5px solid var(--bs-border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* --- Results Summary --- */
.results-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.results-summary-grid .kpi-card-alt {
    padding: 1.25rem;
}

.results-summary-grid .kpi-card-alt span {
    font-size: 2.5rem;
}

.results-summary-grid .kpi-card-alt label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
}

.text-green {
    color: var(--success-color);
}
.text-red {
    color: var(--danger-color);
}

/* --- Results List --- */
.results-list-header {
    font-size: 1rem;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
}

.results-list-container {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
}

.result-item .result-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.result-item .result-details .doc-name {
    font-weight: 600;
    color: var(--heading-text);
    display: block;
}

.result-item .result-details .result-message {
    font-size: 0.9rem;
    color: var(--light-text);
}

.result-item.success {
    border-left: 4px solid var(--success-color);
}
.result-item.success .result-icon {
    color: var(--success-color);
}

.result-item.error {
    border-left: 4px solid var(--danger-color);
}
.result-item.error .result-icon {
    color: var(--danger-color);
}
/* ADD THIS ENTIRE BLOCK TO THE END OF styles.css */

/* --- SENTINEL RESULTS MODAL STYLES --- */
.results-document-section {
    margin-bottom: 2rem;
}
.results-document-header {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--heading-text);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.results-accordion .accordion-item {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    background-color: var(--input-bg);
    overflow: hidden;
}
.results-accordion .accordion-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    background-color: var(--card-bg);
}
.results-accordion .accordion-header:hover {
    background-color: var(--menu-hover-bg);
}
.severity-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    color: #fff;
    flex-shrink: 0;
    width: 110px;
    text-align: center;
}
.severity-critical-error { background-color: #7f1d1d; }
.severity-high-risk-error { background-color: var(--danger-color); }
.severity-warning { background-color: var(--warning-color); color: #1f1f1f; }
.severity-information { background-color: var(--info-color); }
.severity-passed-check { background-color: var(--success-color); }

.accordion-description {
    font-weight: 500;
    flex-grow: 1;
}
.accordion-toggle-icon {
    transition: transform 0.3s ease;
}
.results-accordion .accordion-item.active .accordion-toggle-icon {
    transform: rotate(90deg);
}

.accordion-content {
    display: none;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--bs-border-color);
}
.result-detail-block {
    margin-bottom: 1rem;
}
.result-detail-block h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--light-text);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}
.original-text-block, .suggestion-block {
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    font-family: monospace;
    white-space: pre-wrap;
    font-size: 0.85rem;
}
.original-text-block {
    color: var(--danger-color);
    border-left: 3px solid var(--danger-color);
}
.suggestion-block {
    color: var(--success-color);
    border-left: 3px solid var(--success-color);
}

/* END OF CSS BLOCK */
/* in styles.css */

/* ======================================= */
/* === SENTINEL RESULTS TABS & PDF BTN === */
/* ======================================= */

.sentinel-tabs-nav {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
    background-color: var(--input-bg);
}

.sentinel-tab-link {
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--light-text);
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sentinel-tab-link:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
}

.sentinel-tab-link.active {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
}

.sentinel-tabs-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.sentinel-tab-pane {
    display: none; /* Hidden by default */
    animation: fadeIn 0.4s ease;
}

.sentinel-tab-pane.active {
    display: block; /* Shown when active */
}

/* Header for the report section */
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Download PDF Button */
#downloadReportPdfBtn {
    height: 40px; /* Consistent height */
    padding: 0 1rem;
}
/* styles.css */

/* ADD THESE STYLES AT THE END OF THE FILE */

.suggestion-card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    transition: all 0.2s ease-out;
}

.suggestion-card-item:hover {
    border-color: var(--primary-color);
    background-color: var(--menu-hover-bg);
}

.suggestion-time-info .date-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    display: block;
}

.suggestion-time-info .time-text {
    font-size: 0.9rem;
    color: var(--light-text);
}

.suggestion-card-item .btn-book-now {
    font-weight: 600;
    border-radius: 8px;
}
/* styles.css */

/* ADD THESE NEW STYLES FOR THE INTELLIGENCE PANEL */

.lead-intelligence-panel {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-lg);
    padding: 1rem 1.5rem 1.5rem 1.5rem;
}

.intelligence-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.intelligence-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.metric-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--card-bg);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--bs-border-color);
}

.metric-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.metric-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--heading-text);
    display: block;
    line-height: 1.2;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--light-text);
    font-weight: 500;
    display: block;
}
/* styles.css */

/* DELETE the old Mission Control CSS block and REPLACE it with this one. */

/* === FINAL MISSION CONTROL PANEL (V3) === */

/* Keyframes for the text shimmer/wave effect */
@keyframes text-shimmer {
    to {
        background-position: -200% center;
    }
}

/* Main panel styling - no changes needed here, but included for completeness */
.mission-control-panel {
    background-color: var(--input-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 5px 20px -5px rgba(0,0,0,0.1);
}
.mission-control-header, .mission-control-footer, .mission-control-body {
    padding: 1rem 1.5rem;
}
.mission-control-header { border-bottom: 1px solid var(--input-border); }
.mission-control-footer {
    display: flex;
    align-items: center;
    justify-content: space-between; /* This is the key change */
    gap: 1rem; /* Adds a clean space between items */
}
.mission-progress-bar {
    flex-grow: 1; height: 8px; background-color: var(--bs-border-color);
    border-radius: 4px; overflow: hidden;
}
.mission-control-header h4 { font-size: 1rem; font-weight: 600; color: var(--heading-text); margin: 0; }
.mission-plan-list { list-style: none; margin: 0; padding: 0; }
.mission-plan-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--input-border);
}
.mission-plan-list li:first-child .mission-plan-step { border-top: none; }


/* --- NEW Icon and Text Styling --- */

/* The icon container */
.mission-plan-step .step-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

/* The new SVG spinner */
.mission-step-spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    fill: var(--primary-color);
    opacity: 0; /* Hidden by default */
    transition: opacity 0.3s ease;
}

/* The checkmark icon */
.mission-plan-step .step-icon .fa-check {
    font-size: 0.9rem;
    color: #fff;
    opacity: 0; /* Hidden by default */
    transform: scale(0.5);
    transition: all 0.3s ease;
}

/* The step text */
.mission-plan-step .step-text {
    font-weight: 500;
    color: var(--light-text);
}
/* REPLACE the existing "Step Status Control" block with this one */
/* in styles.css */
/* === FINAL MISSION STEP STATUS STYLES (V5) === */

/* Keyframes for the text shimmer/wave effect */
@keyframes text-shimmer {
    to {
        background-position: -200% center;
    }
}

/* Keyframes for the spinner rotation animation */
@keyframes mission-spinner-rotation {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* The spinner element itself */
.mission-step-spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid var(--primary-color);
  border-top-color: transparent; 
  border-radius: 50%;
  animation: mission-spinner-rotation 0.8s linear infinite;
  opacity: 0; 
  transition: opacity 0.3s ease;
}

/* Base style for the icon container */
.mission-plan-step .step-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

/* Hide spinner and check by default */
.mission-plan-step .step-icon .mission-step-spinner,
.mission-plan-step .step-icon .fa-check {
    opacity: 0;
    position: absolute;
    transition: opacity 0.3s ease;
}

/* --- 1. PENDING State Styling --- */
.mission-plan-step.status-pending .step-icon {
    background-color: var(--bs-border-color); /* The grey circle */
}
.mission-plan-step.status-pending .step-text {
    color: var(--light-text);
}


/* --- 2. RUNNING State Styling --- */
.mission-plan-step.status-running .step-icon {
    background-color: transparent; /* Remove the grey circle */
}
.mission-plan-step.status-running .step-icon .mission-step-spinner {
    opacity: 1; /* Show the spinner */
}
.mission-plan-step.status-running .step-text {
    /* Apply the wave/shimmer effect */
    font-weight: 600;
    background: linear-gradient(90deg, var(--light-text), #fff, var(--light-text));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: text-shimmer 2s linear infinite;
}


/* --- 3. COMPLETED State Styling --- */
.mission-plan-step.status-completed .step-icon {
    background-color: var(--success-color); /* The green circle */
}
.mission-plan-step.status-completed .step-icon .fa-check {
    opacity: 1; /* Show the checkmark */
    color: #fff;
    font-size: 0.8rem;
}
.mission-plan-step.status-completed .step-text {
    text-decoration: line-through;
    color: var(--light-text);
}

/* ADD THIS NEW RULE INSIDE YOUR MISSION CONTROL CSS BLOCK */

/* This will style the container of the icon when a step is running */
.mission-plan-step.status-running .step-icon {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary-color) 30%, transparent);
    border-radius: 50%; /* This is the key change to make it a circle */
}
/* ADD THIS ENTIRE NEW BLOCK TO THE END OF YOUR CSS */

/* === AI MISSION SPINNER (SOLID CIRCLE) === */

/* Keyframes for the rotation animation */
@keyframes mission-spinner-rotation {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* The spinner element itself */
.mission-step-spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  
  /* Create the circle shape using borders */
  border: 3px solid var(--primary-color);
  /* Create the gap in the circle */
  border-top-color: transparent; 
  border-radius: 50%;
  
  /* Apply the rotation animation */
  animation: mission-spinner-rotation 0.8s linear infinite;

  /* The spinner is hidden until the 'status-running' class is added */
  opacity: 0; 
  transition: opacity 0.3s ease;
}

/* This is the existing rule that will now show your new spinner */
.mission-plan-step.status-running .step-icon .mission-step-spinner {
    opacity: 1; 
}
/* ADD THIS CSS TO THE END OF YOUR STYLESHEET */

/* === ATTACHMENT MODAL STYLES === */

.attachment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.attachment-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    transition: background-color 0.2s, border-color 0.2s;
}

.attachment-list li:hover {
    background-color: var(--menu-hover-bg);
}

.attachment-list li.selected {
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 30%, transparent);
}

.attachment-list .item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--input-bg);
    border-radius: 8px;
    color: var(--light-text);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.attachment-list .item-details .item-name {
    font-weight: 600;
    color: var(--heading-text);
}
.attachment-list .item-details .item-subtext {
    font-size: 0.85rem;
    color: var(--light-text);
}

.attachment-pane {
    display: none;
}
.attachment-pane.active {
    display: block;
}

/* Style for the attached item indicator on the prompt bar */
.prompt-attachment-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}
.prompt-attachment-indicator .remove-attachment {
    cursor: pointer;
    font-weight: 700;
}
/* ADD THIS ENTIRE NEW BLOCK TO YOUR CSS */

/* === AI COMMAND SUGGESTIONS DROPDOWN === */

/* Positions the dropdown relative to the prompt bar */
/* FIND and REPLACE this CSS rule */

/* in styles.css */

/* === AI COMMAND CENTER PROMPT BAR (CORRECTED) === */

/* Find and REPLACE the existing .global-prompt-bar-v2 CSS rule with this one. */
.global-prompt-bar-v2 {
    position: relative;
    z-index: 2; /* Ensures suggestions dropdown appears correctly */
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    
    /* FIX: Replaced gradient with a solid, non-transparent background color */
    background-color: var(--input-bg); 

    /* FIX: Changed shadow to a subtle inset shadow for a cleaner look */
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2), 0 1px 2px rgba(255,255,255,0.05); 
    
    transition: all 0.2s ease-out;
}

.global-prompt-bar-v2:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 20%, transparent), 
                inset 0 1px 2px rgba(0,0,0,0.2);
}
/* FIND and REPLACE this entire CSS block */
/* in styles.css */

/* FIND AND REPLACE THIS ENTIRE CSS BLOCK */
#promptSuggestionsDropdown {
    position: absolute;
    top: calc(100% + 8px); /* Appears 8px below the prompt bar */
    left: 0;
    right: 0;
    
    /* FIX: High z-index brings the dropdown in front of other content */
    z-index: 1050; 
    
    /* FIX: Explicitly set a solid background color */
    background-color: var(--card-bg);

    max-height: 350px;
    overflow-y: auto;
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bs-border-color);
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.suggestion-item:hover {
    background-color: var(--menu-hover-bg);
}

.suggestion-item .suggestion-icon {
    font-size: 1.1rem;
    color: var(--primary-color);
    width: 24px;
    text-align: center;
}

.suggestion-item .suggestion-details .suggestion-name {
    font-weight: 600;
    color: var(--heading-text);
    font-size: 0.95rem;
}

.suggestion-item .suggestion-details .suggestion-description {
    font-size: 0.85rem;
    color: var(--light-text);
}
/* styles.css */

/* === FULL META ADS MODAL STYLES === */

.large-campaign-modal .modal-panel {
    max-width: 850px !important;
    height: 90vh !important;
}

#metaAdsScriptModalBody {
    display: flex;
    flex-direction: column;
}

#metaAdsCampaignScriptFormModal {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

#metaAdsScriptModalBody .modal-section-header {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 1.75rem 0 1.25rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
}
#metaAdsScriptModalBody .modal-section-header:first-of-type {
    margin-top: 0;
}

#metaAdsScriptModalBody .form-group {
    margin-bottom: 1.5rem;
}

#metaAdsScriptModalBody .form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
    cursor: pointer;
}

.form-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.prompt-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.prompt-pill {
    background-color: var(--menu-hover-bg);
    color: var(--light-text);
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.prompt-pill:hover {
    background-color: var(--bs-border-color);
    color: var(--heading-text);
}
/* styles.css */

/* === ATTACHMENT CARD STYLES === */

.prompt-attachment-container {
    margin-bottom: -1rem; /* Pulls the prompt bar up slightly */
    position: relative;
    z-index: 1;
}

.attachment-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-radius: var(--border-radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease-out;
}

.attachment-card-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: color-mix(in srgb, var(--primary-color) 20%, transparent);
    color: var(--primary-color);
    border-radius: 8px;
    font-size: 1.2rem;
}

.attachment-card-details {
    flex-grow: 1;
}

.attachment-card-details .item-type {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    opacity: 0.8;
}

.attachment-card-details .item-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--heading-text);
}

.attachment-card .remove-attachment-btn {
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 1.1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.attachment-card .remove-attachment-btn:hover {
    background-color: var(--menu-hover-bg);
    color: var(--danger-color);
}

/* Remove the old, small indicator style */
.prompt-attachment-indicator {
    display: none;
}
/* === AI GENERATED SCRIPT RESULTS MODAL === */

#adScriptResultModal {
    max-width: 850px !important; /* Makes the modal wider */
    height: 90vh !important;
}

#adScriptResultModal .modal-header .modal-header-text {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Adds a nice icon to the header for better visual context */
#adScriptResultModal .modal-header .modal-header-text::before {
    content: '\f108'; /* Font Awesome computer/desktop icon */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--primary-color);
}

#adScriptResultBody {
    padding: 1.5rem; /* Adds padding around the text area */
    background-color: var(--input-bg); /* Use a soft background for the body */
    display: flex; /* Allows the content area to grow */
}

/* Styles the main content area */
#adScriptResultContent {
    background-color: var(--card-bg); /* Darker background for the text */
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    font-family: 'Poppins', sans-serif;
    line-height: 1.7;
    font-size: 0.95rem;
    color: var(--bs-body-color);
    white-space: pre-wrap; /* This preserves formatting like line breaks */
    overflow-y: auto;      /* Adds a scrollbar if the content is long */
    flex-grow: 1;          /* Ensures it fills the available space */
}

/* Aligns the footer buttons */
#adScriptResultModal .modal-footer {
    justify-content: space-between;
}

/* Adds a transition for the copy button's color change */
#copyAdScriptBtn {
    transition: all 0.3s ease;
}

/* The new 'copied' state for the button */
#copyAdScriptBtn.copied {
    background-color: color-mix(in srgb, var(--success-color) 15%, transparent);
    color: var(--success-color);
    border-color: color-mix(in srgb, var(--success-color) 25%, transparent);
    pointer-events: none; /* Prevents clicking again while in "Copied!" state */
}
/* === STYLED SCRIPT CONTENT === */

/* The overall container within the modal body */
#adScriptResultContent {
    font-family: 'Poppins', sans-serif;
    line-height: 1.7;
    font-size: 0.95rem;
    color: var(--bs-body-color);
}

/* Main headings like "1. Suggested Campaign Name" */
.script-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 1.5rem 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--input-border);
}
.script-heading:first-of-type {
    margin-top: 0;
}

/* Subheadings like "Ad Set 1 - Manual Audience" */
.script-subheading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--heading-text);
    margin: 1.25rem 0 0.75rem 0;
}

/* The divider line --- */
.script-divider {
    border: none;
    height: 1px;
    background-color: var(--input-border);
    margin: 1.5rem 0;
}

/* The list container for bullet points */
.script-list {
    list-style-type: none; /* Remove default bullets */
    padding-left: 1.25rem; /* Indent the list */
    margin: 0;
}

/* Individual list items */
.script-list li {
    position: relative;
    padding-left: 1rem; /* Space for our custom dot */
    margin-bottom: 0.5rem;
}

/* The custom dot for list items */
.script-list li::before {
    content: '•';
    position: absolute;
    left: -5px;
    top: 0;
    color: var(--primary-color);
    font-size: 1.2rem;
    line-height: 1;
}

/* Styling for the italicized rationale text */
.script-rationale {
    background-color: var(--input-bg);
    border-left: 3px solid var(--info-color);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    color: var(--light-text);
    font-size: 0.9rem;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.script-rationale em {
    font-style: normal;
}

.script-rationale strong {
    color: var(--info-color);
}
/* styles.css */

/* === AD COPY RESULTS MODAL === */

#adCopyResultModal {
    max-width: 700px;
    width: 90%;
}

#adCopyResultBody {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ad-copy-section {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
}

.ad-copy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.ad-copy-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
}

.copy-btn {
    background: none;
    border: 1px solid var(--bs-border-color);
    color: var(--light-text);
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
}

.copy-btn.copied {
    color: var(--success-color);
    border-color: var(--success-color);
    cursor: default;
}

.ad-copy-content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--bs-body-color);
    white-space: pre-wrap; /* Preserves line breaks from the AI */
}
/* in styles.css */

/* === CAMPAIGN ANALYSIS RESULTS MODAL === */

#campaignAnalysisResultBody {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
}

.analysis-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.analysis-kpi-card {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
}
.analysis-kpi-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading-text);
}
.analysis-kpi-card .label {
    font-size: 0.8rem;
    color: var(--light-text);
    font-weight: 500;
}

.analysis-accordion-item {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.analysis-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    cursor: pointer;
}
.analysis-accordion-header:hover {
    background-color: var(--menu-hover-bg);
}

.analysis-accordion-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.analysis-accordion-header i {
    transition: transform 0.3s ease;
}
.analysis-accordion-item.active .analysis-accordion-header i {
    transform: rotate(90deg);
}

.analysis-accordion-content {
    display: none; /* Toggled by JS */
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid var(--input-border);
}

.analysis-accordion-content ul {
    list-style: none;
    padding-left: 0;
    margin-top: 1rem;
}

.analysis-accordion-content li {
    padding: 0.5rem;
    border-bottom: 1px solid var(--input-border);
}
.analysis-accordion-content li:last-child {
    border-bottom: none;
}
.analysis-accordion-content .recommendation-item {
    margin-top: 1rem;
}
.analysis-accordion-content .recommendation-item p {
    margin: 0;
}
.analysis-accordion-content .recommendation-item .rationale {
    font-size: 0.85rem;
    color: var(--light-text);
    margin-left: 1rem;
    font-style: italic;
}
/* in styles.css */

/* === CAMPAIGN ANALYSIS RESULTS TABS === */

/* This makes the container for the panes fill the available vertical space */
.analysis-result-panes-container {
    flex-grow: 1;
    position: relative; /* Allows absolute positioning of panes */
    padding: 1.5rem;
    background-color: var(--input-bg); /* Softer background for content area */
}

.analysis-tab-pane {
    display: none; /* Hide panes by default */
    animation: fadeIn 0.4s ease;
    
    /* This is the key for scrolling inside each tab */
    height: 100%;
    overflow-y: auto;
    
    /* Custom scrollbar styling for the panes */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--input-bg);
}

.analysis-tab-pane::-webkit-scrollbar {
    width: 8px;
}
.analysis-tab-pane::-webkit-scrollbar-track {
    background: var(--input-bg);
}
.analysis-tab-pane::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
    border: 2px solid var(--input-bg);
}

.analysis-tab-pane.active {
    display: block; /* Show the active pane */
}
/* in styles.css */

/* === STYLES FOR CAMPAIGN METRICS ANALYSIS === */

.metric-analysis-item {
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.metric-analysis-item p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--bs-body-color);
}

.metric-analysis-item strong {
    color: var(--heading-text);
    font-weight: 600;
}
/* styles.css */

/* === STYLES FOR AI OPTIMIZATION "BEFORE & AFTER" MODAL === */

.comparison-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comparison-header {
    font-size: 1rem;
    font-weight: 600;
    color: var(--light-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-preview-box {
    flex-grow: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    overflow-y: auto;
    white-space: pre-wrap; /* Preserves formatting */
    font-size: 0.9rem;
    line-height: 1.6;
}
/* styles.css */

/* === DATA HUB DRAG & DROP STYLES === */

.drop-zone.dragover {
    border-color: var(--primary-color);
    background: radial-gradient(circle, color-mix(in srgb, var(--primary-color) 8%, transparent) 0%, transparent 70%);
    transform: scale(1.02);
}

#recent-imports-tbody .action-cell-flex {
    display: flex;
    gap: 0.5rem;
}
/* in styles.css */

/* This rule makes the agent roster kebab menu work correctly */
.agent-card .action-cell .dropdown-menu.is-open {
    display: block;
    position: fixed; /* Takes the menu out of the card's overflow context */
    /* This aligns the menu's right edge with its left position */
    z-index: 1100; /* High z-index to ensure it's on top of everything */
}
/* in styles.css */

/* === AGENT RUN BUTTON LOADING STATE === */

/* This is the spinner element inside the button, hidden by default */
.run-agent-btn .btn-spinner {
  display: none;
}

/* When the button has the .loading class... */
.run-agent-btn.loading {
    cursor: wait; /* Show a waiting cursor */
}

.run-agent-btn.loading .btn-spinner {
  display: block; /* ...show the spinner. */
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: button-spinner-animation 0.75s linear infinite;
}

.run-agent-btn.loading .btn-icon {
  display: none; /* ...and hide the original play icon. */
}

/* Keyframe animation for the spinner rotation */
@keyframes button-spinner-animation {
  to {
    transform: rotate(360deg);
  }
}
/* === LEAD PROFILE MODAL SECTIONS === */

.profile-section {
    margin-bottom: 2rem; /* Adds space between sections */
}
.profile-section:last-child {
    margin-bottom: 0;
}

.profile-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--input-border);

    font-size: 0.85rem;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-section-header i {
    color: var(--primary-color);
}

/* in styles.css */

/* === AUTOMATION SETTINGS PANE (V2) === */

.settings-pane#settings-tab .settings-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* The main vertical gap between cards */
}

/* New card style for individual agent settings */
.agent-settings-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    transition: all 0.2s ease;
}

.agent-settings-card:hover {
    border-color: var(--border-color-2);
}

.agent-settings-card .agent-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.text-red { color: #e54d4d; }
.text-green { color: #479e53; }
.text-yellow { color: #f2c94c; }
.text-cyan { color: #56ccf2; }
.text-blue { color: var(--primary-color); }


.agent-settings-card .agent-info p {
    font-size: 0.9rem;
    color: var(--light-text);
    margin: 0;
    padding-left: 2.1rem; /* Aligns with text above icon */
}

.agent-settings-card .agent-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}
/* in styles.css */
/* in styles.css */

/* ======================================= */
/* === AUTOMATION DEACTIVATED BUTTONS    === */
/* ======================================= */

/* This class will be added by JS to any run button that is paused by a rule */
.btn-run.is-deactivated,
.run-agent-btn.is-deactivated,
.workflow-run-btn.is-deactivated {
    background-color: var(--menu-hover-bg) !important; /* Use the soft gray background */
    color: var(--light-text) !important;
    box-shadow: none !important;
    cursor: not-allowed;
    border-color: var(--bs-border-color) !important;
    pointer-events: none; /* Prevent clicks */
}

/* NEW: Styles for the deactivated prompt bar itself */
.global-prompt-bar-v2.is-deactivated {
    background: var(--input-bg);
    cursor: not-allowed;
    pointer-events: none; /* This makes the entire bar non-clickable */
}

/* NEW: Styles for the text input inside a deactivated prompt bar */
.global-prompt-bar-v2.is-deactivated input {
    cursor: not-allowed;
    color: var(--light-text);
}

/* NEW: Styles for the action buttons inside a deactivated prompt bar */
.global-prompt-bar-v2.is-deactivated .prompt-actions button {
    background-color: var(--menu-hover-bg) !important;
    color: var(--light-text) !important;
    cursor: not-allowed;
    pointer-events: none; /* Prevents clicks */
}

/* Ensure the icon and text inside also get the muted color */
.btn-run.is-deactivated i,
.run-agent-btn.is-deactivated i,
.btn-run.is-deactivated span {
    color: var(--light-text) !important;
}

/* Remove hover effects from deactivated buttons */
.btn-run.is-deactivated:hover,
.run-agent-btn.is-deactivated:hover {
    transform: none;
    filter: none;
}
/* in styles.css */

/* ======================================= */
/* === AI CHAT BUBBLE CONTENT STYLING    === */
/* ======================================= */

.ai-chat-bubble.ai ul {
    list-style-type: disc;
    padding-left: 20px; /* Indent lists */
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Space between list items */
}

.ai-chat-bubble.ai li {
    padding-left: 8px;
}

.ai-chat-bubble.ai strong {
    font-weight: 600;
    color: var(--heading-text); /* Make bold text brighter */
}
/* === CUSTOM CHART.JS TOOLTIP (FINAL FIX) === */
#chartjs-tooltip {
    opacity: 0;
    position: absolute;
    background: var(--card-bg); /* Use the standard card background */
    color: var(--heading-text); /* Use the bright heading text color */
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    pointer-events: none; /* The tooltip should not be interactive */
    transform: translate(-50%, -115%); /* Position it above the cursor */
    transition: all 0.2s ease-in-out;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--bs-border-color);
    font-family: 'Poppins', sans-serif;
    min-width: 150px;
    text-align: center;
}

/* This class makes the tooltip visible */
#chartjs-tooltip.visible {
    opacity: 1;
}

/* Styling for the title (e.g., "Contacted") */
#chartjs-tooltip-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* The small color swatch inside the tooltip */
.chartjs-tooltip-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

/* Styling for the body text (e.g., "Lead Count: 2") */
#chartjs-tooltip-body {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--light-text);
}
/* In styles.css */

/* === ADD THIS ENTIRE NEW BLOCK === */

/* Styling for the list of events on the dashboard mini-calendar */
.dashboard-event-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Space between event items */
}

.dashboard-event-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem;
    border-radius: var(--border-radius);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    transition: background-color 0.2s ease;
}

.dashboard-event-item:hover {
    background-color: var(--menu-hover-bg);
}

/* Styles the colored dot next to the event */
.dashboard-event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dashboard-event-details {
    flex-grow: 1;
    overflow: hidden; /* Important for text ellipsis */
}

/* Styles the event title */
.dashboard-event-title {
    display: block;
    font-weight: 500;
    color: var(--bs-body-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Adds "..." if title is too long */
}

/* Styles the event time */
.dashboard-event-time {
    display: block;
    font-size: 0.8rem;
    color: var(--light-text);
}

.mini-calendar .no-events-message {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light-text);
    font-style: italic;
}
/* In styles.css */
/* FIND AND REPLACE THIS ENTIRE CSS BLOCK */

#promptSuggestionsDropdown {
    position: absolute;
    top: calc(100% + 8px); /* Appears 8px below its parent prompt bar */
    left: 0;
    right: 0; /* Stretches to the full width of the parent */
    width: auto; /* Let left/right determine width */
    z-index: 1050; 
    background-color: var(--card-bg);
    max-height: 350px;
    overflow-y: auto;
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bs-border-color);
}
/* In styles.css */

/* Make the container a vertical flex column */
.grid-item.ai-activity {
    display: flex;
    flex-direction: column;
}

/* Allow the mission list to grow and push the prompt bar down */
.ai-activity .mission-list {
    flex-grow: 1;
}
.ai-activity .global-prompt-bar-v2 {
    margin-top: auto; /* This is the key change */
    margin-bottom: 0; /* Ensures it's flush with the bottom */
}
/* In styles.css */
/* === DASHBOARD MISSION LIST ENHANCEMENTS (REPLACE OLD BLOCK) === */

/* Turns each list item into a flex container */
#dashboard-mission-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 2.5rem; /* Ensures consistent height */
}

/* This is the container for the animated text */
.dashboard-mission-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.9rem;
    flex-shrink: 0; /* Prevents text from being squished */
}

/* Re-purposing the spinner for the status icon */
.dashboard-mission-status .spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* This is the waving text animation, identical to the main one */
.waving-text span {
    position: relative;
    display: inline-block;
    animation: wave 1.2s infinite;
    animation-delay: calc(0.1s * var(--i));
}
/* In styles.css */

/* === ENHANCED AI CHAT MODAL STYLING === */

/* Main modal panel for the AI chat */
#flowcoreAIModalOverlay .modal-panel {
    background-color: var(--sidebar-bg); /* Use a darker, more contained background */
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Header styling for better visual separation */
#flowcoreAIModalOverlay .ai-modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--input-border);
}

/* Chat log now has a subtle gradient for depth */
.ai-chat-log {
    background-image: radial-gradient(circle at top, color-mix(in srgb, var(--primary-color) 3%, transparent) 0%, transparent 50%);
}

/* Footer/Input area styling to match the header */
.ai-chat-input-area {
    background-color: var(--sidebar-bg);
    border-top: 1px solid var(--input-border);
    padding: 1rem 1.5rem;
}

/* Redesigned Prompt Suggestion Chips */
.ai-prompt-suggestions {
    /* Aligns with the chat bubbles, not the avatar */
    padding: 0.5rem 0 1rem 55px; 
}

/* Replaces the old .prompt-suggestion-btn style */
/* In styles.css */
/* REPLACE the existing .prompt-suggestion-btn and its :hover rule with this block */

.prompt-suggestion-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    /* New soft blue background and border */
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
    /* New text color for better contrast */
    color: var(--primary-color);
    border-radius: 1rem;
    padding: 0.6rem 1rem;
    font-weight: 600; /* Made text slightly bolder */
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.prompt-suggestion-btn:hover {
    /* A slightly darker soft blue on hover */
    background-color: color-mix(in srgb, var(--primary-color) 20%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    color: var(--primary-color); /* Keep text color consistent */
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.prompt-suggestion-btn i {
    color: var(--primary-color);
}
/* Wrapper to make the entire list item a clickable link */
.activity-link-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit; /* Inherit color from the parent li */
    width: 100%;
}

/* Flexbox container for the message and time */
.activity-details {
    flex-grow: 1;
    overflow: hidden; /* Crucial: This contains the children and allows ellipsis */
}

/* The message container that will truncate */
.activity-message {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    color: var(--bs-body-color);
}

.activity-message strong {
    font-weight: 600;
    color: var(--heading-text);
}
/* ADD THIS ENTIRE NEW BLOCK TO styles.css */

/* === NETWORKING: REFERRAL OPPORTUNITIES PANEL === */

.referral-opportunities-panel {
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.opportunity-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.opportunity-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    transition: all 0.2s ease-out;
}

.opportunity-list li:hover {
    border-color: var(--primary-color);
    background-color: var(--menu-hover-bg);
}

.opportunity-info strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--heading-text);
}

.opportunity-info span {
    font-size: 0.85rem;
    color: var(--light-text);
}

.opportunity-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.opportunity-actions span {
    font-weight: 600;
    color: var(--success-color);
    background-color: color-mix(in srgb, var(--success-color) 15%, transparent);
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
}

.opportunity-actions .btn-c-sq {
    height: 36px;
    font-weight: 600;
}

/* in styles.css */
/* === COMM HUB LEAD LIST STYLES === */

/* Ensure the pane content fills the space and allows scrolling */
.comm-hub-list-pane .pane-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0; /* Remove padding to make list items edge-to-edge */
}

/* Base styling for the list container */
.conversation-list {
    list-style: none;
}

/* Individual lead/conversation item */
.conversation-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--input-border);
    cursor: pointer;
    display: flex;
    gap: 1rem;
    transition: background-color 0.2s ease;
}

.conversation-item:hover {
    background-color: var(--menu-hover-bg);
}

/* Active state for the selected lead */
.conversation-item.active {
    background-color: var(--primary-color) !important;
    color: white;
}

.conversation-item.active .name-text,
.conversation-item.active .email-text,
.conversation-item.active .convo-preview {
    color: rgba(255, 255, 255, 0.9);
}

/* This is the container for the lead's name and email */
.convo-details {
    flex-grow: 1;
    overflow: hidden;
}

/* This reuses the .lead-name styles for consistency */
.convo-details .lead-name {
    display: block; /* Ensure it takes up the full width */
}

/* Reusing your existing styles for name and email text */
.convo-details .name-text {
    font-weight: 600;
    color: var(--heading-text);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.convo-details .email-text {
    font-size: 0.85rem;
    color: var(--light-text);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Placeholder for a message preview */
.convo-preview {
    font-size: 0.85rem;
    color: var(--light-text);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* In styles.css */

.comm-hub-reading-pane .pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#headerConnectGoogleBtn {
    display: none; /* Hidden by default */
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    flex-shrink: 0; /* Prevents it from shrinking */
}

#headerConnectGoogleBtn.visible {
 
    display: inline-flex; /* Show the button */
}
/* =================================== */
/* === 35. COMM HUB COMPOSER (Integrated) === */
/* =================================== */

.composer-area {
    padding: 0;
    border-top: 1px solid var(--bs-border-color);
    background-color: var(--sidebar-bg);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.composer-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1.25rem;
    border-bottom: 1px solid var(--input-border);
    flex-shrink: 0;
}

.composer-input-group label {
    font-weight: 600;
    color: var(--light-text);
}

.composer-input-group input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--input-text);
    font-size: 0.95rem;
    height: 28px;
}

/* This new wrapper is now the main flexible container */
.composer-body-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column; /* Stacks the text area on top of the action bar */
    padding: 0.75rem 1.25rem;
}

.composer-body {
    flex-grow: 1;
    outline: none;
    min-height: 80px;
    max-height: 170px; /* ADD THIS LINE */
    overflow-y: auto;
    padding-bottom: 0.5rem;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

.composer-body:empty:before {
    content: attr(data-placeholder);
    color: var(--input-placeholder);
    pointer-events: none;
}

/* The action bar no longer has a top border or background */
.composer-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.5rem;
    flex-shrink: 0; /* Prevents it from shrinking */
}

.composer-send-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#composerAIAssistBtn {
    padding: 0.6rem 1rem;
}
/* ADD THIS NEW RULE */
.composer-send-actions #sendEmailBtn {
    border-radius: 12px; /* MODIFIED: Creates a rectangular shape with rounded corners */
}
/* =================================== */
/* === 36. RICH CONTACT DETAILS PANE === */
/* =================================== */

.details-contact-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem; /* Reduced base gap */
}

.details-contact-card .phone-text {
    color: var(--light-text);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.details-contact-card .details-section {
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--input-border);
}

.details-contact-card .details-section h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--light-text);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    text-align: left;
}

.profile-data-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.profile-data-group .profile-data-label {
    font-weight: 500;
    color: var(--bs-body-color);
}

.profile-data-group .profile-data-value {
    font-weight: 600;
    color: var(--heading-text);
}

.details-contact-card .tags-list {
    justify-content: center;
}
.details-contact-card .tags-list .no-tags {
    font-style: italic;
    color: var(--light-text);
    font-size: 0.9rem;
}

.details-contact-card .quick-action-list.stacked .quick-action-item {
    background-color: var(--menu-hover-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    justify-content: flex-start; /* Align items to the left */
}

.details-contact-card .quick-action-list.stacked .quick-action-item i {
    color: var(--primary-color);
    width: 18px;
    text-align: center;
}
/* ================================================== */
/* === FIX: ADD NEW LISTING MODAL STYLES           === */
/* ================================================== */

/* This is the dark overlay behind the modal */
#addListingModal.modal-overlay {
    /* This will inherit styles from the generic .modal-overlay, which is correct. */
}

/* This is the main white container of the modal */
#addListingModal .modal-content {
    width: 90vw; /* Use 90% of the viewport width */
    max-width: 900px; /* But don't let it get wider than 900px */
    height: 90vh; /* Use 90% of the viewport height */
    background-color: var(--card-bg); /* Ensures a solid background */
    display: flex; /* CRITICAL: Enables flexbox layout for children */
    flex-direction: column; /* Stacks header, body, and footer vertically */
    overflow: hidden; /* Prevents content from spilling outside the rounded corners */
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Modal Header styling */
#addListingModal .modal-header {
    flex-shrink: 0; /* Prevents the header from shrinking */
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#addListingModal .modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--heading-text);
    margin: 0;
}

#addListingModal .modal-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--light-text);
    cursor: pointer;
}

/* This is the main fix for the scrolling issue */
#addListingModal .modal-body {
    flex-grow: 1; /* Allows the body to fill all available vertical space */
    overflow-y: auto; /* Adds a scrollbar ONLY if the content is too tall */
    padding: 1.5rem 2rem; /* Consistent padding */
}

/* Section headers inside the form */
#addListingModal .modal-section-header {
    font-size: 1rem;
    font-weight: 600;
    color: var(--light-text);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--input-border);
}
#addListingModal .modal-section-header:first-of-type {
    margin-top: 0;
}

/* Fix for the multi-column form grids */
.form-grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.form-grid-3-col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

/* General form control styling */
#addListingModal .form-control.modern {
    width: 100%;
    height: 44px;
    padding: 0 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    color: var(--input-text);
    font-size: 0.95rem;
}
#addListingModal textarea.form-control.modern {
    height: auto;
    padding-top: 0.75rem;
}

/* Modal Footer styling */
#addListingModal .modal-footer {
    flex-shrink: 0; /* Prevents the footer from shrinking */
    padding: 1rem 2rem;
    border-top: 1px solid var(--bs-border-color);
    background-color: var(--input-bg);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
/* ======================================= */
/* === GOOGLE MAPS AUTOCOMPLETE Z-INDEX FIX === */
/* ======================================= */

/* This rule targets the container that Google Maps creates for the
  autocomplete dropdown (which has the class .pac-container) and gives it a
  very high z-index, ensuring it always appears on top of other content,
  including our modal.
*/
.pac-container {
    z-index: 9999 !important;
}
/* ======================================= */
/* === LISTING MODAL PHOTO PREVIEW       === */
/* ======================================= */

/* This is the container that holds the image preview and remove button */
.photo-preview-container {
    position: relative; /* Allows absolute positioning for the remove button */
    width: 150px;       /* Sets a fixed small width */
    height: 150px;      /* Sets a fixed small height */
    background-color: var(--input-bg);
    border: 2px dashed var(--input-border);
    border-radius: var(--border-radius);
    overflow: hidden; /* Ensures the image stays within the rounded corners */
    display: none; /* Hidden by default, JS will show it */
}

/* This styles the <img> tag itself */
.photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover; /* This is the key: it scales the image to fill the box without distortion */
    display: block;
}

/* This styles the 'X' button to remove the photo */
#removePrimaryPhotoBtn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%; /* Makes it a circle */
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 10; /* Ensures it's on top of the image */
    transition: all 0.2s ease;
}

#removePrimaryPhotoBtn:hover {
    background-color: var(--danger-color);
    transform: scale(1.1);
}

/* Hide the preview image when it has the .hidden class */
.photo-preview.hidden {
    display: none;
}
/* ======================================= */
/* === ADD LISTING MODAL FOOTER BUTTONS  === */
/* ======================================= */

/* This targets the specific footer in the listing modal */
#addListingModal .modal-footer {
    background-color: var(--sidebar-bg);
    border-top: 1px solid var(--bs-border-color);
    box-shadow: 0 -5px 15px -5px rgba(0,0,0,0.1);
}

/* Base style for BOTH buttons in this footer */
#addListingModal .modal-footer .btn {
    border-radius: 12px; /* Creates the "squared circle" shape */
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    transition: all 0.2s ease-out;
}

/* "Cancel" button - Soft Gray Style */
#addListingModal .modal-footer .btn.secondary {
    background-color: var(--menu-hover-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

#addListingModal .modal-footer .btn.secondary:hover {
    background-color: var(--bs-border-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* "Save Listing" button - Soft Blue Style */
#addListingModal .modal-footer .btn.primary {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    border-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
}

#addListingModal .modal-footer .btn.primary:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 10%, transparent);
}
/* in styles.css */

/* === TABLE ACTION MENU POSITIONING FIX === */

.action-cell {
    position: relative; /* This is the anchor for the menu */
}

.action-cell .dropdown-menu {
    display: none; /* Hidden by default */
    position: absolute; /* Changed to absolute positioning */
    top: calc(100% + 5px); /* Position it below the cell */
    right: 0; /* Align to the right of the cell */
    z-index: 10; /* Ensure it appears on top */
    min-width: 180px;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    animation: fadeIn 0.1s ease-out;
}

/* This class, toggled by JS, makes the menu visible */
.action-cell .dropdown-menu.is-open {
    display: block; 
}
/* ======================================= */
/* === ASSIGN LEAD MODAL FOOTER BUTTONS  === */
/* ======================================= */

/* Base style for ALL buttons in this modal's footer */
#assignLeadModal .modal-footer .btn {
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border: 1px solid transparent;
    transition: all 0.2s ease-out;
}

/* "Cancel" button - Soft Gray Style */
#assignLeadModal .btn.secondary {
    background-color: var(--menu-hover-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

#assignLeadModal .btn.secondary:hover {
    background-color: var(--bs-border-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* "Assign" button - Soft Blue Style */
#assignLeadModal .btn.primary {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    border-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
}

#assignLeadModal .btn.primary:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 10%, transparent);
}

/* Style for the "Assign" button when it is DISABLED */
#assignLeadModal .btn.primary:disabled {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--light-text);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}
/* ======================================= */
/* === PROPERTY MANAGER SECTION STYLES   === */
/* ======================================= */

/* Status badges for properties table */
.status-badge.pm-occupied {
    background-color: color-mix(in srgb, var(--success-color) 20%, transparent);
    color: var(--success-color);
}

.status-badge.pm-vacant {
    background-color: color-mix(in srgb, var(--warning-color) 25%, transparent);
    color: var(--warning-color);
}

/* Maintenance Kanban Task Cards */
.playbook-capsule.maintenance-task {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    border-left-width: 4px;
}

.playbook-capsule.maintenance-task h4 {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.playbook-capsule.maintenance-task span {
    font-size: 0.8rem;
    color: var(--light-text);
}

.playbook-capsule.maintenance-task.high-priority {
    border-left-color: var(--danger-color);
}

.playbook-capsule.maintenance-task.medium-priority {
    border-left-color: var(--warning-color);
}

.playbook-capsule.maintenance-task.low-priority {
    border-left-color: var(--info-color);
}
/* ======================================= */
/* === PROPERTY MANAGER SECTION STYLES   === */
/* ======================================= */

#property-manager-section .property-manager-content .automation-pane {
    height: 100%;
}

#property-manager-section .networking-main-layout {
    height: 100%;
}

#property-manager-section .map-container {
    height: 100%;
    min-height: 500px; /* Ensure map has a minimum height */
}

#property-manager-section .agent-feed-panel {
    height: 100%;
}

#property-manager-section .pane-content {
    height: 100%;
    overflow-y: auto;
}

/* Status badges for property manager */
.status-badge.pm-occupied {
    background-color: color-mix(in srgb, var(--success-color) 20%, transparent);
    color: var(--success-color);
}

.status-badge.pm-vacant {
    background-color: color-mix(in srgb, var(--warning-color) 25%, transparent);
    color: var(--warning-color);
}
/* ============================================== */
/* === PROPERTY MANAGER MAP VIEW & FILTER STYLES === */
/* ============================================== */

/* Positions the filter card within the right sidebar */
#pm-filter-card {
    position: absolute;
    top: 65px; /* Position below the header */
    right: 15px;
    width: calc(100% - 30px); /* Full width of parent minus padding */
    max-width: 100%;
    z-index: 10;
}

/* ======================================= */
/* === PORTFOLIO MODAL MAP & LAYOUT      === */
/* ======================================= */

#propertyPortfolioModal .form-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#propertyPortfolioModal fieldset {
    border: none;
    padding: 0;
    margin: 0;
    margin-bottom: 1.5rem;
}

#propertyPortfolioModal legend {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-mid);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--input-border);
}
/* ======================================= */
/* === STILE BOTTONE CHIUSURA MODAL (X)  === */
/* ======================================= */

.modal-close-btn {
    /* Reset Stile Base */
    background: none;
    border: none;
    padding: 0;

    /* Dimensioni e Forma */
    width: 36px;
    height: 36px;
    border-radius: 50%; /* Lo rende un cerchio perfetto */
    
    /* Centratura Icona */
    display: flex;
    align-items: center;
    justify-content: center;

    /* Stile Icona */
    color: var(--light-text);
    font-size: 1.1rem;
    
    /* Interazione */
    cursor: pointer;
    transition: all 0.2s ease-out;
}

.modal-close-btn:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
    transform: scale(1.1) rotate(90deg); /* Aggiunge una rotazione fluida */
}
/* in styles.css */
#propertyPortfolioModal input[readonly] {
    background-color: var(--input-bg);
    color: var(--light-text);
    cursor: default;
}
/* ======================================= */
/* === PROPERTY PORTFOLIO LIST & CARDS === */
/* ======================================= */

#pm-property-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.portfolio-card {
    background-color: var(--white-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease-out;
    border-left: 4px solid transparent;
}

.portfolio-card:hover, .portfolio-card.highlighted {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--primary-color);
}

.portfolio-card h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-darker);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portfolio-card .card-address {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.portfolio-card .card-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
}

.portfolio-card .card-details .price {
    color: var(--success-text);
    font-weight: 600;
}

/* Styling for the InfoWindow on the map */
.gm-style-iw .portfolio-infowindow {
    font-family: 'Poppins', sans-serif;
    padding: 5px;
}
.gm-style-iw .portfolio-infowindow h5 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
}
.gm-style-iw .portfolio-infowindow .price {
    font-weight: 600;
    color: var(--success-text);
    margin-bottom: 10px;
}
.gm-style-iw .portfolio-infowindow button {
    margin-top: 10px;
}
/* in styles.css - ADD THIS ENTIRE BLOCK */

/* ======================================= */
/* === PROPERTY PORTFOLIO LIST & CARDS === */
/* ======================================= */

#pm-property-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.portfolio-card {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease-out;
    border-left: 4px solid transparent;
}

.portfolio-card:hover, .portfolio-card.highlighted {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-left-color: var(--primary-color);
    background-color: var(--menu-hover-bg);
}

.portfolio-card h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--heading-text);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portfolio-card .card-address {
    font-size: 0.85rem;
    color: var(--light-text);
    margin-bottom: 0.75rem;
}

.portfolio-card .card-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
}

.portfolio-card .card-details .price {
    color: var(--success-color);
    font-weight: 600;
}

/* Styling for the InfoWindow on the map */
.gm-style-iw .portfolio-infowindow {
    font-family: 'Poppins', sans-serif;
    padding: 5px;
}
.gm-style-iw .portfolio-infowindow h5 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
}
.gm-style-iw .portfolio-infowindow .price {
    font-weight: 600;
    color: var(--success-color);
    margin-bottom: 10px;
}
.gm-style-iw .portfolio-infowindow button {
    margin-top: 10px;
}
/* in styles.css - ADD THIS ENTIRE BLOCK */

/* ======================================= */
/* === PORTFOLIO IMAGE UPLOADER STYLES === */
/* ======================================= */

/* Styled button that replaces the default file input */
.file-upload-label-v2 {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--menu-hover-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem; /* Space between button and previews */
}

.file-upload-label-v2:hover {
    background-color: var(--bs-border-color);
    color: var(--heading-text);
}

/* Grid container for image previews */
.image-preview-grid {
    display: grid;
    /* Creates a responsive grid that shows as many 120px columns as fit */
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    min-height: 120px; /* Ensures the area has a size even when empty */
    background-color: var(--input-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
}

/* Individual preview thumbnail */
.img-preview-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; /* Makes the thumbnail a perfect square */
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
}

.img-preview-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures the image fills the square without distortion */
}

/* "Remove" button for each thumbnail */
.remove-img-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background-color: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.remove-img-btn:hover {
    background-color: var(--danger-color);
    transform: scale(1.1);
}

/* "Primary Photo" star indicator */
.primary-photo-indicator {
    position: absolute;
    bottom: 5px;
    left: 5px;
    color: var(--accent-color);
    font-size: 1.2rem;
    text-shadow: 0 0 5px black;
}
/* in styles.css - ADD THIS BLOCK */
.selectable-list-container {
    max-height: 250px;
    overflow-y: auto;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.selectable-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.selectable-item:hover {
    background-color: var(--menu-hover-bg);
}

.selectable-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    flex-shrink: 0;
}

.selectable-item label {
    font-weight: 500;
    color: var(--bs-body-color);
    cursor: pointer;
}

/* in styles.css - ADD THIS NEW BLOCK */

/* ======================================= */
/* === NETWORKING - MY BADGES STYLES     === */
/* ======================================= */

.badge-gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* Center the badges within the panel */
    gap: 2rem; /* Space between badges */
}

.badge-display-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem; /* Space between the circle and the name */
    width: 120px; /* Give each item a fixed width */
}

.badge-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #fff;
    font-size: 2.5rem; /* Size of the icon inside */
    border: 3px solid #fff; /* White border as seen in image */
    box-shadow: 0 5px 15px rgba(0,0,0,0.2), inset 0 2px 4px rgba(255,255,255,0.2);
    /* The gradient background */
    background: linear-gradient(135deg, #4361ee 0%, #7209b7 100%);
}

.badge-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--heading-text);
    text-align: center;
}
/* in styles.css */

/* === ADD THIS ENTIRE NEW BLOCK AT THE END OF THE FILE === */

/* ======================================= */
/* === TOKEN USAGE PROGRESS KPI CARDS    === */
/* ======================================= */

.kpi-card-progress {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.kpi-card-progress h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    margin: 0;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: var(--input-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.85rem;
    color: var(--light-text);
}

.progress-text span:first-child {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--bs-body-color);
}
/* in styles.css */

/* ======================================= */
/* === QUICK ACTIONS STYLING (COMM HUB) === */
/* ======================================= */

/* Rimuove la linea di separazione sopra la sezione */
.details-contact-card .details-section:has(.quick-action-list) {
    border-top: none;
    margin-top: 0;
    padding-top: 1rem;
}

.details-contact-card .quick-action-list.stacked {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Spazio tra i pulsanti */
}

.details-contact-card .quick-action-list.stacked .quick-action-item {
    background-color: var(--menu-hover-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    justify-content: flex-start; /* Allinea il contenuto a sinistra */
    transition: all 0.2s ease-out;
}

.details-contact-card .quick-action-list.stacked .quick-action-item:hover {
    background-color: var(--bs-border-color);
    border-color: var(--border-color-2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.details-contact-card .quick-action-list.stacked .quick-action-item i {
    color: var(--primary-color);
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.details-contact-card .quick-action-list.stacked .quick-action-item span {
    font-weight: 600;
    color: var(--heading-text);
}
/* in styles.css */

/* --- AVATAR STYLING FOR COMM HUB --- */
.message .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;

    /* These styles apply to both <img> and <div> avatars */
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    color: #fff;
    background-color: var(--secondary-color); /* Default background */
}
/* ADD THIS ENTIRE BLOCK TO THE END OF styles.css */

/* ======================================= */
/* === DEAL DRAWER TABS & PANES         === */
/* ======================================= */

.document-list, .task-list, .activity-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Document Item Styling */
.document-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
}
.document-item .fa-file-alt {
    font-size: 1.5rem;
    color: var(--light-text);
}
.document-item-details {
    flex-grow: 1;
}
.document-item-details a {
    font-weight: 600;
    color: var(--bs-link-color);
}
.document-item-details span {
    display: block;
    font-size: 0.8rem;
    color: var(--light-text);
}
.document-item .delete-doc-btn {
    background: none;
    border: none;
    color: var(--light-text);
    cursor: pointer;
}
.document-item .delete-doc-btn:hover {
    color: var(--danger-color);
}

/* Task Form & List Styling */
.deal-task-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.deal-task-form input {
    flex-grow: 1;
    height: 44px;
    padding: 0 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    color: var(--input-text);
}
.deal-task-form button {
    height: 44px;
    flex-shrink: 0;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border-radius: var(--border-radius);
}
.task-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
}
.task-item .task-label {
    flex-grow: 1;
    font-weight: 500;
    transition: all 0.2s;
}
.task-item.completed .task-label {
    text-decoration: line-through;
    color: var(--light-text);
}
.task-item .task-due-date {
    font-size: 0.85rem;
    color: var(--light-text);
    font-weight: 500;
}

/* Activity Timeline Styling */
.activity-item {
    display: flex;
    gap: 1rem;
}
.activity-item .activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--menu-hover-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--light-text);
    flex-shrink: 0;
}
.activity-item .activity-content .activity-message {
    font-weight: 500;
}
.activity-item .activity-content .activity-timestamp {
    font-size: 0.8rem;
    color: var(--light-text);
}

/* Linkable Contract List Styling (reuses attachment-list) */
#linkableContractsList li {
    border-bottom: 1px solid var(--input-border);
}
#linkableContractsList li:last-child {
    border-bottom: none;
}
/* ADD THIS ENTIRE BLOCK TO THE END OF styles.css */

/* ======================================= */
/* === DEAL DRAWER: TASK DELETE BUTTON   === */
/* ======================================= */

.task-item {
    position: relative; /* Allows absolute positioning for the button */
    padding-right: 40px; /* Make space for the delete button */
}

.task-item .delete-task-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--light-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    opacity: 0; /* Hidden by default */
    transition: all 0.2s ease-out;
}

.task-item:hover .delete-task-btn {
    opacity: 1; /* Show button on hover */
}

.task-item .delete-task-btn:hover {
    background-color: var(--danger-color);
    color: #fff;
}
/* in styles.css - ADD THIS ENTIRE BLOCK */

/* ======================================= */
/* === PROPERTY PORTFOLIO MODAL STYLES === */
/* ======================================= */

#propertyPortfolioModal .form-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#propertyPortfolioModal fieldset {
    border: none;
    padding: 0;
    margin: 0;
    margin-bottom: 1.5rem;
}

#propertyPortfolioModal legend {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-mid);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--input-border);
}
/* in styles.css */

/* === STYLING FOR MODAL FIELDSETS & LEGENDS === */

#newRecurringBillModal fieldset {
    border: none;
    padding: 0;
    margin: 0;
    margin-bottom: 2rem; /* Increased space between sections */
}

#newRecurringBillModal fieldset:last-of-type {
    margin-bottom: 0;
}

#newRecurringBillModal legend {
    font-size: 1rem;
    font-weight: 600;
    color: var(--light-text);
    padding: 0;
    margin-bottom: 1.25rem; /* Space between header and fields */
    width: 100%;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
}

#newRecurringBillModal .form-group {
    margin: 0; /* Remove bottom margin from individual groups */
}

/* Specific styling for the weekly button group */
#billDueDayWeekly .btn-group .btn-c-sq.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
/* in styles.css */

/* === STYLING FOR MODAL FIELDSETS & LEGENDS === */

#newRecurringBillModal fieldset {
    border: none;
    padding: 0;
    margin: 0;
    margin-bottom: 2rem; /* Increased space between sections */
}

#newRecurringBillModal fieldset:last-of-type {
    margin-bottom: 0;
}

#newRecurringBillModal legend {
    font-size: 1rem;
    font-weight: 600;
    color: var(--light-text);
    padding: 0;
    margin-bottom: 1.25rem; /* Space between header and fields */
    width: 100%;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
}

#newRecurringBillModal .form-group {
    margin: 0; /* Remove bottom margin from individual groups */
}

/* Specific styling for the weekly button group */
#billDueDayWeekly .btn-group .btn-c-sq.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
/* in styles.css */

/* ======================================= */
/* === LEDGER LOADING SPINNER STYLES     === */
/* ======================================= */

@keyframes ledger-spinner-rotation {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.ledger-spinner {
  width: 48px;
  height: 48px;
  border: 5px solid var(--menu-hover-bg);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: ledger-spinner-rotation 1s linear infinite;
  margin: 2rem auto; /* Centers the spinner in the table row */
}
/* ADD THIS TO THE END OF styles.css */

/* ======================================= */
/* === TAX REPORT MODAL STYLES         === */
/* ======================================= */

.report-section {
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
}
.report-section:first-of-type {
    margin-top: 0;
}
.report-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.report-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.25rem;
    font-size: 0.95rem;
}

.report-item span:first-child {
    color: var(--bs-body-color);
}

.report-item span:last-child,
.report-item strong {
    font-weight: 600;
    color: var(--heading-text);
}

.report-item.total {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--input-border);
}

.report-item.net-profit strong {
    font-size: 1.2rem;
    color: var(--success-color);
}
.error-placeholder {
    padding: 2rem;
    text-align: center;
    color: var(--danger-color);
    font-weight: 500;
}
/* =================================== */
/* === 32. TAX CENTER STYLES         === */
/* =================================== */

.tax-center-tab-content {
    margin-top: 1.5rem;
}

.tax-tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}
.tax-tab-pane.active {
    display: block;
}

/* Accordion for Estimates */
.tax-center-tab-content .accordion-item {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
}

.tax-center-tab-content .accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.tax-center-tab-content .accordion-header:hover {
    background-color: var(--menu-hover-bg);
}

.tax-center-tab-content .accordion-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
}

.tax-center-tab-content .accordion-content {
    display: none; /* JS will toggle this */
    padding: 1.5rem;
    border-top: 1px solid var(--input-border);
}

.tax-center-tab-content .accordion-content p {
    margin-bottom: 1rem;
    color: var(--light-text);
}
.tax-center-tab-content .accordion-content p strong {
    color: var(--bs-body-color);
}

/* Tax Profile Summary Styles */
#taxProfileSummary {
    padding: 1.5rem;
    color: var(--light-text);
}
#taxProfileSummary .summary-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--input-border);
}
#taxProfileSummary .summary-item:last-child {
    border-bottom: none;
}
#taxProfileSummary .summary-item span {
    font-weight: 500;
}
#taxProfileSummary .summary-item strong {
    font-weight: 600;
    color: var(--heading-text);
}
/* ======================================= */
/* === TAX REPORT MODAL STYLES         === */
/* ======================================= */

.report-section {
    margin: 1.5rem 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--input-border);
}
.report-section:first-of-type {
    margin-top: 0;
}
.report-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.report-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.25rem;
    font-size: 0.95rem;
}

.report-item span:first-child {
    color: var(--bs-body-color);
}

.report-item span:last-child,
.report-item strong {
    font-weight: 600;
    color: var(--heading-text);
}

.report-item.total {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--input-border);
}

.report-item.net-profit strong {
    font-size: 1.2rem;
    color: var(--success-color);
}
.error-placeholder {
    padding: 2rem;
    text-align: center;
    color: var(--danger-color);
    font-weight: 500;
}
.activity-icon.soft-orange {
    background-color: color-mix(in srgb, var(--warning-color) 80%, black);
    color: #FFF;
}
/* ADD THIS NEW BLOCK */
.agency-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}
.agency-pane.active {
    display: block;
}
/* === ONBOARDING MODAL STYLES === */
#onboardingModal .modal-body {
    padding: 2.5rem;
}

.onboarding-step {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.onboarding-step.active {
    display: block;
}

.onboarding-step .icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.onboarding-step h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--heading-text);
    margin-bottom: 1rem;
}

.onboarding-step p {
    font-size: 1rem;
    color: var(--light-text);
    line-height: 1.6;
}

.onboarding-dots-container {
    display: flex;
    gap: 0.5rem;
}

.onboarding-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--input-border);
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.onboarding-dot.active {
    background-color: var(--primary-color);
    transform: scale(1.2);
}
/* in styles.css */

.source-icon.flownetwork { 
    background-color: #BD10E0; /* A distinct purple color */
}
/* Incolla questo codice alla fine del tuo file styles.css */

/* --- MENU A DISCESA RICERCA GLOBALE --- */
/* styles.css */

/* --- MENU A DISCESA RICERCA GLOBALE (FIXED) --- */

/* Questo contenitore serve a posizionare il menu a discesa rispetto alla barra di ricerca */
.search-bar-container {
    position: relative;
    flex-grow: 1; /* Allows the search bar to take up available space */
    max-width: 650px; /* Increased width for a better look */
}


.top-header .search-bar {
    width: 100%;
}

/* Posiziona il menu sotto la barra di ricerca */
.search-results-dropdown {
    position: absolute; /* Takes the dropdown out of the normal document flow. */
    top: calc(100% + 8px); /* Positions it 8px below the search bar's bottom edge. */
    left: 0;
    right: 0;
    z-index: 1100; /* High z-index to ensure it appears on top of other content. */
    
    /* These styles make the dropdown visible with your theme's colors. */
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    
    /* Other styling for appearance and functionality */
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    max-height: 450px; /* Limits height and adds a scrollbar if results overflow. */
    overflow-y: auto;
}

/* Lista dei risultati */
.search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Intestazione di sezione (es. "Contatti", "Proprietà") */
.search-result-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
    padding: 0.75rem 1rem;
}

/* Singolo elemento nei risultati */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: var(--menu-hover-bg);
}

.search-result-item .item-icon {
    font-size: 1.1rem;
    color: var(--light-text);
    width: 24px;
    text-align: center;
}

.search-result-item .item-details {
    overflow: hidden; /* Nasconde il testo che fuoriesce */
}

.search-result-item .item-name {
    font-weight: 500;
    color: var(--heading-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Aggiunge "..." se il testo è troppo lungo */
}

.search-result-item .item-context {
    font-size: 0.85rem;
    color: var(--light-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Messaggio per quando non ci sono risultati */
.no-search-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--light-text);
    font-style: italic;
}
.content-section.active { 
    display: flex; /* CAMBIATO: da 'block' a 'flex' */
    flex-direction: column; /* AGGIUNTO: per un layout interno corretto */

    /* AGGIUNTO: Questa è la correzione chiave */
    /* Altezza totale - header (70px) - padding canvas (1rem * 2) */
    height: calc(100vh - 70px - 2rem); 

    /* AGGIUNTO: Permette lo scroll *interno* alla sezione se il contenuto è lungo */
    overflow-y: auto; 

    animation: fadeIn 0.5s ease; 
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.pm-pane            { display:none; }
.pm-pane.active     { display:block; }
/* in styles.css - ADD THIS BLOCK */
.pm-pane {
    display: none;
}
.pm-pane.active {
    display: block;
}
/* Add this entire block to the end of styles.css */
/* In styles.css, REPLACE the previous FlowRouter block with this one */

/* === FLOWROUTER MODAL & APP CARD STYLES (V3 - CORRECTED ALIGNMENT) === */

#flowRouterModal.modal-panel {
    width: 90vw;
    max-width: 1200px;
    background-color: var(--card-bg);
}

#flowRouterModal .modal-header {
    border-bottom: 1px solid var(--input-border);
}

#flowRouterModal .modal-body {
    background-color: var(--input-bg);
}

#flowRouterModal .modal-close-btn:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
}

.app-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.amazing-card {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.amazing-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.media-container {
    height: 160px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-content img {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.amazing-card:hover .media-content img {
    transform: scale(1.05);
}

.amazing-card .card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    text-align: left; /* Ensures all text is left-aligned */
}

.amazing-card .card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--heading-text);
}

.amazing-card .card-subtitle {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.amazing-card .card-text {
    color: var(--light-text);
    flex-grow: 1; /* This is the key: it makes the description fill all available vertical space. */
    margin-bottom: 1.5rem; /* This just adds consistent spacing above the button. */
}
/* Add this new rule to the end of styles.css */

/* In styles.css, find and replace this rule */

.footer-menu-icon {
    height: 1.8em; /* Increased from 1.4em */
    width: auto;
    max-width: 140px; /* Increased from 120px */
    object-fit: contain;
}

.btn-coming-soon {
    background: var(--input-border);
    color: var(--light-text);
    cursor: not-allowed;
}

.btn-coming-soon:hover {
     transform: none;
     box-shadow: none;
     filter: none;
}
.h-100 {
    height: 100%;
}
/* In styles.css, ADD this utility class to the end of the file */

.mt-auto {
    margin-top: auto !important;
}
/* styles.css */
/* Add this new block anywhere in the file */

/* ======================================= */
/* === PROPERTY MANAGER MAP LAYOUT FIX   === */
/* ======================================= */

.pm-map-layout {
    display: grid;
    /* Defines a flexible main column for the map and a fixed-width sidebar for the list */
    grid-template-columns: 1fr 340px; 
    gap: 1.5rem;
    height: 100%;
}

.pm-map-layout .map-container {
    height: 100%;
    min-height: 500px;
}

.pm-map-layout .property-list-panel {
    display: flex; 
    flex-direction: column; 
    background: var(--card-bg); 
    border-radius: var(--border-radius-lg); 
    border: 1px solid var(--bs-border-color); 
    overflow: hidden;
}

#pm-property-list {
    overflow-y: auto; 
    flex-grow: 1;
}

/* Add this new block to the end of styles.css */

/* === STATIC SIDEBAR FOOTER BUTTONS === */

/* Disables hover effects for the "Options" button */
#settingsHelpBtn:hover {
    background-color: var(--menu-hover-bg);
    color: var(--light-text);
    transform: none;
    box-shadow: none;
    border-color: transparent;
}

/* Disables hover effects for the "FlowCore AI" button */
#flowcoreBtn.btn-soft.primary:hover {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
    transform: none;
    box-shadow: none;
}
/* Add this new rule to styles.css for the icon-only footer button */

/* In styles.css, find and REPLACE the two rules for #flowcoreBtn */

#flowcoreBtn.btn-soft.primary {
    padding: 0.8rem; /* Increased padding */
}

#flowcoreBtn.btn-soft.primary .footer-logo-icon {
    width: 400px; /* Increased from 24px */
    height: 30px; /* Increased from 24px */
    margin-right: 0;
}
/* ======================================= */
/* === MOTIVATION TAB (ICONBOARD) STYLES === */
/* ======================================= */

/* --- Hero Banner --- */
.motivation-hero {
    display: grid;
    grid-template-columns: 2fr 3fr auto;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    margin-bottom: 2rem;
}
.hero-quote {
    font-style: italic;
    font-size: 1.1rem;
    color: var(--light-text);
    border-left: 3px solid var(--primary-color);
    padding-left: 1.5rem;
}
.hero-quote span {
    display: block;
    font-style: normal;
    font-weight: 600;
    color: var(--heading-text);
    margin-top: 0.5rem;
}
.hero-stats {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.hero-stat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.hero-stat-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}
.hero-stat-item .label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--bs-body-color);
}
.hero-stat-item .progress-bar-container {
    height: 10px;
    background-color: var(--input-border);
    border-radius: 5px;
    flex-grow: 1;
}
.hero-stat-item .progress-bar-fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
}
.hero-cta {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.8rem 1.5rem;
}

/* --- Main Grid Layout --- */
.motivation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto auto;
    gap: 1.5rem;
    align-items: flex-start;
}
.motivation-card {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}
.motivation-card .card-header {
    margin-bottom: 1.5rem;
}

/* --- Progress Tracker --- */
.progress-tracker-card {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.progress-tier {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.progress-ring {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}
.progress-ring svg {
    transform: rotate(-90deg);
}
.progress-ring-bg, .progress-ring-circle {
    fill: none;
    stroke-width: 4;
}
.progress-ring-bg {
    stroke: var(--input-border);
}
.progress-ring-circle {
    stroke: var(--primary-color);
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}
.progress-ring .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--heading-text);
}
.progress-info {
    flex-grow: 1;
}
.progress-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    margin-bottom: 0.25rem;
}
.progress-info span {
    font-size: 0.9rem;
    color: var(--light-text);
}
.progress-bar-container.horizontal {
    width: 100%;
}

/* --- Badge Shelf --- */
.badge-shelf {
    grid-column: span 2;
}

/* --- Leaderboard --- */
.leaderboard-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.leaderboard-list li {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
}
.leaderboard-list .rank {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--light-text);
    text-align: center;
}
.leaderboard-list .metric-value {
    font-weight: 700;
    color: var(--heading-text);
}

/* --- Momentum Cards --- */
.momentum-cards-container {
    grid-column: span 3;
    background-color: transparent;
    border: none;
    padding: 0;
}
.momentum-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.momentum-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}
.momentum-card i {
    font-size: 1.8rem;
    color: var(--primary-color);
}
.momentum-card p {
    flex-grow: 1;
    font-size: 1rem;
    line-height: 1.5;
}

/* --- Other Cards --- */
.celebration-feed { grid-column: span 2; }
.celebration-list { list-style: none; }
.celebration-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--input-border);
}
.celebration-list li:last-child { border-bottom: none; }

.mood-coach-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.vision-board-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.vision-item {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: var(--border-radius);
    overflow: hidden;
}
.vision-item img {
    width: 100%; height: 100%; object-fit: cover;
}
.vision-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 0.75rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: #fff;
}

.mood-checkin .mood-slider {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.mood-checkin input[type="range"] {
    flex-grow: 1;
}

.mini-coach {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.mini-coach > i {
    font-size: 2rem;
    color: var(--light-text);
}
/* --- MOTIVATION TAB RESTRUCTURE STYLES --- */

.motivation-sub-navbar {
    margin: -0.5rem 0 1.5rem 0; /* Adjust margins to sit nicely below the hero */
}

.motivation-panes-container {
    position: relative;
}

.motivation-pane {
    display: none; /* Hide all panes by default */
    animation: fadeIn 0.4s ease;
}

.motivation-pane.active {
    display: block; /* Show only the active pane */
}

/* Specific grid layout for the default dashboard view */
.motivation-grid.dashboard-view {
    grid-template-columns: 1fr 2fr; /* Make the progress tracker narrower */
    align-items: start;
}

.motivation-grid.dashboard-view .progress-tracker-card {
    grid-row: span 2; /* Make the progress tracker span both rows */
}

/* Ensure other cards take up full width in their respective panes */
.motivation-pane .motivation-card {
    grid-column: 1 / -1;
}

/* Adjust card header for better spacing */
.motivation-card .card-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--input-border);
}
/* ======================================= */
/* === MOTIVATION TAB (ICONBOARD) STYLES === */
/* ======================================= */

/* --- Hero Banner --- */
.motivation-hero {
    display: grid;
    grid-template-columns: 2fr 3fr auto;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    margin-bottom: 2rem;
}
.hero-quote {
    font-style: italic;
    font-size: 1.1rem;
    color: var(--light-text);
    border-left: 3px solid var(--primary-color);
    padding-left: 1.5rem;
}
.hero-quote span {
    display: block;
    font-style: normal;
    font-weight: 600;
    color: var(--heading-text);
    margin-top: 0.5rem;
}
.hero-stats {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.hero-stat-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.hero-stat-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}
.hero-stat-item .label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--bs-body-color);
}
.hero-stat-item .progress-bar-container {
    height: 10px;
    background-color: var(--input-border);
    border-radius: 5px;
    flex-grow: 1;
}
.hero-stat-item .progress-bar-fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
}
.hero-cta {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.8rem 1.5rem;
}

/* --- Sub-Navbar and Panes --- */
.motivation-sub-navbar {
    margin: -0.5rem 0 1.5rem 0;
}
.motivation-panes-container {
    position: relative;
}
.motivation-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}
.motivation-pane.active {
    display: block;
}
.motivation-card {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}
.motivation-card .card-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--input-border);
}

/* --- Dashboard Grid Layout --- */
.motivation-grid.dashboard-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}
.momentum-cards-container {
    grid-column: span 2;
    background-color: transparent;
    border: none;
    padding: 0;
}
.momentum-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.momentum-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}
.momentum-card i {
    font-size: 1.8rem;
    color: var(--primary-color);
}
.momentum-card p {
    flex-grow: 1;
    font-size: 1rem;
    line-height: 1.5;
}

/* --- Progress Tracker --- */
.progress-tracker-card {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.progress-tier {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.progress-ring {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}
.progress-ring svg {
    transform: rotate(-90deg);
}
.progress-ring-bg, .progress-ring-circle {
    fill: none;
    stroke-width: 4;
}
.progress-ring-bg {
    stroke: var(--input-border);
}
.progress-ring-circle {
    stroke: var(--primary-color);
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}
.progress-ring .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--heading-text);
}
.progress-info {
    flex-grow: 1;
}
.progress-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    margin-bottom: 0.25rem;
}
.progress-info span {
    font-size: 0.9rem;
    color: var(--light-text);
}
.progress-bar-container.horizontal {
    width: 100%;
}

/* --- Celebration Feed & Vision Board --- */
.celebration-feed { grid-column: span 2; }
.celebration-list { list-style: none; }
.celebration-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--input-border);
}
.celebration-list li:last-child { border-bottom: none; }

.vision-board-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.vision-item {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: var(--border-radius);
    overflow: hidden;
}
.vision-item img {
    width: 100%; height: 100%; object-fit: cover;
}
.vision-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 0.75rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: #fff;
}

/* --- To-Do List Card --- */
.todo-list-card .card-header {
    margin-bottom: 1rem;
}
.todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
}
.todo-list .placeholder-item {
    text-align: center;
    color: var(--light-text);
    padding: 2rem 0;
}
.todo-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}
.todo-item .task-label {
    flex-grow: 1;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s, text-decoration 0.2s;
}
.todo-item .custom-checkbox {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    background-color: var(--card-bg);
    border: 2px solid var(--bs-border-color);
    border-radius: 6px;
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
.todo-item .custom-checkbox::before {
    content: '';
    width: 12px;
    height: 12px;
    transform: scale(0);
    transition: 0.15s transform ease-in-out;
    box-shadow: inset 1em 1em #fff;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.todo-item .custom-checkbox:checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
}
.todo-item .custom-checkbox:checked::before {
    transform: scale(1);
}
.todo-item.completed .task-label {
    text-decoration: line-through;
    color: var(--light-text);
}
/* in styles.css */

/* ======================================= */
/* === VISION BOARD INTERACTIVITY        === */
/* ======================================= */

.vision-item {
    position: relative; /* Needed for absolute positioning of actions */
    cursor: pointer;
}

.vision-item-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 0.5rem;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s ease-in-out;
    z-index: 5;
}

.vision-item:hover .vision-item-actions {
    opacity: 1; /* Show buttons on hover */
}

/* Reusing your existing button style for a consistent look */
.vision-item-actions .btn-icon-only {
    background-color: rgba(0,0,0,0.6);
    color: white;
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    border: 1px solid rgba(255,255,255,0.3);
}

.vision-item-actions .btn-icon-only:hover {
    background-color: var(--primary-color);
    transform: scale(1.1);
}

.vision-item-actions .delete-goal-btn:hover {
    background-color: var(--danger-color);
}
/* in styles.css */

/* ======================================= */
/* === VISION BOARD IMAGE UPLOAD STYLES === */
/* ======================================= */

#goalImagePreviewContainer {
    position: relative;
    width: 100%;
    max-width: 350px; /* Constrains the preview size */
    aspect-ratio: 16 / 9; /* Gives it a nice rectangular shape */
    margin: 1rem auto 0 auto; /* Centers the preview */
    border: 2px dashed var(--input-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: var(--input-bg);
}

#goalImagePreviewContainer.hidden {
    display: none;
}

#goalImagePreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#goalImagePreviewContainer .remove-img-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background-color: rgba(0,0,0,0.6);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    z-index: 2;
}

#goalImagePreviewContainer .remove-img-btn:hover {
    background-color: var(--danger-color);
    transform: scale(1.1);
}
.logo-credit-container {
    display: flex; /* This aligns items horizontally */
    align-items: center; /* This centers them vertically */
    justify-content: center; /* This centers them horizontally */
    gap: 10px; /* This creates space between the text and the logo */

    width: 100%;
    padding: 10px; /* Padding inside the container */
    margin-bottom: 25px; /* Spacing below the container */
    
    background-color: var(--input-bg); /* Use theme's input background */
    border: 1px solid var(--input-border); /* Use theme's border color */
    border-radius: var(--border-radius, 8px); /* Use theme's border radius */
}
.logo-credit-container .credit-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--light-text); /* Use theme's secondary text color */
}
.logo-credit-container img {
    height: 38px; /* Slightly adjusted height for better balance */
    width: auto;
    max-width: 100%;
}
/* ======================================================= */
/* === COMPLETE LAYOUT FIX FOR FLOWINBOX CHAT MANAGER    === */
/* Add this entire block to the end of your styles.css file */
/* ======================================================= */

/* 1. Sets a fixed height for the entire FlowInBox section */
#flowinbox-manager-section.active {
    display: flex;
    flex-direction: column;
    /* Full viewport height minus the top header and main padding */
    height: calc(100vh - 70px - 2rem); 
}

/* 2. Makes the 3-pane container fill the available height */
.comm-hub-main-container {
    flex-grow: 1;
    display: grid;
    /* Prevents the container itself from growing or showing scrollbars */
    overflow: hidden; 
}

/* 3. Forces the middle reading pane to respect its container's height */
.comm-hub-reading-pane {
    display: grid; 
    grid-template-rows: auto 1fr 5px auto; 
    overflow: hidden; 
    /* This is crucial: makes the grid take up 100% of the parent's height */
    height: 100%; 
}

/* 4. Defines the scrollable content area within the reading pane */
.comm-hub-reading-pane .pane-content {
    padding: 1.5rem;
    /* THE DEFINITIVE FIX: Force this container to scroll vertically */
    overflow-y: auto !important; 
    /* THE DEFINITIVE FIX: Allows the grid item to shrink, enabling overflow */
    min-height: 0 !important; 
}
/* ======================================= */
/* === STILI PER DISPOSITIVI MOBILI      === */
/* Aggiungi questo blocco alla fine di styles.css */
/* ======================================= */

/* --- Breakpoint per Tablet e schermi medi (fino a 1024px) --- */
@media (max-width: 1024px) {
    /* Riduci il padding generale per guadagnare spazio */
    .canvas {
        padding: 1.5rem 1rem;
    }

    /* Rendi le griglie più flessibili, passando a 2 colonne dove possibile */
    .aw-grid-layout,
    .motivation-grid.dashboard-view,
    .app-selection-grid,
    .deal-room-section .aw-grid-layout {
        grid-template-columns: 1fr 1fr;
    }

    /* Impila le griglie a 3 colonne in una singola colonna */
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    /* Gestisci il layout della sezione Networking */
    .networking-main-layout {
        grid-template-columns: 1fr; /* Impila le colonne */
    }
    .badge-ranking-panel, .agent-feed-panel {
        grid-row: auto; /* Resetta l'ordine se necessario */
    }

    /* Adatta la barra laterale del calendario */
    .calendar-layout {
        grid-template-columns: 240px 1fr; /* Riduci la larghezza della sidebar */
    }

    /* Riduci le dimensioni dei modali più grandi */
    .large-campaign-modal .modal-panel,
    #propertyPortfolioModal,
    #dealDrawer {
        max-width: 90vw;
    }
}


/* --- Breakpoint per Smartphone (fino a 768px) --- */
@media (max-width: 768px) {
    
    /* --- 1. Layout Globale e Intestazione --- */
    #appWrapper {
        flex-direction: column; /* Impila sidebar e contenuto (anche se la sidebar è nascosta) */
    }

    .top-header {
        padding: 0.75rem 1rem;
        height: auto;
        min-height: 70px;
    }
    
    .search-bar-container {
        max-width: 100%;
    }

    .canvas {
        padding: 1rem;
        height: calc(100vh - 70px); /* Altezza completa meno l'header */
    }

    /* --- 2. Tutte le Griglie a Colonna Singola --- */
    .grid-container,
    .aw-grid-layout,
    .motivation-grid,
    .playbooks-grid,
    .agent-roster-gallery,
    .app-selection-grid,
    .form-grid-2-col,
    .form-grid-3-col {
        grid-template-columns: 1fr !important; /* Forza una singola colonna */
        grid-column: span 1 / auto !important; /* Resetta lo span delle colonne */
    }
    .kpi-strip {
        grid-template-columns: 1fr 1fr !important; /* Le KPI possono stare a 2 colonne */
    }
    
    /* --- 3. Layout Specifici per Sezioni --- */
    .calendar-layout, .settings-layout, .pm-map-layout {
        grid-template-columns: 1fr; /* Impila la sidebar e il contenuto principale */
        height: auto; /* Permetti al contenuto di determinare l'altezza */
    }
    
    .calendar-sidebar, .settings-nav {
        position: static; /* Rimuovi lo sticky che non serve su mobile */
        border-right: none;
        border-bottom: 1px solid var(--bs-border-color);
        padding-right: 0;
    }

    #property-manager-section .pm-map-layout .property-list-panel {
        height: 300px; /* Dai un'altezza fissa alla lista delle proprietà sotto la mappa */
    }
    
    /* --- 4. Modali a Schermo Intero --- */
    .modal-panel {
        width: 95vw !important;
        height: 90vh !important;
        max-width: 95vw !important;
    }
    .modal-body, .modal-body-v2 {
        padding: 1rem;
    }

    /* --- 5. Trasformazione delle Tabelle in Card --- */
    /* Nascondi l'intestazione della tabella */
    .table-responsive thead {
        display: none;
    }

    /* Ogni riga diventa un blocco a sé stante */
    .table-responsive tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--bs-border-color);
        border-radius: var(--border-radius);
        padding: 1rem;
    }
    
    /* Ogni cella diventa una riga dentro la card */
    .table-responsive td {
        display: flex;
        justify-content: space-between; /* Allinea etichetta e valore */
        align-items: center;
        text-align: right; /* Allinea il valore a destra */
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--input-border);
    }
    
    .table-responsive td:last-child {
        border-bottom: none;
    }
    
    /* Aggiungi le etichette usando i pseudo-elementi */
    .table-responsive td::before {
        content: attr(data-label); /* Usa l'attributo data-label che aggiungeremo con JS */
        font-weight: 600;
        color: var(--light-text);
        text-align: left;
        margin-right: 1rem;
    }
    
    /* Stili specifici per tabelle diverse */
    #leadsTable td:nth-of-type(2)::before { content: "Name"; }
    #leadsTable td:nth-of-type(3)::before { content: "Source"; }
    #leadsTable td:nth-of-type(4)::before { content: "Status"; }
    #leadsTable td:nth-of-type(5)::before { content: "Score"; }
    #leadsTable td:nth-of-type(6)::before { content: "Last Activity"; }
    #leadsTable td:nth-of-type(7)::before { content: "Owner"; }
    
    #listingsTable td:nth-of-type(1)::before { content: "Listing"; }
    #listingsTable td:nth-of-type(2)::before { content: "Price"; }
    #listingsTable td:nth-of-type(3)::before { content: "Status"; }
    #listingsTable td:nth-of-type(4)::before { content: "Assigned Lead"; }

    /* Nascondi la checkbox per la selezione multipla su mobile, è troppo piccola */
    .table-responsive td:first-child, .table-responsive th:first-child {
        display: none;
    }

    /* --- 6. Hero Section (Motivation) --- */
    .motivation-hero {
        grid-template-columns: 1fr; /* Impila tutto */
        text-align: center;
    }
    .hero-quote {
        border-left: none;
        border-top: 3px solid var(--primary-color);
        padding-left: 0;
        padding-top: 1rem;
    }
    .hero-cta {
        width: 100%;
    }
}
/* ======================================= */
/* === SIDEBAR MOBILE E TOGGLE (NUOVO) === */
/* ======================================= */

/* --- 1. Pulsante Hamburger (visibile solo su mobile) --- */
#mobileMenuToggle {
    display: none; /* Nascosto di default */
    font-size: 1.5rem;
    color: var(--bs-body-color);
}

/* --- 2. Overlay per lo sfondo scuro --- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1190; /* Appare sopra il contenuto ma sotto la sidebar */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

/* ======================================= */
/* === FLOWINBOX MOBILE RESPONSIVE       === */
/* ======================================= */

/* --- Stile iniziale del pulsante "Indietro" (nascosto su desktop) --- */
#commHubBackBtn {
    display: none;
}

/* --- Breakpoint per Tablet (fino a 1024px) --- */
@media (max-width: 1024px) {
    /* Passa a un layout a 2 colonne, nascondendo i dettagli a destra */
    .comm-hub-main-container {
        grid-template-columns: 300px 1fr;
    }
    
    /* Nascondi il pannello dei dettagli e il suo ridimensionatore */
    .comm-hub-main-container .comm-hub-details-pane,
    .comm-hub-main-container .comm-hub-resizer[data-resizer-for="reading-details"] {
        display: none;
    }
}

/* --- Breakpoint per Smartphone (fino a 768px) --- */
@media (max-width: 768px) {
    /* --- 1. Riorganizza il container principale --- */
    #flowinbox-manager-section.active {
        /* Occupa l'intera altezza disponibile */
        height: calc(100vh - 70px - 2rem);
    }
    .comm-hub-main-container {
        /* Passa da grid a flex per mostrare un pannello alla volta */
        display: flex;
        grid-template-columns: none; /* Rimuovi la definizione della griglia */
    }

    /* --- 2. Imposta i pannelli per la visualizzazione singola --- */
    .comm-hub-list-pane,
    .comm-hub-reading-pane {
        width: 100%;
        flex-shrink: 0;
        transition: transform 0.3s ease-in-out;
    }

    /* Di default, il pannello di lettura è fuori schermo a destra */
    .comm-hub-reading-pane {
        transform: translateX(100%);
    }

    /* Nascondi i ridimensionatori, non servono su mobile */
    .comm-hub-resizer {
        display: none;
    }

    /* Mostra il pulsante "Indietro" */
    #commHubBackBtn {
        display: inline-flex;
    }

    /* --- 3. Stili per lo stato "in lettura" --- */

    /* Quando si visualizza una conversazione, sposta entrambi i pannelli a sinistra */
    .comm-hub-main-container.viewing-thread .comm-hub-list-pane,
    .comm-hub-main-container.viewing-thread .comm-hub-reading-pane {
        transform: translateX(-100%);
    }

    /* Semplifica l'header quando si è in modalità lettura */
    .comm-hub-header {
        display: none; /* Nasconde l'header superiore per dare più spazio */
    }

    /* Adatta l'altezza del container principale di conseguenza */
    #flowinbox-manager-section.active.viewing-thread {
        height: calc(100vh - 70px);
    }
}
/* ======================================= */
/* === SIDEBAR MOBILE E TOGGLE (V2)    === */
/* ======================================= */

/* --- Pulsante Hamburger (visibile solo su mobile) --- */
#mobileMenuToggle {
    display: none; 
    font-size: 1.5rem;
    color: var(--bs-body-color);
}

/* --- Overlay per lo sfondo scuro --- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1190; 
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

/* in styles.css */
/* SOSTITUISCI IL BLOCCO @media PRECEDENTE CON QUESTO */

/* --- Breakpoint per Tablet e Smartphone (fino a 992px) --- */
@media (max-width: 992px) {
    /* Mostra il pulsante hamburger */
    #mobileMenuToggle {
        display: block;
    }

    /* Rimuovi la sidebar dal flusso normale e posizionala fuori schermo */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1200; 
        transform: translateX(-100%); 
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important; 
        
        /* MODIFICA: Rimuovi lo scorrimento da qui... */
        /* overflow-y: auto; (Questa riga è stata rimossa) */
    }

    /* NUOVA REGOLA: ...e applicalo solo alla sezione di navigazione */
    .sidebar .sidebar-nav {
        flex-grow: 1; /* Permette a questa sezione di occupare tutto lo spazio disponibile */
        overflow-y: auto; /* Aggiunge la barra di scorrimento solo qui, se necessario */
        padding-bottom: 1rem; /* Aggiunge un po' di spazio alla fine della lista */
    }

    /* Stili per lo stato "APERTO" (invariati) */
    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 5px 0 25px rgba(0,0,0,0.2);
    }
}

/* --- NUOVO: Breakpoint per schermi molto piccoli (es. iPhone) --- */
@media (max-width: 480px) {
    .sidebar {
        /* Riduci la larghezza della sidebar per lasciare più "margine" visivo */
        width: 260px; 
    }
}/* ======================================= */
/* === FIX KPI E PROMPT BAR COMMAND CENTER === */
/* ======================================= */

/* --- 1. FIX: Permette al testo lungo nelle KPI card di andare a capo --- */
.kpi-card .value {
    word-break: break-all; /* Forza il testo ad andare a capo se troppo lungo */
    line-height: 1.1;      /* Riduce la spaziatura tra le righe se il testo va a capo */
}

/* --- 2. FIX: Corregge il layout della barra di comando nel Command Center --- */

/* Applica questo stile solo alla barra dentro la card "AI Activity" */
.ai-activity .global-prompt-bar-v2 {
    padding: 0.5rem 0.75rem 0.5rem 1.25rem; /* Padding corretto */
}

/* Assicura che l'input di testo abbia lo spazio per crescere */
.ai-activity .global-prompt-bar-v2 input {
    flex-grow: 1;
    min-width: 100px; /* Larghezza minima per evitare che scompaia */
}

/* LA CORREZIONE CHIAVE: Impedisce al contenitore dei pulsanti di restringersi */
.ai-activity .global-prompt-bar-v2 .prompt-actions {
    flex-shrink: 0;
}
/* in styles.css */

/* --- FIX: Centra perfettamente lo spinner nei pulsanti di login/signup --- */
.btn.loading .spinner-border-sm {
    position: absolute; /* Rimuove lo spinner dal flusso normale del layout */
}
/* in styles.css */

/* --- FIX: Layout dell'intestazione per mobile --- */
@media (max-width: 992px) {
    .top-header {
        flex-direction: row; /* Assicura che sia sempre una riga */
        justify-content: space-between; /* Spinge i due gruppi ai lati opposti */
        gap: 1rem;
    }

    .header-right-group {
        display: flex;
        align-items: center;
        gap: 1rem; /* Spazio tra le icone */
    }

    /* Nascondi il selettore del tema su schermi molto piccoli per risparmiare spazio */
    @media (max-width: 480px) {
        .theme-switch-wrapper {
            display: none;
        }
        .header-right-group {
            gap: 0.75rem; /* Riduci lo spazio tra le icone rimanenti */
        }
    }
}
/* === ADD THIS ENTIRE NEW BLOCK === */

/* ======================================= */
/* === PLAN EXPIRED MODAL STYLES         === */
/* ======================================= */

/* The full-screen dark overlay that blocks the app */
.expired-plan-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9998; /* Extremely high z-index */
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    opacity: 0;
    animation: fadeIn 0.5s ease forwards; /* Use the existing fadeIn animation */
}

/* The modal panel itself */
.expired-plan-modal {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    max-width: 500px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border-top: 5px solid var(--danger-color);
}

.expired-plan-modal .icon {
    font-size: 3rem;
    color: var(--danger-color);
    margin-bottom: 1.5rem;
}

.expired-plan-modal h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--heading-text);
    margin-bottom: 1rem;
}

.expired-plan-modal p {
    font-size: 1rem;
    color: var(--light-text);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.expired-plan-modal .modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}
/* in styles.css */

/* === MOTIVATION TAB (ICONBOARD) STYLES === */
/* ... (existing styles) */

.note-box {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    min-height: 50px;
    white-space: pre-wrap; /* Preserves line breaks in notes */
}
/* === AGENT CARD SCHEDULE TEXT === */
.agent-schedule-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--light-text);
    padding: 0 0.5rem;
    text-align: right;
    flex-grow: 1; 
}
/* styles.css */

/* Add this to the end of your file */
.btn-soft.secondary {
    background-color: var(--menu-hover-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

.btn-soft.secondary:hover:not(:disabled) {
    background-color: var(--bs-border-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
/* ======================================= */
/* === TRIAL EXPIRING BANNER STYLES      === */
/* ======================================= */

.trial-banner {
    background: linear-gradient(90deg, #4361ee, #7209b7); /* Gradient from primary to a purple */
    color: #ffffff;
    padding: 1rem 1.5rem;
    margin: 0 2rem 1.5rem 2rem; /* Sits below the header */
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.5s ease-out;
    display: block; 
}

.trial-banner.hidden {
    display: none;
}

.trial-banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
}

.trial-banner-text {
    flex-grow: 1;
}

.trial-banner .headline {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.trial-banner .subline {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0;
    line-height: 1.5;
}

.trial-banner-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.trial-banner .btn-unlock {
    background-color: #ffffff;
    color: var(--primary-color);
    font-weight: 700;
    padding: 0.6rem 1.25rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: all 0.2s ease-out;
    border: none;
}

.trial-banner .btn-unlock:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    background-color: #f0f0f0;
}

.trial-banner .btn-dismiss {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.trial-banner .btn-dismiss:hover {
    color: #ffffff;
}

/* Responsive adjustments for the banner */
@media (max-width: 992px) {
    .trial-banner-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .trial-banner-actions {
        width: 100%;
        justify-content: center;
    }
}
/* In styles.css, add this at the end */

/* ======================================= */
/* === SMART CALL AI SECTION STYLES      === */
/* ======================================= */

#smart-call-ai-section .smart-call-tab-content {
    margin-top: 1.5rem;
}

#smart-call-ai-section .kpi-card .value {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    /* === TotalFlow CRM Stylesheet v5.4 === */
/* ... (TUTTO il CSS di TotalFlow CRM che hai fornito va qui, dall'inizio alla fine) ... */

/* ======================================================= */
/* === OPTLYX CONTROL TOWER - CUSTOM STYLES (NUOVO)    === */
/* ======================================================= */

/* --- Banner per Incidenti Attivi --- */
.incident-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius-lg);
    background-color: color-mix(in srgb, var(--warning-color) 20%, transparent);
    color: var(--warning-color);
    border: 1px solid color-mix(in srgb, var(--warning-color) 30%, transparent);
    font-weight: 500;
}
.incident-banner-text {
    flex-grow: 1;
}
.incident-banner .btn-soft.danger {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

/* --- Badge di Conformità (Sezione Overview) --- */
.compliance-badge-group {
    display: flex;
    gap: 0.75rem;
}
.compliance-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 1rem; /* Forma a pillola */
}
.compliance-badge.status-ok {
    background-color: color-mix(in srgb, var(--success-color) 15%, transparent);
    color: var(--success-color);
}
.compliance-badge.status-warning {
    background-color: color-mix(in srgb, var(--warning-color) 20%, transparent);
    color: var(--warning-color);
}
.compliance-badge.status-error {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
}
.compliance-badge.status-na {
    background-color: var(--menu-hover-bg);
    color: var(--light-text);
}

/* --- Timeline del Progetto --- */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    border-left-width: 4px;
}
.timeline-item-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
}
.timeline-item-content {
    flex-grow: 1;
}
.timeline-item-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    margin-bottom: 0.25rem;
}
.timeline-item-content .status-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--light-text);
}
.timeline-item-content .date-range {
    font-size: 0.8rem;
    color: var(--light-text);
    margin-top: 0.5rem;
}

/* Stati della Timeline */
.timeline-item.status-completed {
    border-left-color: var(--success-color);
}
.timeline-item.status-completed .timeline-item-icon {
    background-color: var(--success-color);
}
.timeline-item.status-in-progress {
    border-left-color: var(--primary-color);
    box-shadow: 0 0 15px color-mix(in srgb, var(--primary-color) 15%, transparent);
}
.timeline-item.status-in-progress .timeline-item-icon {
    background-color: var(--primary-color);
}
.timeline-item.status-pending {
    border-left-color: var(--bs-border-color);
}
.timeline-item.status-pending .timeline-item-icon {
    background-color: var(--bs-border-color);
    color: var(--light-text);
}

/* --- Document List (Privacy Center) --- */
.document-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.document-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--input-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
}
.document-item-icon {
    font-size: 1.5rem;
    color: var(--light-text);
}
.document-item-details {
    flex-grow: 1;
}
.document-item-details strong {
    color: var(--heading-text);
}
.document-item-details span {
    font-size: 0.8rem;
    color: var(--light-text);
    display: block;
}
.document-item .btn-soft {
    padding: 0.4rem 1rem;
    font-size: 0.85rem; 
}
}
/* === AGGIUNTE PER ANIMAZIONI E PROGRESS BAR === */

/* --- Barra di Progresso Principale --- */
.progress-bar-container-main {
    width: 100%;
    height: 12px;
    background-color: var(--input-border);
    border-radius: 6px;
    overflow: hidden;
    margin: 1rem 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.progress-bar-fill-main {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    border-radius: 6px;
    transition: width 1s cubic-bezier(0.25, 1, 0.5, 1); /* Animazione fluida */
}

/* --- Animazione per le Card --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animated-card {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0; /* Inizia invisibile */
}

/* Applica un ritardo diverso a ogni card per un effetto "a cascata" */
.animated-card:nth-child(1) { animation-delay: 0.1s; }
.animated-card:nth-child(2) { animation-delay: 0.2s; }
.animated-card:nth-child(3) { animation-delay: 0.3s; }
.animated-card:nth-child(4) { animation-delay: 0.4s; }

/* --- Miglioramento Hover Card --- */
.kpi-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}
/* === AGGIUNTE PER NOTIFICHE E COMUNICAZIONI === */

/* --- Sfondo Canvas con Gradiente --- */
.canvas {
    background: radial-gradient(circle at 10% 20%, rgba(67, 97, 238, 0.03), transparent 30%);
}
body.light-mode .canvas {
    background: radial-gradient(circle at 10% 20%, rgba(67, 97, 238, 0.05), transparent 40%);
}

/* --- Pulsante Notifiche Stile GitHub --- */
.notification-btn {
    position: relative;
    background: none;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.notification-btn:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
}

.notification-btn i {
    font-size: 1.2rem;
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 10px;
    height: 10px;
    background-color: #3b82f6; /* Blu notifica */
    border-radius: 50%;
    border: 2px solid var(--header-bg);
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.8);
}

/* --- Lista Comunicazioni dal Team --- */
.communication-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.communication-list li {
    display: flex;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--input-border);
    transition: background-color 0.2s ease;
}

.communication-list li:first-child {
    border-top: none;
}

.communication-list li:hover {
    background-color: var(--menu-hover-bg);
}

.communication-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: #fff;
    font-weight: 600;
    font-size: 1.2rem;
}

.communication-content {
    flex-grow: 1;
}

.communication-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.communication-author {
    font-weight: 600;
    color: var(--heading-text);
}

.communication-timestamp {
    font-size: 0.8rem;
    color: var(--light-text);
}

.communication-message {
    color: var(--bs-body-color);
    line-height: 1.6;
}
/* === AGGIUNTE PER OCTICONS E ANIMAZIONI (V2) === */

/* --- Stile Base per le Octicons --- */
.octicon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    /* Inverte i colori dell'SVG per adattarsi al tema scuro */
    filter: invert(var(--octicon-invert, 1));
}

/* Nel tema chiaro, le icone non devono essere invertite (diventerebbero bianche) */
body.light-mode .octicon {
    filter: invert(var(--octicon-invert-light, 0));
}

.sidebar-nav .nav-link .octicon {
    margin-right: 1rem;
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.2s, filter 0.2s;
}

.sidebar-nav .nav-link:hover .octicon,
.sidebar-nav .nav-link.active .octicon {
    opacity: 1;
}

/* L'icona attiva diventa del colore primario */
.sidebar-nav .nav-link.active .octicon {
    /* Questo trucco con i filtri CSS simula il cambio colore a --primary-color */
    filter: invert(37%) sepia(88%) saturate(3001%) hue-rotate(224deg) brightness(97%) contrast(95%);
}

body.light-mode .sidebar-nav .nav-link.active .octicon {
     filter: invert(37%) sepia(88%) saturate(3001%) hue-rotate(224deg) brightness(97%) contrast(95%);
}


.search-bar .octicon {
    margin-right: 0.75rem;
}

.user-menu-nav-link .octicon {
    margin-right: 0.8rem;
}

.notification-btn .octicon {
    filter: none; /* La campana non deve essere invertita */
}
/* === AGGIUNTE PER ANIMAZIONI E PROGRESS BAR === */

/* --- Barra di Progresso Principale --- */
.progress-bar-container-main {
    width: 100%;
    height: 12px;
    background-color: var(--input-border);
    border-radius: 6px;
    overflow: hidden;
    margin: 1rem 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.progress-bar-fill-main {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    border-radius: 6px;
    transition: width 1s cubic-bezier(0.25, 1, 0.5, 1); /* Animazione fluida */
}

/* --- Animazione per le Card --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animated-card {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0; /* Inizia invisibile */
}

/* Applica un ritardo diverso a ogni card per un effetto "a cascata" */
.animated-card:nth-child(1) { animation-delay: 0.1s; }
.animated-card:nth-child(2) { animation-delay: 0.2s; }
.animated-card:nth-child(3) { animation-delay: 0.3s; }
.animated-card:nth-child(4) { animation-delay: 0.4s; }

/* --- Miglioramento Hover Card --- */
.kpi-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}
/* === AGGIUNTE PER NOTIFICHE E COMUNICAZIONI === */

/* --- Sfondo Canvas con Gradiente --- */
.canvas {
    background: radial-gradient(circle at 10% 20%, rgba(67, 97, 238, 0.03), transparent 30%);
}
body.light-mode .canvas {
    background: radial-gradient(circle at 10% 20%, rgba(67, 97, 238, 0.05), transparent 40%);
}

/* --- Pulsante Notifiche Stile GitHub --- */
.notification-btn {
    position: relative;
    background: none;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.notification-btn:hover {
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
}

.notification-btn i {
    font-size: 1.2rem;
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 10px;
    height: 10px;
    background-color: #3b82f6; /* Blu notifica */
    border-radius: 50%;
    border: 2px solid var(--header-bg);
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.8);
}

/* --- Lista Comunicazioni dal Team --- */
.communication-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.communication-list li {
    display: flex;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--input-border);
    transition: background-color 0.2s ease;
}

.communication-list li:first-child {
    border-top: none;
}

.communication-list li:hover {
    background-color: var(--menu-hover-bg);
}

.communication-avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: #fff;
    font-weight: 600;
    font-size: 1.2rem;
}

.communication-content {
    flex-grow: 1;
}

.communication-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.communication-author {
    font-weight: 600;
    color: var(--heading-text);
}

.communication-timestamp {
    font-size: 0.8rem;
    color: var(--light-text);
}

.communication-message {
    color: var(--bs-body-color);
    line-height: 1.6;
}
/* === AGGIUNTE PER OCTICONS E ANIMAZIONI (V2) === */

/* --- Stile Base per le Octicons --- */
.octicon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    /* Inverte i colori dell'SVG per adattarsi al tema scuro */
    filter: invert(var(--octicon-invert, 1));
}

/* Nel tema chiaro, le icone non devono essere invertite (diventerebbero bianche) */
body.light-mode .octicon {
    filter: invert(var(--octicon-invert-light, 0));
}

.sidebar-nav .nav-link .octicon {
    margin-right: 1rem;
    width: 20px;
    height: 20px;
    opacity: 0.7;
    transition: opacity 0.2s, filter 0.2s;
}

.sidebar-nav .nav-link:hover .octicon,
.sidebar-nav .nav-link.active .octicon {
    opacity: 1;
}

/* L'icona attiva diventa del colore primario */
.sidebar-nav .nav-link.active .octicon {
    /* Questo trucco con i filtri CSS simula il cambio colore a --primary-color */
    filter: invert(37%) sepia(88%) saturate(3001%) hue-rotate(224deg) brightness(97%) contrast(95%);
}

body.light-mode .sidebar-nav .nav-link.active .octicon {
     filter: invert(37%) sepia(88%) saturate(3001%) hue-rotate(224deg) brightness(97%) contrast(95%);
}


.search-bar .octicon {
    margin-right: 0.75rem;
}

.user-menu-nav-link .octicon {
    margin-right: 0.8rem;
}

.notification-btn .octicon {
    filter: none; /* La campana non deve essere invertita */
}
/* ======================================= */
/* === STILI PER LE NUOVE KPI CARDS (V2) === */
/* ======================================= */

.kpi-card-v2 {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--bs-border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.kpi-card-v2:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.kpi-card-icon {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 16px; /* Raggio più grande per un look più morbido */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem; /* Icona più grande */
}

.kpi-card-content h3 {
    font-size: 0.9rem;
    color: var(--light-text);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.kpi-card-content p {
    margin: 0.4rem 0;
    font-size: 0.95rem;
    color: var(--bs-body-color);
}

.kpi-card-content p strong {
    color: var(--light-text);
    font-weight: 500;
}

.kpi-card-content .kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading-text);
    margin-right: 0.5rem;
}

.kpi-card-content .text-red {
    color: var(--danger-color) !important;
}


/* Sfondi "soft" per le icone */
.bg-soft-blue {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
}
.bg-soft-orange {
    background-color: color-mix(in srgb, var(--warning-color) 20%, transparent);
    color: var(--warning-color);
}
.bg-soft-green {
    background-color: color-mix(in srgb, var(--success-color) 15%, transparent);
    color: var(--success-color);
}
.bg-soft-purple {
    background-color: color-mix(in srgb, #9b59b6 15%, transparent);
    color: #9b59b6;
}
/* ======================================= */
/* === STILI PER IL CAROSELLO COMUNICAZIONI === */
/* ======================================= */

/* Stile per i pulsanti di navigazione nell'header della card */
.card-header .carousel-nav {
    display: flex;
    gap: 0.5rem;
}

/* Contenitore principale che nasconde la scrollbar */
.comms-carousel-container {
    overflow-x: auto;
    scrollbar-width: none; /* Per Firefox */
    padding: 1.5rem;
}
.comms-carousel-container::-webkit-scrollbar {
    display: none; /* Per Chrome, Safari, Edge */
}

/* Traccia che contiene le card e abilita lo scroll "a scatto" */
.comms-carousel-track {
    display: flex;
    gap: 1.5rem;
    scroll-snap-type: x mandatory; /* Effetto calamita */
}

/* Stile base per ogni card nel carosello */
.comms-card {
    flex: 0 0 350px; /* Larghezza fissa per ogni card */
    scroll-snap-align: start; /* Allinea l'inizio della card con l'inizio del contenitore */
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Stile per la card di tipo Annuncio */
.comms-card-announcement {
    padding: 1.5rem;
}
.comms-card-announcement .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    margin-bottom: 0.75rem;
}
.comms-card-announcement .card-message {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--bs-body-color);
    flex-grow: 1;
}
.comms-card-announcement .card-footer {
    font-size: 0.8rem;
    color: var(--light-text);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bs-border-color);
}

/* Stile per la card con Immagine */
.comms-card-image .card-image {
    height: 180px;
    background-size: cover;
    background-position: center;
}
.comms-card-image .card-content {
    padding: 1.5rem;
}

/* Stile per la card con Video */
.comms-card-video .card-video-container {
    position: relative;
    padding-top: 56.25%; /* Proporzioni 16:9 */
    height: 0;
    overflow: hidden;
}
.comms-card-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.comms-card-video .card-content {
    padding: 1.5rem;
}
/* ======================================= */
/* === STILI AGGIUNTIVI PER CARD 'PICS'  === */
/* ======================================= */

.comms-card-pics {
    position: relative; /* Necessario per posizionare il footer in sovrapposizione */
    height: 280px; /* Altezza fissa per un look uniforme */
    width: 350px;
}

.comms-card-pics .card-image {
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius);
}

.comms-card-pics .card-footer-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem 1rem; /* Più spazio per l'effetto gradiente */
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}
/* ======================================= */
/* === NUOVI STILI: TIMELINE PROGETTO V2 === */
/* ======================================= */

/* --- Layout Principale e Header --- */
.timeline-layout {
    display: grid;
    grid-template-columns: 1fr 320px; /* Colonna principale flessibile, colonna destra fissa */
    gap: 2rem;
    align-items: flex-start;
}

#timelineHeaderContext {
    align-items: flex-start;
}

.header-next-step {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 0.75rem 1.25rem;
    max-width: 450px;
    font-size: 0.9rem;
}
.header-next-step strong {
    color: var(--primary-color);
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* --- Card delle Fasi --- */
.timeline-main-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.phase-card {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    transition: all 0.2s ease-out;
    border-left: 4px solid var(--bs-border-color);
}

.phase-card-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.phase-card:hover {
    border-color: var(--border-color-2);
}

.phase-card-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--heading-text);
    margin: 0;
}

.phase-card-progress-bar {
    height: 6px;
    background-color: var(--input-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}
.phase-card-progress-bar div {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.phase-card-body {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--input-border);
}
.phase-card-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    font-size: 0.9rem;
}
.detail-item strong {
    display: block;
    color: var(--light-text);
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.detail-item .status-chip { font-size: 0.85rem; }

.phase-card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--input-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.phase-actions .btn-soft {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}
.phase-compliance-badges {
    display: flex;
    gap: 0.5rem;
}
.phase-compliance-badges .compliance-badge {
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
}

/* --- Stati Visuali delle Card --- */
.phase-card.status-completed { border-left-color: var(--success-color); }
.phase-card.status-completed .phase-card-header h3::before { content: '✅'; margin-right: 0.75rem; }

.phase-card.status-in-progress { border-left-color: var(--primary-color); }
.phase-card.status-in-progress .phase-card-header {
    background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
}

.phase-card.status-on-hold { border-left-color: var(--warning-color); }
.phase-card.status-on-hold .status-chip { background-color: color-mix(in srgb, var(--warning-color) 25%, transparent); color: var(--warning-color); }

.phase-card.status-blocked { border-left-color: var(--danger-color); }
.phase-card.status-blocked .status-chip { background-color: color-mix(in srgb, var(--danger-color) 15%, transparent); color: var(--danger-color); }

.phase-card.status-pending { opacity: 0.7; }
.phase-card.status-pending:hover { opacity: 1; }

/* --- Pannello Compliance (destra) --- */
.compliance-panel {
    position: sticky;
    top: 2rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}
.compliance-panel h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--input-border);
}
.compliance-panel ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.compliance-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.compliance-list-item strong {
    font-weight: 500;
}

/* --- Drawer Dettaglio Fase --- */
.details-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1090;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}
.details-drawer-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}
.details-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    background-color: var(--sidebar-bg);
    z-index: 1100;
    box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.details-drawer.is-open {
    transform: translateX(0);
}
.drawer-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.drawer-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
}
/* ======================================= */
/* === STILI TIMELINE VERTICALE (V4 - ALIGNMENT FIX) === */
/* ======================================= */

/* --- Keyframes for the animation "loading" --- */
@keyframes shimmer-vertical {
    0% { background-position: 0 -200px; }
    100% { background-position: 0 200px; }
}


/* --- Layout Generale --- */
.timeline-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    align-items: flex-start;
}

.timeline-main-column {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem 2rem;
}

/* --- Contenitore Timeline con Linee Sovrapposte --- */
.timeline-container {
    position: relative;
    width: 100%;
    padding-left: 30px;
}

/* 1. La linea di sfondo (grigia, con animazione) */
.timeline-container::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(
        180deg,
        var(--input-border),
        var(--input-border),
        color-mix(in srgb, var(--primary-color) 40%, var(--input-border)),
        var(--input-border),
        var(--input-border)
    );
    background-size: 100% 200px;
    animation: shimmer-vertical 2s linear infinite;
}

/* 2. La linea di progresso (colorata, in primo piano) */
.timeline-container::after {
    content: '';
    position: absolute;
    left: 8px;
    top: 10px;
    width: 4px;
    background-color: var(--success-color);
    border-radius: 2px;
    height: var(--timeline-progress-height, 0px); 
    z-index: 1;
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}


/* --- Elemento Singolo della Timeline --- */
.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}
.timeline-item:last-child {
    margin-bottom: 0;
}

/* Il punto sulla linea (con la posizione corretta) */
.timeline-item-icon {
    position: absolute;
    left: -2px;
    top: 0; /* MODIFICA: Spostato da 5px a 0 per allinearlo in alto */
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--card-bg);
    border: 4px solid var(--bs-border-color);
    z-index: 2;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* La card con i dettagli (senza effetto hover) */
.timeline-item-content {
    padding: 1.25rem 1.5rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s; 
}

.timeline-item-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    margin: 0 0 0.5rem 0;
}
.timeline-item-content .status-text,
.timeline-item-content .date-range {
    font-size: 0.85rem;
    color: var(--light-text);
    font-weight: 500;
}
.timeline-item-content .status-text { margin-bottom: 0.75rem; }


/* --- Variazioni di Stato --- */

/* Stato: Completato */
.timeline-item.status-completed .timeline-item-icon {
    border-color: var(--success-color);
    background-color: var(--success-color);
}
.timeline-item.status-completed .timeline-item-icon::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #fff;
    font-size: 0.7rem;
}
.timeline-item.status-completed .timeline-item-content {
    background-color: color-mix(in srgb, var(--success-color) 10%, transparent);
    border-color: color-mix(in srgb, var(--success-color) 25%, transparent);
}


/* Stato: In Corso (con animazione) */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary-color) 40%, transparent); }
    70% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--primary-color) 0%, transparent); }
    100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary-color) 0%, transparent); }
}
.timeline-item.status-in-progress .timeline-item-icon {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    animation: pulse 2s infinite;
}
.timeline-item.status-in-progress .timeline-item-content {
    border-color: var(--primary-color);
}


/* Stato: Bloccato o In Pausa */
.timeline-item.status-on-hold .timeline-item-icon { border-color: var(--warning-color); }
.timeline-item.status-blocked .timeline-item-icon { border-color: var(--danger-color); }

/* --- Pannello Compliance (invariato) --- */
.compliance-panel {
    position: sticky;
    top: 2rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}
.compliance-panel h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--input-border);
}
.compliance-panel ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
/* ======================================= */
/* === NUOVI STILI PER LA SIDEBAR TIMELINE === */
/* ======================================= */

.timeline-sidebar {
    position: sticky;
    top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Spazio tra i widget */
}

.widget-card {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
}

.widget-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--input-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--heading-text);
}

/* Stili per il widget "Team di Progetto" */
.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.contact-item:last-child {
    margin-bottom: 0;
}
.contact-item .user-avatar-btn {
    width: 40px;
    height: 40px;
}
.contact-item .user-avatar-initial {
    font-size: 1.2rem;
}
.contact-item-info strong {
    display: block;
    font-weight: 600;
    color: var(--bs-body-color);
}
.contact-item-info span {
    font-size: 0.85rem;
    color: var(--light-text);
}

/* AGGIUNGI QUESTO BLOCCO ALLA FINE DI styles.css */
#projectTeamContainer .contact-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: var(--border-radius);
    margin: -1rem; /* Trucco per estendere l'area cliccabile */
    padding: 1rem;
    transition: background-color 0.2s ease-out;
}

#projectTeamContainer .contact-item-link:hover {
    background-color: var(--menu-hover-bg);
}
/* ======================================= */
/* === STILI PER IL WIDGET PROJECT PULSE === */
/* ======================================= */

.project-pulse-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Stile per il grafico a ciambella */
.pulse-chart-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}
.pulse-score {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading-text);
}

/* Stile per le metriche (giorni, task) */
.pulse-metrics {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.pulse-metrics .metric-item {
    text-align: left;
}
.pulse-metrics .metric-item strong {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}
.pulse-metrics .metric-item span {
    font-size: 0.85rem;
    color: var(--light-text);
    font-weight: 500;
}

/* Stile per la lista delle prossime scadenze */
.upcoming-deadlines h5 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
    margin: 0 0 0.75rem 0;
    padding-top: 1rem;
    border-top: 1px solid var(--input-border);
}
.upcoming-deadlines ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.deadline-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    background-color: var(--input-bg);
    padding: 0.6rem 0.8rem;
    border-radius: var(--border-radius);
}
.deadline-item .task-name {
    font-weight: 500;
    color: var(--bs-body-color);
}
.deadline-item .due-date {
    font-weight: 600;
    color: var(--light-text);
    background-color: var(--menu-hover-bg);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
}
.deadline-item.is-overdue .due-date {
    color: var(--danger-color);
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
}
/* ======================================= */
/* === STILI PER LE ICONE NELLE KPI CARDS === */
/* ======================================= */

.kpi-card-icon .octicon {
    width: 28px;  /* Dimensione adatta per il contenitore 60x60px */
    height: 28px;
    filter: none; /* Rimuove l'inversione di colore per farle risaltare sullo sfondo colorato */
}

/* Colora le icone per abbinarle allo sfondo "soft" */
.bg-soft-blue .octicon {
    filter: invert(37%) sepia(88%) saturate(3001%) hue-rotate(224deg) brightness(97%) contrast(95%);
}
.bg-soft-orange .octicon {
    filter: invert(80%) sepia(58%) saturate(1353%) hue-rotate(349deg) brightness(101%) contrast(102%);
}
.bg-soft-green .octicon {
    filter: invert(39%) sepia(21%) saturate(2203%) hue-rotate(107deg) brightness(94%) contrast(89%);
}
.bg-soft-purple .octicon {
    filter: invert(44%) sepia(31%) saturate(1455%) hue-rotate(238deg) brightness(90%) contrast(86%);
}
/* ======================================= */
/* === STILI PER ICONE NELLE CARD TIMELINE === */
/* ======================================= */

.timeline-item-content .card-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.timeline-item-content .card-title-wrapper .octicon {
    width: 20px;
    height: 20px;
    filter: none; /* Rimuove l'inversione di default */
    transition: filter 0.3s ease;
}

/* Colora l'icona in base allo stato della fase */
.timeline-item.status-completed .octicon {
    filter: invert(39%) sepia(21%) saturate(2203%) hue-rotate(107deg) brightness(94%) contrast(89%); /* Verde */
}

.timeline-item.status-in-progress .octicon {
    filter: invert(37%) sepia(88%) saturate(3001%) hue-rotate(224deg) brightness(97%) contrast(95%); /* Blu */
}

.timeline-item.status-pending .octicon,
.timeline-item.status-on-hold .octicon,
.timeline-item.status-blocked .octicon {
    filter: invert(65%) sepia(6%) saturate(379%) hue-rotate(175deg) brightness(89%) contrast(86%); /* Grigio */
}
/* ADD these new styles to the end of your styles.css file */

/* --- Task & CR Section Enhancements --- */

/* Impact Labels for Task Table */
.impact-label {
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 1rem;
    font-size: 0.8rem;
    text-align: center;
    display: inline-block;
}
.impact-label.impact-high {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
}
.impact-label.impact-medium {
    background-color: color-mix(in srgb, var(--warning-color) 25%, transparent);
    color: var(--warning-color);
}
.impact-label.impact-low {
    background-color: color-mix(in srgb, var(--info-color) 20%, transparent);
    color: var(--info-color);
}


/* Impact Icons for CR Table */
.impact-icons {
    display: flex;
    gap: 0.5rem;
}
.impact-icons span {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--light-text);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
}
.impact-icons span.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Item Detail Drawer Content */
#itemDetailDrawerContent h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 1.5rem 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
#itemDetailDrawerContent h4:first-of-type {
    margin-top: 0;
}

#itemDetailDrawerContent .drawer-divider {
    height: 1px;
    background-color: var(--input-border);
    margin: 2rem 0;
}

.q-a-placeholder {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 1rem;
}
.q-a-placeholder p {
    font-style: italic;
    color: var(--light-text);
    margin-bottom: 0.75rem;
}
.q-a-placeholder textarea {
    width: 100%;
    min-height: 80px;
    background-color: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    color: var(--input-text);
    margin-bottom: 0.75rem;
}
.q-a-placeholder textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.drawer-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--input-border);
}
/* ADD these new styles to the end of your styles.css file */

/* --- New CR Modal Specifics --- */
.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    padding: 0.5rem 0;
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
    cursor: pointer;
}

.form-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}
/* In styles.css, find the .modal-overlay.hidden rule and REPLACE it with this: */
.modal-overlay.hidden {
  display: none !important;
}

/* Find the .modal-overlay rule and ensure it has 'display: flex' */
/* Assicurati che il blocco base sia così */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex; 
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    z-index: 1050;

    /* --- Animation State (Start Hidden) --- */
    opacity: 0;
    pointer-events: none; /* <--- FONDAMENTALE: impedisce di bloccare i click quando è invisibile */
    transition: opacity 0.3s ease-out;
}

/* E che lo stato visibile lo riattivi */
.modal-overlay.is-visible {
    opacity: 1;
    pointer-events: auto; /* <--- FONDAMENTALE: riattiva i click quando è visibile */
}
/* In styles.css, ADD this entire new block at the end of the file */

/* ======================================= */
/* === LOG TOAST NOTIFICATION STYLES     === */
/* ======================================= */

.log-toast-container {
    position: fixed;
    bottom: 1.5rem; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999; /* This ensures it's on top of all other content */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.log-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 320px;
    background-color: var(--card-bg);
    color: var(--bs-body-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--bs-border-color);
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.21, 1.02, 0.73, 1);
}

.log-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.log-toast .toast-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.log-toast.loading .toast-icon {
    color: var(--primary-color);
}
.log-toast.success .toast-icon {
    color: var(--success-color);
}
.log-toast.error .toast-icon {
    color: var(--danger-color);
}

.fa-spin {
    animation: fa-spin 1.5s linear infinite;
}

@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* ADD these new styles at the end of your styles.css file */

/* --- KPI & ROI Section --- */

#kpi-roi-section .kpi-card .value {
    font-size: 2.2rem; /* Adjust font size for the 5-column layout */
}
#kpi-roi-section .kpi-card.text-green .value {
    color: var(--success-color);
}
#kpi-roi-section .kpi-card .status-chip {
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
    text-transform: capitalize;
}

/* Confidence Badge Colors */
.confidence-high {
    background-color: color-mix(in srgb, var(--success-color) 20%, transparent);
    color: var(--success-color);
}
.confidence-medium {
    background-color: color-mix(in srgb, var(--warning-color) 25%, transparent);
    color: var(--warning-color);
}
.confidence-low {
    background-color: var(--menu-hover-bg);
    color: var(--light-text);
}

/* Chart Containers */
.chart-container {
    height: 300px;
    position: relative;
}
.chart-container h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--light-text);
    margin-bottom: 1rem;
    text-align: center;
}
/* ADD these new styles at the end of your styles.css file */

/* --- Privacy Center Specifics --- */
.compliance-badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.document-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1rem;
}

.document-item {
    background-color: var(--input-bg);
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--input-border);
}
.document-item-icon {
    font-size: 1.5rem;
    color: var(--light-text);
}
.document-item-details {
    flex-grow: 1;
}
.document-item-details strong {
    font-weight: 600;
    color: var(--heading-text);
}
.document-item-details span {
    display: block;
    font-size: 0.8rem;
    color: var(--light-text);
}

.settings-pane-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--input-border);
    display: flex;
    justify-content: flex-end;
    background-color: var(--input-bg);
}
/* ADD these new styles at the end of your styles.css file */

/* --- Privacy Center Badge Icons --- */
.compliance-badge .octicon {
    width: 16px;
    height: 16px;
    filter: none; /* Rimuove l'inversione di default per un controllo preciso del colore */
}

/* Colora le icone Octicon con i colori del tema */
.compliance-badge .octicon.text-green {
    filter: invert(49%) sepia(50%) saturate(1001%) hue-rotate(90deg) brightness(91%) contrast(88%);
}
.compliance-badge .octicon.text-red {
    filter: invert(34%) sepia(41%) saturate(2337%) hue-rotate(330deg) brightness(92%) contrast(90%);
}
.compliance-badge .octicon.text-yellow {
    filter: invert(81%) sepia(33%) saturate(3015%) hue-rotate(345deg) brightness(101%) contrast(101%);
}

/* Stili per il contenuto della policy di retention */
#privacyRetentionRules ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

#privacyRetentionRules li {
    padding-left: 0.5rem;
    line-height: 1.6;
}
/* AGGIUNGI QUESTO BLOCCO ALLA FINE DI styles.css */

/* --- Sezione Sicurezza --- */

.security-overview-badges {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    font-weight: 500;
    transition: all 0.2s ease-out;
    cursor: help; /* Indica che si può avere più info */
}

.security-badge .status-icon {
    font-size: 1.2rem;
}

.security-badge.status-ok {
    border-left: 4px solid var(--success-color);
}
.security-badge.status-ok .status-icon {
    color: var(--success-color);
}

.security-badge.status-warning {
    border-left: 4px solid var(--warning-color);
}
.security-badge.status-warning .status-icon {
    color: var(--warning-color);
}

.security-badge.status-error {
    border-left: 4px solid var(--danger-color);
}
.security-badge.status-error .status-icon {
    color: var(--danger-color);
}

.security-badge:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
    background-color: var(--menu-hover-bg);
}

.call-out {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    border-left: 3px solid var(--primary-color);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--bs-body-color);
}

#security-section ul {
    list-style-type: none;
    padding-left: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

#security-section .styled-table.compact td,
#security-section .styled-table.compact th {
    padding: 0.6rem;
}
/* AGGIUNGI QUESTO BLOCCO ALLA FINE DI styles.css */

/* --- Sezione Documenti --- */
.document-filters {
    flex-wrap: wrap;
    gap: 1rem;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Stili per il Drawer dei Dettagli */
#documentDrawerContent h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
    margin: 1.5rem 0 1rem 0;
    border-bottom: 1px solid var(--input-border);
    padding-bottom: 0.5rem;
}
#documentDrawerContent h4:first-of-type {
    margin-top: 0;
}

.meta-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    font-size: 0.9rem;
}
.meta-item strong {
    display: block;
    color: var(--light-text);
    font-size: 0.8rem;
    font-weight: 500;
}
.meta-item span {
    font-weight: 500;
}

.hash-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--input-bg);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 0.85rem;
}
.hash-container .hash-text {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hash-container i {
    cursor: pointer;
    color: var(--light-text);
}

.hash-container i:hover {
    color: var(--primary-color);
}

.drawer-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--input-border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
/* ======================================= */
/* === OBIETTIVO #1: BOTTONI APPROVAZIONE === */
/* ======================================= */

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.table-actions .btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ======================================= */
/* === OBIETTIVO #2: AI CHATBOT          === */
/* ======================================= */

/* --- Pulsante Fluttuante --- */
.flowcoach-ai-tutor {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: #FFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    border: none;
}
.flowcoach-ai-tutor:hover {
    transform: translateY(-3px) scale(1.05);
    background-color: color-mix(in srgb, var(--primary-color) 90%, black);
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

/* --- Finestra Modale Chat --- */
.modal-panel.ai-chat-modal {
    display: flex;
    flex-direction: column;
}
.ai-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--input-border);
    flex-shrink: 0;
}
.ai-modal-header img {
    width: 28px;
    height: 28px;
}
.ai-modal-header .modal-close-btn {
    margin-left: auto;
}

.ai-chat-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: var(--input-bg);
}
.chat-message-row {
    display: flex;
    gap: 0.75rem;
    max-width: 90%;
}
.chat-message-row.ai {
    align-self: flex-start;
}
.chat-message-row.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background-color: var(--card-bg);
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-avatar img {
    width: 24px;
    height: 24px;
}
.ai-chat-bubble {
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    max-width: 100%;
    line-height: 1.6;
    font-size: 0.95rem;
    word-wrap: break-word;
}
.ai-chat-bubble.ai {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-bottom-left-radius: 4px;
}
.ai-chat-bubble.user {
    background-color: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Stile per l'indicatore "reasoning..." */
.reasoning-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--light-text);
    font-weight: 500;
}
.reasoning-indicator .reasoning-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Stile per i prompt suggeriti */
.ai-prompt-suggestions {
    padding: 0.5rem 0 0 50px; /* Allineato con le bolle di chat */
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.prompt-suggestion-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
    color: var(--primary-color);
    border-radius: 1rem;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease-out;
}
.prompt-suggestion-btn:hover {
    background-color: color-mix(in srgb, var(--primary-color) 20%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}
.prompt-suggestion-btn i {
    color: var(--primary-color);
}

.ai-chat-input-area {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--input-border);
    background-color: var(--sidebar-bg);
    flex-shrink: 0;
}
#aiChatInput {
    flex-grow: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    height: 44px;
    padding: 0 1rem;
    color: var(--input-text);
    outline: none;
}
#aiChatInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}
#aiChatSendBtn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 1.1rem;
}

/* ======================================= */
/* === OBIETTIVO #3: CARD UPSELL         === */
/* ======================================= */

.locked-card {
    background-color: var(--input-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease-out;
}

.locked-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.locked-card .locked-icon {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.25rem;
    color: var(--light-text);
    opacity: 0.7;
}

.locked-card .locked-content {
    filter: grayscale(80%);
    opacity: 0.6;
    transition: all 0.3s ease-out;
}

.locked-card:hover .locked-content {
    filter: grayscale(0%);
    opacity: 1;
}

.locked-card .locked-bg-icon {
    font-size: 3.5rem;
    color: var(--bs-border-color);
    position: absolute;
    bottom: -10px;
    right: 10px;
    opacity: 0.5;
    transform: rotate(-15deg);
}

.locked-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--heading-text);
    margin-bottom: 0.5rem;
}

.locked-card p {
    color: var(--light-text);
    font-size: 0.9rem;
    line-height: 1.5;
}
/* ======================================= */
/* === EFFETTO WAVE "STO RAGIONANDO..."  === */
/* ======================================= */

/* Stile per il testo "Sto ragionando..." */
.reasoning-text {
    font-weight: 500;
    font-size: 1rem;
    align-self: center; /* Allinea verticalmente il testo con l'avatar */
    margin-left: 0.75rem; /* Aggiunge spazio dall'avatar */

    /* 1. Crea un sfondo a gradiente */
    background: linear-gradient(
      90deg,
      var(--light-text),
      #fff,
      var(--light-text)
    );
    
    /* 2. Rendi lo sfondo molto più largo del testo */
    background-size: 200% auto;

    /* 3. Ritaglia lo sfondo sulla forma del testo */
    -webkit-background-clip: text;
    background-clip: text;

    /* 4. Rendi il colore del testo trasparente per rivelare il gradiente */
    -webkit-text-fill-color: transparent;
    color: transparent;

    /* 5. Applica l'animazione "wave" */
    animation: text-shimmer 2s linear infinite;
}

/* Keyframe per l'animazione "wave" */
@keyframes text-shimmer {
    to {
        background-position: -200% center;
    }
}

/* Rimuovi il vecchio stile dell'icona rotante se non serve più */
.reasoning-indicator {
    display: none;
}
/* ======================================= */
/* === STILI PANNELLO NOTIFICHE          === */
/* ======================================= */

.notification-container {
    position: relative;
}

.notification-btn .notification-dot.hidden {
    display: none;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1050;
    width: 360px;
    max-width: 90vw;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.2s ease-out;
    max-height: 450px;
    display: flex;
    flex-direction: column;
}

.notification-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--input-border);
    flex-shrink: 0;
}

.notification-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
    margin: 0;
}

.notification-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

.notification-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--input-border);
    transition: background-color 0.2s ease;
}
.notification-item:last-child {
    border-bottom: none;
}
.notification-item:hover {
    background-color: var(--menu-hover-bg);
}

.notification-item-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* Colori icone notifiche */
.notification-item-icon.icon-success {
    background-color: color-mix(in srgb, var(--success-color) 15%, transparent);
    color: var(--success-color);
}
.notification-item-icon.icon-warning {
    background-color: color-mix(in srgb, var(--warning-color) 20%, transparent);
    color: var(--warning-color);
}
.notification-item-icon.icon-info {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
}

.notification-item-content .message {
    font-weight: 500;
    color: var(--bs-body-color);
    line-height: 1.5;
    margin-bottom: 0.25rem;
}
.notification-item-content .timestamp {
    font-size: 0.8rem;
    color: var(--light-text);
}

.notification-item.unread .notification-item-content .message {
    font-weight: 600;
    color: var(--heading-text);
}

.notification-empty {
    padding: 2rem;
    text-align: center;
    color: var(--light-text);
    font-style: italic;
}
@media (max-width: 768px) {
    .kpi-strip { grid-template-columns: 1fr; }
    /* FIX: Rimuovendo flex-direction e align-items si impedisce all'header di impilarsi e nascondere le icone */
    .top-header { gap: 0.75rem; padding: 1rem; }
    .canvas { padding: 1.5rem 1rem; }
}
/* ======================================= */
/* === STILI MODALE UPLOAD DOCUMENTO     === */
/* ======================================= */

/* Stile per il pulsante di upload personalizzato */
.file-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
}
.file-upload-label:hover {
    background-color: var(--bs-border-color);
}

/* Stile per l'anteprima del nome del file */
#fileNamePreview {
    color: var(--light-text);
    margin-left: 1rem;
    font-weight: 500;
}

/* Stile per il pulsante di submit nel modale */
#submitUploadBtn .spinner-border-sm {
    display: none;
}
#submitUploadBtn.loading .spinner-border-sm {
    display: inline-block;
}
#submitUploadBtn.loading .btn-text {
    display: none;
}
/* ======================================= */
/* === RESPONSIVITÀ SEZIONE RIEPILOGO    === */
/* ======================================= */

/* --- Breakpoint per Tablet e Smartphone (fino a 768px) --- */
@media (max-width: 768px) {
    
    /* 1. Intestazione Pagina Riepilogo (Nome Progetto e Contatto)
      Impila verticalmente il blocco del titolo e il blocco del contatto
      e li allinea a sinistra.
    */
    #overview-section .ai-page-header {
        flex-direction: column; /* Impila gli elementi */
        align-items: flex-start; /* Allinea tutto a sinistra */
        gap: 1rem; /* Aggiunge spazio tra i blocchi impilati */
    }
    
    #overview-section .ai-page-header #overviewOptlyxContact {
        text-align: left !important; /* Forza l'allineamento a sinistra per il contatto */
        width: 100%; /* Fa sì che occupi tutta la larghezza */
    }
}

/* --- Breakpoint per Smartphone (fino a 480px) --- */
@media (max-width: 480px) {

    /* 2. Intestazione Card Comunicazioni
      Impila il titolo e i pulsanti di navigazione del carosello.
    */
    #overview-section .card-header {
        flex-direction: column;
        align-items: flex-start; /* Allinea il titolo a sinistra */
        gap: 1rem; /* Spazio tra titolo e pulsanti */
    }
    
    #overview-section .card-header .carousel-nav {
        width: 100%; /* Fa occupare ai pulsanti l'intera larghezza... */
        justify-content: flex-end; /* ...ma li mantiene allineati a destra. */
    }

    /* 3. Card del Carosello Comunicazioni
      Rende la larghezza delle card flessibile (90% dello schermo)
      per evitare l'overflow su schermi molto piccoli (es. 320px).
    */
    .comms-card {
        flex-basis: 90vw; /* Imposta la larghezza al 90% dello schermo */
        max-width: 350px; /* Ma non più grande della loro dimensione originale */
    }
}
/* ======================================= */
/* === STILI FOOTER MODALE UPSELL        === */
/* ======================================= */

.modal-footer .footer-action-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
/* ======================================= */
/* === STILI MODALE CRONOLOGIA DOCUMENTO === */
/* ======================================= */

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.history-item {
    display: flex;
    gap: 1rem;
    padding: 1.25rem 0.5rem;
    border-bottom: 1px solid var(--input-border);
}

.history-item:last-child {
    border-bottom: none;
}

.history-item-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.history-item-icon.version {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
}

.history-item-icon.upload {
    background-color: color-mix(in srgb, var(--success-color) 15%, transparent);
    color: var(--success-color);
}

.history-item-details {
    flex-grow: 1;
}

.history-item-details strong {
    display: block;
    font-weight: 600;
    color: var(--heading-text);
}

.history-item-details .note {
    font-size: 0.9rem;
    color: var(--bs-body-color);
    margin: 0.25rem 0;
}

.history-item-details .timestamp {
    font-size: 0.8rem;
    color: var(--light-text);
    font-weight: 500;
}
/* ======================================= */
/* === STILI TABELLA AUDIT LOG         === */
/* ======================================= */

#auditLogTableBody .audit-actor {
    font-weight: 600;
    color: var(--heading-text);
}

#auditLogTableBody .audit-event-type {
    font-weight: 500;
    color: var(--bs-body-color);
}

#auditLogTableBody .audit-resource-id {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--light-text);
    cursor: pointer;
}
#auditLogTableBody .audit-resource-id:hover {
    color: var(--primary-color);
}
/* ======================================= */
/* === SIDEBAR MOBILE E TOGGLE (V2)    === */
/* ======================================= */

/* --- Pulsante Hamburger (visibile solo su mobile) --- */
#mobileMenuToggle {
    display: none; 
    font-size: 1.5rem;
    color: var(--bs-body-color);
}

/* --- Overlay per lo sfondo scuro --- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1190; /* Appare sopra il contenuto ma sotto la sidebar */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

/* --- Breakpoint per Tablet e Smartphone (fino a 992px) --- */
@media (max-width: 992px) {
    /* Mostra il pulsante hamburger */
    #mobileMenuToggle {
        display: block;
    }

    /* Rimuovi la sidebar dal flusso normale e posizionala fuori schermo */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1200; /* Sopra l'overlay */
        transform: translateX(-100%); /* Nascosto a sinistra */
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important; /* Forza la visualizzazione (per l'animazione) */
        box-shadow: 5px 0 25px rgba(0,0,0,0.2);
    }
    
    /* Rende la navigazione scrollabile se lo schermo è piccolo */
    .sidebar .sidebar-nav {
        flex-grow: 1; /* Permette a questa sezione di occupare tutto lo spazio disponibile */
        overflow-y: auto; /* Aggiunge la barra di scorrimento solo qui */
        padding-bottom: 1rem;
    }

    /* --- Classi per lo stato "Aperto" --- */
    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0); /* Fai scorrere la sidebar in vista */
    }

    /* FIX per l'header (assicura che i pulsanti rimangano in riga) */
    .top-header {
        flex-direction: row; 
        justify-content: space-between;
        gap: 1rem;
    }
    
    .header-right-group {
        display: flex;
        align-items: center;
        gap: 1rem;
    }
}

/* --- Breakpoint per schermi molto piccoli (es. iPhone) --- */
@media (max-width: 480px) {
    .sidebar {
        width: 260px; /* Riduci la larghezza della sidebar per lasciare più spazio */
    }
    .theme-switch-wrapper {
        display: none; /* Nascondi il toggle del tema per risparmiare spazio */
    }
    .header-right-group {
        gap: 0.75rem;
    }
}
/* ======================================= */
/* === STILI PER TEMI COLORE (V2)        === */
/* ======================================= */

/* --- 1. Definizioni Base (Default Blu) --- */
:root {
    --primary-color: #4361ee;
    --primary-gradient: linear-gradient(90deg, #4361ee 0%, #3a86ff 100%);
    --shadow-color-primary: rgba(67, 97, 238, 0.2);
    --shadow-color-primary-soft: rgba(67, 97, 238, 0.1);
    --success-color: #34d399;   /* Smeraldo soft */
    --warning-color: #fbbf24;   /* Giallo ambrato soft */
    --info-color: #60a5fa;      /* Blu cielo soft */
    --danger-color: #ef4444;    /* Rosso leggero */
}

/* --- 2. Nuovi Temi Colore --- */

/* Tema: Crimson (Rosso) */
body.theme-crimson {
    --primary-color: #dc2626;
    --primary-gradient: linear-gradient(90deg, #e11d48 0%, #f87171 100%);
    --bs-link-color: #f87171;
    --bs-link-hover-color: #fbbfb0;
    --shadow-color-primary: rgba(220, 38, 38, 0.2);
    --shadow-color-primary-soft: rgba(220, 38, 38, 0.1);
}
body.theme-crimson.light-mode {
    --primary-color: #dc2626;
    --primary-gradient: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
    --bs-link-color: #b91c1c;
    --bs-link-hover-color: #991b1b;
}

/* Tema: Emerald (Verde) */
body.theme-emerald {
    --primary-color: #10b981;
    --primary-gradient: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    --success-color: #10b981;
    --bs-link-color: #34d399;
    --bs-link-hover-color: #6ee7b7;
    --shadow-color-primary: rgba(16, 185, 129, 0.2);
    --shadow-color-primary-soft: rgba(16, 185, 129, 0.1);
}
body.theme-emerald.light-mode {
    --primary-color: #10b981;
    --primary-gradient: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    --success-color: #10b981;
    --bs-link-color: #059669;
    --bs-link-hover-color: #047857;
}

/* Tema: Violet (Viola) */
body.theme-violet {
    --primary-color: #8b5cf6;
    --primary-gradient: linear-gradient(90deg, #7c3aed 0%, #a78bfa 100%);
    --bs-link-color: #a78bfa;
    --bs-link-hover-color: #c4b5fd;
    --shadow-color-primary: rgba(139, 92, 246, 0.2);
    --shadow-color-primary-soft: rgba(139, 92, 246, 0.1);
}
body.theme-violet.light-mode {
    --primary-color: #8b5cf6;
    --primary-gradient: linear-gradient(90deg, #8b5cf6 0%, #a78bfa 100%);
    --bs-link-color: #7c3aed;
    --bs-link-hover-color: #6d28d9;
}

/* --- 3. Applicazione dei Gradienti --- */
/* Applica il gradiente a tutti i pulsanti primari solidi */
.btn-primary, .btn-primary-filled,
.container.auth .btn,
.btn-run,
.btn.icon-only-send,
.flowcoach-ai-tutor,
.btn-footer-v2.save {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px -5px var(--shadow-color-primary);
}

/* Gestisce l'hover scurendo il gradiente */
.btn-primary:hover:not(:disabled), .btn-primary-filled:hover,
.container.auth .btn:hover:not(:disabled),
.btn-run:hover,
.btn.icon-only-send:hover,
.flowcoach-ai-tutor:hover,
.btn-footer-v2.save:hover {
     filter: brightness(0.9);
     box-shadow: 0 6px 20px -5px var(--shadow-color-primary);
     transform: translateY(-2px);
}

/* --- 4. Applicazione delle Ombre Colorate --- */
/* Applica le ombre colorate all'hover delle card */
.kpi-card:hover, .grid-item:hover, .agent-card:hover, 
.playbook-card-v2:hover, .suggestion-card:hover,
.source-selection-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 30px var(--shadow-color-primary);
}

/* Rende anche i focus degli input colorati */
.form-group input:focus,
.search-bar:focus-within,
.prompt-bar:focus-within,
.global-prompt-bar-v2:focus-within,
.form-control-sm:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--shadow-color-primary-soft);
}
/* ======================================= */
/* === EFFETTO VETRO (GLASSMORPHISM)     === */
/* ======================================= */

/* Applica l'effetto quando il body ha la classe */
body.glassmorphism-effect .sidebar,
body.glassmorphism-effect .top-header {
    /* Rende lo sfondo semi-trasparente */
    background-color: color-mix(in srgb, var(--sidebar-bg) 80%, transparent);
    
    /* Applica la sfocatura (blur) */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    
    /* Rende anche il bordo semi-trasparente */
    border-color: color-mix(in srgb, var(--bs-border-color) 50%, transparent);
}

/* Migliora la leggibilità su mobile quando la sidebar è aperta */
@media (max-width: 992px) {
    body.glassmorphism-effect .sidebar {
        background-color: color-mix(in srgb, var(--sidebar-bg) 90%, transparent);
    }
}
/* ======================================= */
/* === STILI CHAT PROJECT MANAGER        === */
/* ======================================= */

/* styles.css - NUOVO (CORRETTO) */
#chat-pm-section.active {
    /* Le proprietà display, flex-direction e height 
       sono già definite dalle regole generiche qui sopra. */
}
/* styles.css - NUOVO (CORRETTO) */
#chat-pm-section.active {
    /* Sovrascrive il padding del canvas per andare da bordo a bordo */
    width: calc(100% + 4rem); /* 100% + padding 2rem dx + padding 2rem sx */
    margin-left: -2rem;
    margin-right: -2rem;
    padding-left: 2rem;
    padding-right: 2rem;
    box-sizing: border-box; 
}
.pm-chat-container {
    flex-grow: 1; /* Occupa tutto lo spazio verticale */
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden; /* Nasconde l'overflow */
}

.pm-chat-log {
    flex-grow: 1;
    overflow-y: auto; /* Abilita lo scroll solo per i messaggi */
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background-color: var(--input-bg);
}

/* Stile per una riga di messaggio (avatar + bolla) */
.pm-message-row {
    display: flex;
    gap: 0.75rem;
    max-width: 80%;
}

.pm-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 1.5rem; /* Allinea l'avatar con la bolla */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
    font-size: 1.1rem;
}

.pm-chat-bubble-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Nome del mittente */
.pm-chat-sender {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--light-text);
    margin-bottom: 0.25rem;
    margin-left: 0.75rem;
}

.pm-chat-bubble {
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 0.95rem;
    word-wrap: break-word;
}

/* Messaggi "altri" (PM) */
.pm-message-row.other {
    align-self: flex-start;
}
.pm-message-row.other .pm-chat-bubble {
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-bottom-left-radius: 4px;
}
.pm-message-row.other .pm-chat-sender {
    color: var(--primary-color);
}


/* Messaggi "utente" (Cliente) */
.pm-message-row.user {
    align-self: flex-end;
    flex-direction: row-reverse; /* Inverte avatar e bolla */
}
.pm-message-row.user .pm-chat-bubble-wrapper {
    align-items: flex-end;
}
.pm-message-row.user .pm-chat-bubble {
    background-color: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.pm-message-row.user .pm-chat-sender {
    margin-left: 0;
    margin-right: 0.75rem;
}

/* Form di input */
.pm-chat-form {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--bs-border-color);
    background-color: var(--card-bg);
    flex-shrink: 0;
}

.pm-chat-form input {
    flex-grow: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    height: 44px;
    padding: 0 1rem;
    color: var(--input-text);
    outline: none;
}
.pm-chat-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--shadow-color-primary-soft);
}

.pm-chat-form .btn {
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 1.1rem;
    flex-shrink: 0;
}
/* ======================================= */
/* === STILI CHAT PM (AGGIORNAMENTO)     === */
/* ======================================= */

/* Adatta il form per includere il nuovo pulsante */
.pm-chat-form {
    align-items: center; /* Allinea verticalmente i pulsanti e l'input */
}

.pm-chat-form .btn-icon-only {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    color: var(--light-text);
}
.pm-chat-form .btn-icon-only:hover {
    background-color: var(--menu-hover-bg);
}

/* Bolla di chat per le immagini */
.pm-chat-bubble.bubble-image {
    padding: 0;
    background-color: transparent;
    border: none;
    max-width: 300px;
    overflow: hidden;
}
.pm-chat-bubble.bubble-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    border: 1px solid var(--input-border);
}

/* Bolla di chat per i file */
.pm-chat-bubble.bubble-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}
.pm-chat-bubble.bubble-file .octicon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
.pm-chat-bubble.bubble-file a {
    color: inherit;
    text-decoration: underline;
}
.pm-message-row.user .pm-chat-bubble.bubble-file a {
    color: #fff;
}

/* Testo per il timestamp e la conferma di lettura */
.pm-chat-meta {
    font-size: 0.75rem;
    color: var(--light-text);
    margin: 0.25rem 0.5rem 0;
}
.pm-message-row.user .pm-chat-bubble-wrapper {
    align-items: flex-end; /* Assicura che la meta sia allineata a destra */
}
.pm-message-row.user .pm-chat-meta {
    text-align: right;
}

/* Stile per la conferma "Visto" */
.pm-chat-meta .read-receipt {
    font-weight: 600;
    color: var(--primary-color);
    margin-left: 0.5rem;
}
/* ======================================= */
/* === STILI CHAT PM (OCTICONS V2)       === */
/* ======================================= */

/* Stila le Octicon nei pulsanti del form */
.pm-chat-form .btn .octicon {
    width: 20px; /* Dimensione icona più grande */
    height: 20px;
    filter: invert(var(--octicon-invert, 1)); /* Applica il filtro di inversione di default */
    transition: filter 0.2s ease;
}

/* Pulsante "Allega" (Plus) con sfondo soft */
.pm-chat-form #pmChatAttachBtn {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-radius: 12px; /* Arrotonda i bordi */
    transition: all 0.2s ease-out;
}

/* Colora l'icona "Plus" di blu */
.pm-chat-form #pmChatAttachBtn .octicon {
    filter: invert(37%) sepia(88%) saturate(3001%) hue-rotate(224deg) brightness(97%) contrast(95%);
}
/* Su tema chiaro, l'icona è già blu, non serve filtro */
body.light-mode .pm-chat-form #pmChatAttachBtn .octicon {
    filter: none;
}


/* Stile Hover per il pulsante "Allega" (Plus) */
.pm-chat-form #pmChatAttachBtn:hover {
    background-color: color-mix(in srgb, var(--primary-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px var(--shadow-color-primary-soft);
}

/* L'icona non cambia colore su hover */
.pm-chat-form #pmChatAttachBtn:hover .octicon {
     filter: invert(37%) sepia(88%) saturate(3001%) hue-rotate(224deg) brightness(97%) contrast(95%);
}
body.light-mode .pm-chat-form #pmChatAttachBtn:hover .octicon {
    filter: none;
}


/* Pulsante "Invia" (Aereo) */
.pm-chat-form #pmChatSendBtn .octicon {
    /* Il pulsante è .btn-soft.primary. L'icona deve essere BLU */
    filter: invert(37%) sepia(88%) saturate(3001%) hue-rotate(224deg) brightness(97%) contrast(95%);
}
/* Su tema chiaro, l'icona è già blu, non serve filtro */
body.light-mode .pm-chat-form #pmChatSendBtn .octicon {
    filter: none;
}
/* Su hover, il pulsante diventa solido, l'icona deve essere bianca */
.pm-chat-form #pmChatSendBtn:hover .octicon {
    filter: invert(1); /* Inverti per diventare bianco */
}

/* Aggiorna la bolla dei file per un'icona più grande e visibile */
.pm-chat-bubble.bubble-file .octicon {
    width: 24px;
    height: 24px;
    filter: invert(var(--octicon-invert, 1));
}
.pm-message-row.user .pm-chat-bubble.bubble-file .octicon {
    filter: invert(1); /* Bianco su bolla blu */
}
body.light-mode .pm-message-row.other .pm-chat-bubble.bubble-file .octicon {
    filter: invert(0); /* Nero su bolla chiara */
}
/* ======================================= */
/* === SCOMPARSA PULSANTE AI IN CHAT     === */
/* ======================================= */

/* Di default, il pulsante è a destra e visibile */
.flowcoach-ai-tutor {
    right: 2rem;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease, transform 0.3s ease, right 0.3s ease;
    pointer-events: auto;
}

/* Quando la chat è attiva, fai sparire il pulsante */
body.chat-pm-active .flowcoach-ai-tutor {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none; /* Rende il pulsante non cliccabile */
}
/* ======================================= */
/* === STILI CHAT PM (LAYOUT WIDE)       === */
/* ======================================= */

/* 1. Corregge l'altezza e rimuove il padding laterale del .canvas */
/* styles.css - NUOVO (CORRETTO) */
/* 1. Corregge l'altezza e rimuove il padding laterale del .canvas */


/* 2. Applica i bordi arrotondati al contenitore principale della chat */
.pm-chat-container.card {
    border-radius: var(--border-radius-lg); /* Es. 12px */
    overflow: hidden; /* Necessario per far rispettare i bordi ai figli */
}

/* 3. (Bonus) Arrotonda leggermente di più le bolle della chat */
.pm-chat-bubble {
    border-radius: 16px; /* Aumentato da 12px */
}
.pm-message-row.other .pm-chat-bubble {
    border-bottom-left-radius: 6px; /* Aumentato da 4px */
}
.pm-message-row.user .pm-chat-bubble {
    border-bottom-right-radius: 6px; /* Aumentato da 4px */
}

/* styles.css - NUOVO (CORRETTO) */
@media (max-width: 992px) {
    #chat-pm-section.active {
        width: calc(100% + 2rem);
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
@media (max-width: 768px) {
    #chat-pm-section.active {
        /* L'altezza è già gestita dalla regola .content-section.active */
    }
}
/* ======================================= */
/* === STILI CHAT PM (MODALITÀ PM INBOX) === */
/* ======================================= */

/* Layout per l'app chat (lista + chat) */
.pm-chat-container.comm-hub-main-container {
    display: grid;
    /* 320px per la lista, il resto per la chat */
    grid-template-columns: 320px 1fr; 
    padding: 0;
    height: calc(100% - 95px); /* Altezza - header */
}

/* Stile per il pannello chat */
.pm-chat-container #pmChatPane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* Header della chat attiva (visibile solo per il PM) */
#pmChatActiveHeader {
    display: none; /* Nascosto di default per i clienti */
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color);
}
#pmChatActiveHeader h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Lista delle conversazioni (Inbox) */
.pm-inbox-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
}

.pm-inbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--input-border);
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.pm-inbox-item:hover {
    background-color: var(--menu-hover-bg);
}
.pm-inbox-item.active {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent);
}

.pm-inbox-item .pm-chat-avatar {
    margin-top: 0; /* Resetta il margine dall'altra chat */
}

.pm-inbox-details {
    flex-grow: 1;
    overflow: hidden;
}
.pm-inbox-details .name {
    font-weight: 600;
    color: var(--heading-text);
}
.pm-inbox-details .last-message {
    font-size: 0.85rem;
    color: var(--light-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-inbox-details .unread-dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}
/* ======================================= */
/* === 3X. SEZIONE SICUREZZA (CUSTOM)    === */
/* ======================================= */

/* --- Layout Grid (per rimpiazzare .settings-layout) --- */
#security-section .grid-container {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* --- Card Header con Octicons --- */
#security-section .card-header h4 {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading-text);
}

#security-section .card-header .octicon {
    /* Questo filtro rende l'icona grigia (light-text) */
    filter: invert(65%) sepia(6%) saturate(379%) hue-rotate(175deg) brightness(89%) contrast(86%);
}

body.light-mode #security-section .card-header .octicon {
    filter: none; /* In light mode, l'SVG è già scuro */
}


/* --- Stile per le Liste <ul> nelle Card --- */
.security-details-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.security-details-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
}

.security-details-list li strong {
    font-weight: 500;
    color: var(--light-text);
}

.security-details-list li span,
.security-details-list li a {
    font-weight: 600;
    color: var(--bs-body-color);
}

/* --- Stile Badge (es. "Nessun accesso umano") --- */
#security-section .compliance-badge.status-ok {
    background-color: color-mix(in srgb, var(--success-color) 15%, transparent);
    color: var(--success-color);
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius);
}

#security-section .compliance-badge .octicon {
    filter: invert(39%) sepia(21%) saturate(2203%) hue-rotate(107deg) brightness(94%) contrast(89%); /* Verde */
}

body.light-mode #security-section .compliance-badge .octicon {
    filter: invert(39%) sepia(21%) saturate(2203%) hue-rotate(107deg) brightness(94%) contrast(89%);
}


/* --- Panoramica Badge (quelli in alto) --- */
.security-overview-badges {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-left-width: 4px; /* Bordo colorato a sinistra */
    font-weight: 600;
    color: var(--bs-body-color);
    transition: all 0.2s ease-out;
    cursor: help;
}

.security-badge:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
    background-color: var(--menu-hover-bg);
}

.security-badge .status-icon {
    font-size: 1.2rem;
}

/* Colori degli stati per i badge */
.security-badge.status-ok {
    border-left-color: var(--success-color);
}
.security-badge.status-ok .status-icon {
    color: var(--success-color);
}

.security-badge.status-warning {
    border-left-color: var(--warning-color);
}
.security-badge.status-warning .status-icon {
    color: var(--warning-color);
}

.security-badge.status-error {
    border-left-color: var(--danger-color);
}
.security-badge.status-error .status-icon {
    color: var(--danger-color);
}

/* Stile Call-out (già esistente, ma migliorato) */
.call-out {
    margin-top: 1rem;
    padding: 0.75rem 1.25rem;
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    border-left: 4px solid var(--primary-color);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--bs-body-color);
}
/* ======================================= */
/* === FULLCALENDAR SOFT & SMOOTH UI   === */
/* ======================================= */

#calendar-section .card {
    border: none;
    box-shadow: var(--shadow-sm);
    overflow: hidden; /* Assicura che i bordi arrotondati siano rispettati */
}

/* --- 1. Toolbar e Pulsanti --- */
.fc .fc-toolbar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading-text);
}
.fc .fc-button-primary {
    background-color: var(--input-bg) !important;
    border: 1px solid var(--bs-border-color) !important;
    color: var(--heading-text) !important;
    font-weight: 600;
    border-radius: 10px !important; /* Pulsanti più arrotondati */
    padding: 0.6rem 1.2rem !important;
    transition: all 0.2s ease;
    box-shadow: none !important; 
}
.fc .fc-button-primary:hover {
    background-color: var(--menu-hover-bg) !important;
    transform: translateY(-1px);
}
.fc .fc-button-primary.fc-button-active {
    background-color: var(--primary-color) !important;
    color: #fff !important;
    border-color: var(--primary-color) !important;
}

/* --- 2. Griglia Mese (DayGrid) --- */
.fc-theme-standard td, .fc-theme-standard th {
    border-color: var(--bs-border-color) !important;
}
.fc .fc-daygrid-day-number {
    color: var(--light-text);
    font-weight: 500;
    padding: 8px;
}
.fc .fc-day-today {
    background-color: color-mix(in srgb, var(--primary-color) 5%, transparent) !important;
}
.fc .fc-col-header-cell-cushion { /* Giorni della settimana */
    color: var(--light-text);
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 12px 0;
}

/* --- 3. Eventi (Pillole Soft) --- */
.fc-event {
    border: none !important;
    border-radius: 6px !important; /* Arrotondati */
    padding: 3px 6px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    margin: 2px !important;
    cursor: pointer;
    transition: all 0.2s ease;
}
.fc-event:hover {
    filter: brightness(1.08);
    transform: scale(1.02);
}

/* Colori Soft per gli Eventi nella griglia */
.fc-event-task-completed {
    background-color: color-mix(in srgb, var(--success-color) 20%, transparent) !important;
    color: var(--success-color) !important;
    border-left: 3px solid var(--success-color) !important;
}
.fc-event-task-pending {
    background-color: color-mix(in srgb, var(--warning-color) 20%, transparent) !important;
    color: var(--warning-color) !important; /* Testo colorato invece che nero */
    border-left: 3px solid var(--warning-color) !important;
}
.fc-event-phase {
    background-color: color-mix(in srgb, var(--primary-color) 20%, transparent) !important;
    color: var(--primary-color) !important;
    border-left: 3px solid var(--primary-color) !important;
}

/* --- 4. FIX VISTA LISTA (Quella rotta nell'immagine) --- */

/* Rimuove i bordi neri e lo sfondo scuro dalle intestazioni dei giorni */
.fc .fc-list-day-cushion {
    background-color: var(--menu-hover-bg) !important; /* Grigio molto chiaro/scuro a seconda del tema */
}
.fc .fc-list-day-text, .fc .fc-list-day-side-text {
    color: var(--heading-text) !important;
    font-weight: 700;
    text-decoration: none !important;
}

/* Stile per le righe degli eventi in lista */
.fc-list-event:hover td {
    background-color: transparent !important; /* Rimuove l'hover di default brutto */
}
.fc-list-event {
    transition: all 0.2s ease;
}
.fc-list-event:hover {
    background-color: var(--input-bg) !important; /* Hover soft personalizzato */
    transform: translateX(5px); /* Piccolo movimento interattivo */
}

/* Il "pallino" colorato nella vista lista */
.fc-list-event-dot {
    border-width: 6px !important; /* Più grande e visibile */
    border-radius: 50%;
}

/* Testi nella vista lista */
.fc-list-event-title {
    color: var(--bs-body-color) !important;
    font-weight: 500;
}
.fc-list-event-time {
    color: var(--light-text) !important;
    font-size: 0.9rem;
}

/* Forza i colori dei pallini in base alle nostre classi */
.fc-event-task-completed .fc-list-event-dot { border-color: var(--success-color) !important; }
.fc-event-task-pending .fc-list-event-dot { border-color: var(--warning-color) !important; }
.fc-event-phase .fc-list-event-dot { border-color: var(--primary-color) !important; }

/* Rimuove le righe vuote fastidiose se presenti */
.fc-list-empty {
    background-color: var(--input-bg) !important;
    color: var(--light-text) !important;
    font-style: italic;
}
/* ======================================= */
/* === STILI DRAWER (MODALE LATERALE) === */
/* ======================================= */

/* Overlay scuro che copre lo schermo */
.details-drawer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.5); /* Sfondo semi-trasparente scuro */
    z-index: 1090;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
    backdrop-filter: blur(2px); /* Effetto sfocatura leggero sullo sfondo */
}
.details-drawer-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Il cassetto stesso */
.details-drawer {
    position: fixed;
    top: 0; right: 0;
    width: 100%;
    max-width: 450px; /* Larghezza massima del cassetto */
    height: 100%;
    background-color: var(--card-bg); /* Usa il colore delle card del tema */
    z-index: 1100;
    box-shadow: -5px 0 30px rgba(0,0,0,0.2); /* Ombra profonda verso sinistra */
    display: flex;
    flex-direction: column;
    transform: translateX(100%); /* Parte nascosto a destra */
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1); /* Animazione fluida "ease-out" */
}
.details-drawer.is-open {
    transform: translateX(0); /* Scivola dentro */
}

/* Header del cassetto */
.details-drawer .drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.details-drawer .drawer-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--heading-text);
}

/* Contenuto scrollabile del cassetto */
.details-drawer .drawer-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Stili per i metadati dentro il drawer (es. date, stato) */
.cal-event-meta {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}
.cal-event-meta-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--input-bg); /* Sfondo leggero */
    border: 1px solid var(--bs-border-color);
    border-radius: 12px; /* Arrotondato */
    transition: border-color 0.2s ease;
}
.cal-event-meta-item:hover {
    border-color: var(--primary-color); /* Effetto hover sottile */
}
.cal-event-meta-item i.cal-event-icon {
    font-size: 1.4rem;
    color: var(--primary-color);
    opacity: 0.8;
}
.cal-event-meta-item div strong {
    display: block;
    font-size: 0.85rem;
    color: var(--light-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}
.cal-event-meta-item div {
    color: var(--heading-text);
    font-weight: 500;
}

/* =================================== */
/* === FIX LAYOUT AUTH CONTAINER   === */
/* =================================== */

#authContainer {
    display: flex;
    justify-content: center;
    /* MODIFICA: Cambiato da 'center' a 'flex-start' per evitare il taglio in alto su schermi piccoli */
    align-items: flex-start; 
    min-height: 100vh;
    background-color: var(--page-bg); 
    /* MODIFICA: Aumentato il padding verticale per dare respiro sopra e sotto quando si scrolla */
    padding: 40px 20px; 
    box-sizing: border-box;
    overflow-y: auto; 
}

.container.auth {
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 480px; 
    text-align: center;
    border: 1px solid var(--bs-border-color);
    /* MODIFICA: 'margin: auto' centra verticalmente quando c'è spazio, 
       ma grazie a 'align-items: flex-start' nel genitore, non taglia la testa se manca spazio */
    margin: auto; 
    flex-shrink: 0; 
}

/* Assicurati che il logo abbia un margine inferiore definito */
.app-logo {
    width: 140px; 
    margin-bottom: 30px; /* Importante per lo spazio dal titolo */
    display: block; /* Assicura che i margini funzionino correttamente */
}
.container.auth .title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--heading-text);
    margin-bottom: 25px; 
}
/* E il margine della descrizione per distanziarla dal primo campo */
.container.auth p.light-text {
    font-size: 0.95rem;
    color: var(--light-text);
    margin-bottom: 30px; /* Spazio maggiore per la descrizione */
}

/* Potrebbe essere utile anche aumentare il margine superiore del form, o del primo form-group */
#signupForm {
    margin-top: 20px; /* Un po' di spazio dal testo descrittivo */
}


.form-group {
    margin-bottom: 20px; /* Ridotto leggermente per compattare un po' */
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--heading-text);
    font-size: 0.9rem;
}

.form-control-custom,
.container.auth input[type="email"],
.container.auth input[type="password"],
.container.auth input[type="text"] {
    width: 100%;
    padding: 14px 18px; /* Padding generoso */
    border: 1px solid var(--bs-border-color);
    border-radius: 10px; /* Input arrotondati */
    background-color: var(--input-bg); /* Sfondo input leggermente diverso */
    color: var(--heading-text);
    font-size: 1rem;
    transition: all 0.2s ease;
}
.container.auth input::placeholder {
    color: var(--light-text);
    opacity: 0.7;
}
.container.auth input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent); /* Glow leggero */
    outline: none;
    background-color: var(--card-bg); /* Sfondo più chiaro al focus */
}

/* Password Toggle Icon */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrapper input {
    padding-right: 45px; /* Spazio per l'icona */
}
.password-toggle-icon {
    position: absolute;
    right: 15px;
    cursor: pointer;
    color: var(--light-text);
    font-size: 0.95rem;
    transition: color 0.2s ease;
}
.password-toggle-icon:hover {
    color: var(--heading-text);
}

/* Pulsanti (Login/Signup) */
.btn.btn-primary-filled {
    padding: 15px 25px; /* Bottone più grande */
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 10px; /* Bottone arrotondato */
margin-top: 25px; /* Più spazio sopra il bottone */    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.2); /* Ombra per il bottone principale */
    transition: all 0.2s ease;
}
.btn.btn-primary-filled:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.3);
}

/* Messaggi di Feedback */
.feedback-message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0; /* Inizialmente nascosto */
    transform: translateY(10px);
    transition: all 0.3s ease-out;
}
.feedback-message.show {
    opacity: 1;
    transform: translateY(0);
}
.feedback-message.error {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}
.feedback-message.success {
    background-color: color-mix(in srgb, var(--success-color) 15%, transparent);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

/* Switch View (link "Attiva account" / "Torna al login") */
.switch-view {
    margin-top: 30px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--light-text);
}
.switch-view a {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease;
}
.switch-view a:hover {
    text-decoration: underline;
}

/* Specifica per l'input del codice invito */
#signupCode {
    text-transform: uppercase; /* Forzare maiuscolo se vuoi, anche se il JS è già così */
    letter-spacing: 1.5px; /* Più spaziatura per il codice */
    font-family: 'Inter Tight', monospace; /* Font più tecnico */
    font-weight: 600;
}

/* ================================================== */
/* === FIX: PREVENZIONE SCROLL ORIZZONTALE PAGINA === */
/* ================================================== */

/* 1. Blocca lo scroll orizzontale a livello di pagina principale */
html, body {
    max-width: 100vw;
    overflow-x: hidden; /* Nasconde qualsiasi sbordatura laterale indesiderata */
}

/* 2. Assicura che l'area principale non superi mai la larghezza disponibile */
.main-content {
    max-width: 100%;
    overflow-x: hidden; /* Doppio controllo per sicurezza */
}

/* 3. Il canvas deve contenere i suoi figli, anche se provano ad allargarsi */
.canvas {
    max-width: 100%;
    width: 100%;
    /* overflow-x: hidden;  <-- Rimosso perché potrebbe tagliare ombre o tooltip, 
                                solitamente basta gestire bene i figli, ma se serve riattivale */
}

/* 4. FIX SPECIFICO PER IL CAROSELLO:
   Questo è spesso il colpevole. Forziamo il contenitore del carosello
   a non essere mai più largo del suo genitore (la card).
*/
.comms-carousel-container {
    max-width: 100%;
    width: 100%;
    overflow-x: auto; /* Mantiene lo scroll INTERNO al carosello */
}

/* 5. Assicura che le card non si allarghino oltre il dovuto */
.card {
    max-width: 100%;
}

/* 6. Fix per le griglie flessibili */
.grid-container {
    width: 100%;
    max-width: 100%;
}/* ======================================= */
/* === OPTLYX AI: SOLID NOTION-LIKE UI === */
/* ======================================= */

/* --- 1. Il Modale (Il Contenitore Solido) --- */
#projectAIChatModal .modal-panel {
    box-shadow: 0 20px 50px rgba(0,0,0,0.3) !important; /* Ombra molto più profonda e "pesante" */
    border: 1px solid var(--bs-border-color); /* Bordo sottile ma definito */
    border-radius: 16px; /* Angoli un po' più squadrati rispetto a prima */
    overflow: hidden; /* Mantiene tutto contenuto */
}

/* Header più compatto e definito */
.ai-modal-header {
    padding: 1rem 1.5rem;
    background-color: var(--card-bg);
    border-bottom: 2px solid var(--input-border); /* Bordo più spesso per separare */
}
.ai-modal-header span {
    font-weight: 700; /* Testo più "spesso" */
    letter-spacing: -0.5px; /* Feeling più compatto */
    font-size: 1.15rem;
}

/* --- 2. Area di Log (Lo Sfondo) --- */
.ai-chat-log {
    background-color: var(--card-bg) !important; /* Niente più gradienti, colore solido */
    padding: 0; /* Rimuoviamo il padding generale per far toccare i bordi ai blocchi */
}

/* --- 3. I Messaggi (Blocchi Solidi) --- */

/* Contenitore generico del messaggio */
.chat-message-row {
    max-width: 100%; /* Occupa tutto lo spazio disponibile */
    padding: 1.5rem 2rem; /* Spaziatura interna generosa ma contenuta */
    border-bottom: 1px solid var(--input-border); /* Separatore sottile tra i blocchi */
    gap: 1.25rem;
}

/* --- Stile Messaggio UTENTE (Compatto e chiaro) --- */
.chat-message-row.user {
    background-color: var(--input-bg); /* Sfondo leggermente diverso per distinguere */
    flex-direction: row; /* Mantiene l'ordine normale, non invertito */
    align-items: flex-start;
}

/* L'avatar dell'utente diventa più piccolo e discreto */
.chat-message-row.user .chat-avatar {
    display: none; /* Opzionale: in Notion spesso l'utente non ha avatar nella chat AI per risparmiare spazio */
}
/* Se vuoi mantenere l'avatar utente, togli il display:none sopra e usa questo: */
/*
.chat-message-row.user .chat-avatar {
    width: 32px; height: 32px; margin-top: 2px;
}
*/

.chat-message-row.user .ai-chat-bubble {
    background: transparent;
    padding: 0;
    color: var(--light-text); /* Testo leggermente meno prominente per le tue domande */
    font-weight: 500;
    font-size: 1.1rem; /* Domande un po' più grandi, come titoli */
    border: none;
    border-radius: 0;
}
/* Aggiunge un'icona o prefisso alla domanda utente per distinguerla */
.chat-message-row.user .ai-chat-bubble::before {
    content: 'Tu: ';
    font-weight: 700;
    color: var(--heading-text);
    margin-right: 0.5rem;
}

/* --- Stile Messaggio AI (Il blocco "spesso") --- */
.chat-message-row.ai {
    background-color: var(--card-bg);
    align-items: flex-start;
}

/* Icona AI più definita */
.chat-message-row.ai .chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px; /* Squadrata invece che tonda = più solido */
    background-color: transparent;
    border: 2px solid var(--input-border); /* Bordo attorno all'icona */
    padding: 4px;
    margin-top: 4px;
}

/* Il contenuto della risposta AI */
.chat-message-row.ai .ai-chat-bubble {
    background: transparent;
    padding: 0;
    border: none;
    border-radius: 0;
    color: var(--bs-body-color);
    font-size: 1rem;
    line-height: 1.7; /* Migliore leggibilità */
}

/* Miglioriamo la tipografia dentro le risposte AI per renderle "documenti" */
.ai-chat-bubble.ai strong {
    font-weight: 700;
    color: var(--heading-text);
}
.ai-chat-bubble.ai ul, .ai-chat-bubble.ai ol {
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    border-left: 3px solid var(--input-border); /* Linea laterale per le liste */
}
.ai-chat-bubble.ai li {
    margin-bottom: 0.5rem;
}
.ai-chat-bubble.ai h3, .ai-chat-bubble.ai h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: var(--heading-text);
}

/* --- 4. Indicatore "Sto ragionando" (Più tecnico) --- */
.chat-message-row.ai .reasoning-text {
    font-family: 'Inter Tight', monospace; /* Font monospaziato per un look più tecnico */
    font-size: 0.9rem;
    color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 8%, transparent);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    display: inline-block;
    animation: pulse-soft 2s infinite;
}
@keyframes pulse-soft {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* --- 5. Area di Input (Solida e Ancorata) --- */
.ai-chat-input-area {
    background-color: var(--card-bg);
    border-top: 2px solid var(--input-border); /* Bordo superiore più spesso */
    padding: 1.5rem;
    gap: 1rem;
    position: relative; /* Per eventuali suggerimenti che fluttuano sopra */
}

#aiChatInput {
    background-color: var(--input-bg);
    border: 2px solid var(--input-border); /* Bordo input più spesso di default */
    border-radius: 12px; /* Raggio leggermente più stretto */
    padding: 0 1.25rem;
    height: 56px; /* Input più alto = più "spesso" */
    font-size: 1.05rem;
    font-weight: 500;
    transition: all 0.2s ease-out;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); /* Leggera ombra interna per profondità */
}

#aiChatInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 20%, transparent); /* Focus ring più deciso */
}

#aiChatSendBtn {
    width: 56px; /* Match input height */
    height: 56px;
    border-radius: 12px;
    background-color: var(--heading-text); /* Usa il colore del testo (quasi nero/bianco) per massimo contrasto */
    color: var(--card-bg); /* Testo invertito */
    font-size: 1.3rem;
    border: none;
    transition: transform 0.2s ease;
}
#aiChatSendBtn:hover {
    transform: scale(1.05);
    background-color: var(--primary-color); /* Diventa colorato solo all'hover */
}

/* --- 6. Suggerimenti (Chips Solide) --- */
.ai-prompt-suggestions {
    padding: 1rem 2rem;
    background-color: var(--input-bg);
    border-top: 1px solid var(--input-border);
    gap: 0.75rem;
}

.prompt-suggestion-btn {
    background-color: var(--card-bg);
    border: 2px solid var(--input-border); /* Bordo più spesso */
    color: var(--heading-text);
    font-weight: 600;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); /* Leggera ombra solida */
    transition: all 0.2s ease-out;
}

.prompt-suggestion-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.1);
}

.prompt-suggestion-btn i {
    color: var(--light-text); /* Icone neutre di default */
}
.prompt-suggestion-btn:hover i {
    color: var(--primary-color); /* Icone colorate all'hover */
}
/* ================================================= */
/* === OPTLYX AI COPILOT (FULL PAGE SOLID UI)    === */
/* ================================================= */

/* 1. Layout Strutturale a Tutta Pagina */
#ai-assistant-section.active {
    display: flex !important;
    flex-direction: column;
    height: calc(100vh - 70px) !important; /* Occupa tutta l'altezza meno l'header */
    padding: 0 !important; /* Rimuove il padding del canvas per andare a bordo */
    background-color: var(--bs-body-bg); /* Usa lo sfondo base della pagina */
}

.ai-fullscreen-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 2. Area Centrale di Log (Scrollabile) */
.ai-central-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centra il contenuto orizzontalmente */
}

/* La "traccia" che contiene i messaggi, larghezza limitata come ChatGPT */
.chat-messages-track {
    width: 100%;
    max-width: 850px; /* Larghezza ottimale per la lettura */
    display: flex;
    flex-direction: column;
    gap: 0; /* Nessun gap, usiamo padding interni ai messaggi */
}

/* 3. Schermata di Benvenuto (Stile "Empty State" Solido) */
.ai-welcome-screen {
    max-width: 850px;
    width: 100%;
    margin: auto; /* Centra verticalmente se c'è spazio */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 4rem;
    animation: fadeIn 0.5s ease-out;
}

.ai-welcome-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 6px var(--shadow-color-primary-soft));
}

.ai-welcome-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--heading-text);
    letter-spacing: -0.5px;
}

.ai-welcome-header p {
    font-size: 1.1rem;
    color: var(--light-text);
    max-width: 600px;
    margin: 0 auto 3rem auto;
    line-height: 1.6;
}

/* 4. Griglia Suggerimenti "Solidi" (Card) */
.ai-solid-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 colonne */
    gap: 1rem;
    width: 100%;
}

.solid-suggestion-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    text-align: left;
    padding: 1.25rem;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 16px; /* Molto arrotondato */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.03); /* Ombra sottilissima di base */
}

.solid-suggestion-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px var(--shadow-color-primary-soft); /* Ombra colorata all'hover */
}

.solid-suggestion-card .card-icon {
    font-size: 1.4rem;
    color: var(--primary-color);
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    padding: 10px;
    border-radius: 10px;
    flex-shrink: 0;
}

.solid-suggestion-card .card-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.solid-suggestion-card strong {
    font-weight: 600;
    color: var(--heading-text);
    font-size: 1rem;
}

.solid-suggestion-card span {
    font-size: 0.9rem;
    color: var(--light-text);
    font-weight: 500;
}

/* 5. Footer di Input "Pesante" */
.ai-input-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1rem 2rem 1rem;
    background: linear-gradient(to top, var(--bs-body-bg) 80%, transparent); /* Sfumatura verso l'alto */
    flex-shrink: 0;
    position: sticky; /* Assicura che rimanga in basso */
    bottom: 0;
}

.ai-input-container-solid {
    width: 100%;
    max-width: 850px;
    background-color: var(--input-bg);
    border: 2px solid var(--bs-border-color);
    border-radius: 16px;
    padding: 0; 
    transition: all 0.2s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    
    /* --- FIX CRUCIALE --- */
    overflow: visible !important; /* Era 'hidden', ora deve essere 'visible' per far uscire il menu */
    position: relative;           /* Assicura che z-index funzioni qui se serve */
    z-index: 10;                  /* Porta questo contenitore sopra altri elementi se necessario */
}
#fullscreenChatForm {
    position: relative !important; /* FONDAMENTALE: fa da ancora per i pulsanti */
    display: flex;
    width: 100%;
    align-items: flex-end; /* Allinea la textarea in basso se cresce */
    padding: 12px; /* Spazio attorno alla textarea */
}
/* Focus state "solido" */
.ai-input-container-solid:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--shadow-color-primary-soft);
}

/* La textarea (input) */
.solid-chat-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    max-height: 200px;
    min-height: 24px; /* Altezza minima per una riga di testo */
    font-size: 1rem;
    line-height: 1.5;
    color: var(--heading-text);
    font-family: 'Inter Tight', sans-serif;
    
    /* CRUCIALE: Spazio per non far finire il testo sotto i pulsanti */
    padding-left: 40px !important;  /* Spazio per il pulsante [+] */
    padding-right: 40px !important; /* Spazio per il pulsante [Invia] */
    margin: 0; /* Reset margini */
}

.btn-solid-send {
    position: absolute;
    bottom: 10px; /* Distanza dal fondo del form */
    right: 10px;  /* Distanza dal lato destro */
    width: 32px;
    height: 32px;
    border-radius: 8px; /* Leggermente squadrato come Gemini/OpenAI */
    border: none;
    background-color: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    z-index: 10;
}
.btn-solid-send:disabled {
    background-color: var(--input-border);
    color: var(--light-text);
    cursor: not-allowed;
    opacity: 0.7;
}
.btn-solid-send:not(:disabled):hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}



.ai-footer-disclaimer {
    font-size: 0.8rem;
    color: var(--light-text);
    margin-top: 1rem;
    text-align: center;
    font-weight: 500;
    opacity: 0.8;
}

/* 6. Stili Messaggi (Blocchi Solidi) */
.message-block {
    display: flex;
    gap: 1.5rem;
    padding: 2rem 0; /* Spazio generoso sopra e sotto */
    border-bottom: 1px solid var(--input-border); /* Separatore sottile */
    width: 100%;
    animation: fadeIn 0.3s ease-out;
}

.message-block.user {
    /* Opzionale: background leggero per i messaggi utente per distinguerli */
    /* background-color: color-mix(in srgb, var(--primary-color) 3%, transparent); */
    /* padding-left: 1rem; padding-right: 1rem; border-radius: 12px; */
}

.message-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 8px; /* Avatar squadrato = più "tech" */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.message-block.ai .message-avatar {
    background-color: var(--primary-color); /* O usa l'immagine del logo */
    color: #fff;
}
.message-block.ai .message-avatar img {
    width: 24px; height: 24px;
}

.message-block.user .message-avatar {
    background-color: var(--input-border);
    color: var(--light-text);
}

.message-content {
    flex-grow: 1;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--bs-body-color);
}

/* Formattazione Markdown "Solida" */
.message-content strong { font-weight: 700; color: var(--heading-text); }
.message-content h3 { font-size: 1.3rem; font-weight: 700; margin: 1.5rem 0 1rem 0; color: var(--heading-text); }
.message-content ul, .message-content ol { margin: 1rem 0; padding-left: 1.5rem; }
.message-content li { margin-bottom: 0.5rem; }
.message-content code {
    background-color: var(--input-border);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-solid-suggestions-grid {
        grid-template-columns: 1fr; /* 1 colonna su mobile */
    }
    .message-block {
        gap: 1rem;
        padding: 1.5rem 0;
    }
    .message-avatar {
        width: 30px; height: 30px; font-size: 0.9rem;
    }
}
/* ================================================= */
/* === OPTLYX AI: GEMINI STYLE (NO BG)           === */
/* ================================================= */

/* --- 1. Contenitore Messaggio (Trasparente e Spaziato) --- */
.message-block {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem 0.5rem; /* Spaziatura verticale generosa, laterale minima */
    width: 100%;
    animation: fadeIn 0.3s ease-out;
    border-bottom: none; /* Nessun divisore visibile per un flusso pulito */
    background-color: transparent !important; /* FORZA la trasparenza */
}

/* --- 2. Allineamento --- */

/* AI: A Sinistra */
.message-block.ai {
    justify-content: flex-start;
}

/* Utente: A Destra */
.message-block.user {
    justify-content: flex-end;
}

/* --- 3. Avatar AI (Totalmente Trasparente) --- */
.message-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-top: 2px; /* Allineamento ottico con la prima riga di testo */
}

.message-block.ai .message-avatar {
    background-color: transparent !important;
    border: none !important;
}

.message-block.ai .message-avatar img {
    width: 24px;
    height: 24px;
    /* Opzionale: un leggero drop-shadow per far staccare il logo se lo sfondo è simile */
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.1)); 
}

/* Nascondiamo avatar utente */
.message-block.user .message-avatar {
    display: none;
}

/* --- 4. Contenuto Messaggio (Testo Puro, Niente Bolle) --- */
.message-content {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--bs-body-color);
    max-width: 100%;
    
    /* Reset completo stili "bolla" */
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* Stile specifico testo Utente */
.message-block.user .message-content {
    max-width: 80%;
    text-align: right; /* Testo allineato a destra come Gemini */
    font-weight: 500; /* Leggermente più marcato per distinguerlo */
    color: var(--heading-text); /* Colore leggermente più scuro/chiaro del corpo base */
    font-size: 1.1rem; /* Leggermente più grande, come un titolo H3/H4 */
}

/* --- 5. Effetto WAVE sul testo "Sto ragionando..." --- */
.reasoning-text {
    font-weight: 600;
    font-size: 1.1rem;
    display: inline-block;
    
    /* Gradiente per l'effetto onda */
    background: linear-gradient(
        90deg, 
        var(--light-text) 0%, 
        var(--heading-text) 50%, 
        var(--light-text) 100%
    );
    background-size: 200% auto;
    
    /* Clip del background al testo */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    
    /* Animazione */
    animation: text-wave 2s linear infinite;
}

@keyframes text-wave {
    to {
        background-position: -200% center;
    }
}
/* ======================================= */
/* === FIX DROPDOWN NOTIFICHE          === */
/* ======================================= */

/* 1. Forza il contenitore a fare da ancora stabile */
.notification-container {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important; /* Impedisce al contenitore di schiacciarsi */
}

/* 2. Stile robusto per il menu a tendina */
.notification-dropdown {
    position: absolute !important;
    top: calc(100% + 15px) !important; /* Un po' più in basso per non toccare l'header */
    right: -10px !important; /* Leggero offset a destra per allinearsi meglio visivamente */
    
    /* Dimensioni forzate per evitare lo "schiacciamento" */
    width: 380px !important;
    max-width: 90vw !important; /* Fallback per mobile */
    min-width: 300px !important; /* Larghezza minima garantita */
    
    /* Assicura che sia sopra tutto */
    z-index: 9999 !important;
    
    /* Stile visuale solido */
    background-color: var(--card-bg) !important;
    border: 1px solid var(--bs-border-color) !important;
    border-radius: 16px !important;
    box-shadow: 0 15px 50px rgba(0,0,0,0.3) !important; /* Ombra profonda per staccarlo dallo sfondo */
    
    /* Reset di layout */
    display: flex;
    flex-direction: column;
    overflow: hidden !important; /* Mantiene il contenuto dentro i bordi arrotondati */
}

/* 3. Header del dropdown */
.notification-header {
    padding: 1.25rem 1.5rem !important;
    background-color: var(--card-bg) !important;
    border-bottom: 1px solid var(--input-border) !important;
}

.notification-header h3 {
    margin: 0 !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: var(--heading-text) !important;
}

/* 4. Lista scrollabile */
.notification-list {
    max-height: 400px !important;
    overflow-y: auto !important;
    padding: 0 !important;
}
/* ======================================= */
/* === FIX ICONA NOTIFICHE DARK MODE   === */
/* ======================================= */

/* In Dark Mode, forza l'icona della campanella ad essere del colore primario (Blu Optlyx) */
body:not(.light-mode) .notification-btn .octicon {
    /* Questo filtro trasforma l'icona nera originale nel blu #4361ee */
    filter: invert(37%) sepia(88%) saturate(3001%) hue-rotate(224deg) brightness(97%) contrast(95%) !important;
    opacity: 1; /* Assicura che sia ben visibile */
    transition: all 0.2s ease;
}

/* Effetto Hover: la rendiamo leggermente più luminosa */
body:not(.light-mode) .notification-btn:hover .octicon {
    filter: invert(37%) sepia(88%) saturate(3001%) hue-rotate(224deg) brightness(130%) contrast(95%) !important;
    transform: scale(1.1); /* Piccolo effetto zoom per enfatizzare l'interazione */
}

/* Assicuriamoci che il pulsante stesso non abbia bordi fastidiosi che cozzano col colore */
.notification-btn {
    border-color: transparent !important; /* Rimuove il bordo grigio standard */
    background-color: var(--input-bg); /* Gli diamo un leggero sfondo per farla "galleggiare" */
}
/* ======================================= */
/* === NUOVI EFFETTI SPECIALI (WOW!)   === */
/* ======================================= */

/* --- 1. EFFETTO AURORA (Ambient Background) --- */

/* Animazione delle sfumature */
@keyframes aurora-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* L'elemento che contiene l'aurora */
body.aurora-effect .canvas::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1; /* Sta dietro a tutto nel canvas */
    opacity: 0.4; /* Molto sottile */
    filter: blur(80px); /* Sfocatura estrema per l'effetto "ambiente" */
    background-size: 400% 400%; /* Grande background per muoversi */
    animation: aurora-shift 30s ease infinite; /* Animazione molto lenta */
}

/* Colori Aurora - DARK MODE (Più profondi e saturi) */
body.aurora-effect:not(.light-mode) .canvas::before {
    background-image: linear-gradient(-45deg, 
        rgba(67, 97, 238, 0.3),  /* Primary Blu */
        rgba(114, 9, 183, 0.2),  /* Viola profondo */
        rgba(58, 12, 163, 0.2),  /* Blu scuro */
        rgba(76, 201, 240, 0.3)   /* Ciano chiaro */
    );
}

/* Colori Aurora - LIGHT MODE (Più leggeri e pastello) */
body.aurora-effect.light-mode .canvas::before {
    opacity: 0.6; /* Un po' più visibile su sfondo chiaro */
    background-image: linear-gradient(-45deg, 
        rgba(67, 97, 238, 0.15), /* Blu molto chiaro */
        rgba(236, 253, 245, 0.8),/* Quasi bianco/menta */
        rgba(238, 242, 255, 0.8),/* Indaco chiarissimo */
        rgba(167, 139, 250, 0.15)/* Viola soft */
    );
}


/* --- 2. EFFETTO VITALITY (Micro-interazioni Elastiche) --- */

/* Click "elastico" sui bottoni */
body.vitality-effect .btn:active, 
body.vitality-effect .clickable:active,
body.vitality-effect .nav-link:active,
body.vitality-effect .kpi-card:active {
    transform: scale(0.96) !important; /* Compressione visibile al click */
    transition: transform 0.1s cubic-bezier(0.34, 1.56, 0.64, 1); /* Rimbalzo elastico */
}

/* Pulsazione sugli elementi importanti (es. badge di notifica, status attivi) */
@keyframes subtle-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary-color) 40%, transparent); }
    70% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary-color) 0%, transparent); }
    100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary-color) 0%, transparent); }
}

body.vitality-effect .notification-dot,
body.vitality-effect .status-chip.running,
body.vitality-effect .timeline-item.status-in-progress .timeline-item-icon {
    animation: subtle-pulse 3s infinite;
}

/* Focus sugli input più "vivo" */
body.vitality-effect input:focus,
body.vitality-effect textarea:focus,
body.vitality-effect select:focus {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Transizione elastica anche sul focus */
}
/* Stato attivo per i selettori di colore */
.color-swatch.active {
    outline-color: var(--heading-text) !important; /* L'anello esterno diventa del colore del testo (bianco in dark mode) */
    transform: scale(1.15);
}
/* ================================================= */
/* === EFFETTI SPECIALI: WELCOME SCREEN (APPLE/OPENAI) === */
/* ================================================= */

/* --- 1. Animazione Titolo (Text Reveal) --- */
.ai-welcome-header h2.animated-text-reveal {
    overflow: hidden; /* Nasconde il testo che "entra" */
    white-space: nowrap; /* Mantiene il titolo su una riga */
    display: block; /* O block */
    animation: none; /* Rimuovi animazioni precedenti */
}

.ai-welcome-header h2.animated-text-reveal span {
    display: inline-block; /* Ogni lettera è un elemento animabile */
    opacity: 0;
    transform: translateY(20px);
    animation: text-reveal-up 0.8s forwards;
    animation-delay: var(--delay); /* Ritardo gestito via JS per ogni lettera */
}

@keyframes text-reveal-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 2. Animazione Sottotitolo (Fade In) --- */
.ai-welcome-header p.animated-subtitle-fade {
    opacity: 0;
    transform: translateY(20px);
    animation: fade-in-up 0.8s forwards;
    animation-delay: 0.8s; /* Inizia dopo il titolo */
}

@keyframes fade-in-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 3. Animazione Logo (Bagliore & Pulsazione) --- */
.ai-logo-animated-container {
    position: relative;
    width: 80px; /* Contenitore per logo e cerchi */
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    perspective: 1000px; /* Per future animazioni 3D */
}

#aiWelcomeLogo {
    width: 64px;
    height: 64px;
    z-index: 2; /* Sopra i cerchi */
    filter: drop-shadow(0 0 15px var(--primary-color-soft)); /* Bagliore iniziale */
    animation: logo-glow 3s ease-in-out infinite alternate; /* Animazione bagliore */
}

@keyframes logo-glow {
    0% { filter: drop-shadow(0 0 10px var(--primary-color-soft)); }
    100% { filter: drop-shadow(0 0 25px var(--primary-color)); }
}

/* Cerchi di pulsazione */
.ai-logo-pulse-circle {
    position: absolute;
    border-radius: 50%;
    background-color: var(--primary-color);
    opacity: 0;
    animation: pulse-out 3s ease-out infinite; /* Animazione di espansione */
    z-index: 1; /* Sotto il logo */
}

.circle-1 {
    width: 60px; height: 60px;
    animation-delay: 0s;
}
.circle-2 {
    width: 70px; height: 70px;
    animation-delay: 1s;
}
.circle-3 {
    width: 80px; height: 80px;
    animation-delay: 2s;
}

@keyframes pulse-out {
    0% { transform: scale(0.5); opacity: 0.7; }
    100% { transform: scale(1.5); opacity: 0; }
}


/* --- 4. Animazione Suggerimenti (Grid Staggered Fade) --- */
.ai-solid-suggestions-grid {
    opacity: 0;
    transform: translateY(30px);
    animation: fade-in-up 0.8s forwards;
    animation-delay: 1.2s; /* Inizia dopo il sottotitolo */
}

.solid-suggestion-card {
    opacity: 0;
    transform: translateY(20px);
    animation: card-stagger-in 0.6s forwards;
    animation-delay: var(--card-delay); /* Ritardo gestito via JS per ogni card */
}

@keyframes card-stagger-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 5. Stile Icone Octicons --- */
.card-icon-octi {
    font-size: 1.4rem;
    color: var(--primary-color);
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    padding: 10px;
    border-radius: 10px;
    flex-shrink: 0;
    display: inline-flex; /* Assicura che il padding funzioni */
    align-items: center;
    justify-content: center;
}
/* ================================================= */
/* === AI WELCOME SCREEN: CLEAN & TIGHT VERSION  === */
/* ================================================= */

/* --- 1. Contenitore Logo Pulito --- */
.ai-logo-container-clean {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80px; /* Mantiene lo spazio ma senza elementi extra */
}

.ai-logo-container-clean .ai-welcome-logo {
    width: 72px; /* Leggermente più grande per compensare l'assenza di sfondo */
    height: 72px;
    filter: drop-shadow(0 4px 12px rgba(67, 97, 238, 0.3)); /* Ombra morbida blu per farlo "galleggiare" */
    animation: float-logo 3s ease-in-out infinite alternate; /* Leggero movimento fluttuante */
}

@keyframes float-logo {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

/* --- 2. Titolo Compatto (Attaccato) --- */
.ai-tight-title {
    font-size: 2.2rem; /* Grande e leggibile */
    font-weight: 700;  /* Molto spesso (bold) */
    letter-spacing: -0.03em; /* Avvicina leggermente le lettere per un look più compatto */
    color: var(--heading-text);
    margin-bottom: 0.75rem;
    line-height: 1.2;
    
    /* Opzionale: gradiente sottile sul testo per renderlo premium */
    background: linear-gradient(135deg, var(--heading-text) 30%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- 3. Sottotitolo (Già presente, ma assicuriamoci che sia pulito) --- */
.animated-subtitle-fade {
    font-size: 1.1rem;
    color: var(--light-text);
    max-width: 550px;
    margin: 0 auto 3rem auto;
    line-height: 1.5;
}
/* --- FIX: Rimuove il doppio scrollbar nella sezione AI --- */
#ai-assistant-section.active {
    overflow: hidden !important; /* Blocca lo scroll sul contenitore esterno */
    height: calc(100vh - 70px) !important; /* Forza l'altezza esatta (viewport - header) */
}

/* Assicura che il body non scorra quando siamo qui */
body:has(#ai-assistant-section.active) {
    overflow: hidden !important;
}
/* --- Animazione Titolo "Premium Flow" --- */
.ai-tight-title {
    font-size: 2.5rem;
    font-weight: 800; /* Ancora più spesso */
    letter-spacing: -0.04em; /* Molto compatto */
    margin-bottom: 0.5rem;
    line-height: 1.1;
    
    /* Definizione del gradiente animato */
    background: linear-gradient(
        110deg, 
        var(--heading-text) 30%, 
        var(--primary-color) 50%, 
        var(--heading-text) 70%
    );
    background-size: 200% auto;
    
    /* Applica il gradiente al testo */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent; /* Fallback */
    
    /* L'animazione */
    animation: title-flow 8s linear infinite;
}

/* Keyframe per far scorrere il riflesso */
@keyframes title-flow {
    to {
        background-position: -200% center;
    }
}ù/* ======================================= */
/* === AI SMART BLOCKS & FEATURES      === */
/* ======================================= */

/* --- Smart Block generico --- */
.ai-smart-block {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    background-color: var(--card-bg);
    animation: fadeIn 0.3s ease-out;
}

/* --- Task Smart Block --- */
.task-smart-block {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid var(--warning-color); /* Default a warning (in corso) */
}
.task-smart-block.completed { border-left-color: var(--success-color); }
.task-smart-block.overdue { border-left-color: var(--danger-color); }

.task-smart-block .task-details { flex-grow: 1; }
.task-smart-block .task-title { font-weight: 600; color: var(--heading-text); display: block; }
.task-smart-block .task-meta { font-size: 0.85rem; color: var(--light-text); }

/* --- Person/Contact Smart Block --- */
.person-smart-block {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.person-smart-block .person-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; font-weight: 600;
}
.person-smart-block .person-info { flex-grow: 1; }
.person-smart-block .person-name { font-weight: 700; color: var(--heading-text); display: block; }
.person-smart-block .person-role { font-size: 0.9rem; color: var(--light-text); }

/* --- Citazioni Fonti --- */
.citation-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    color: var(--primary-color);
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.citation-link:hover {
    background-color: color-mix(in srgb, var(--primary-color) 20%, transparent);
    transform: translateY(-1px);
}
.citation-link i { font-size: 0.8em; }

/* --- Feedback Loop (Pollice Su/Giù) --- */
.ai-feedback-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}
.message-block:hover .ai-feedback-actions { opacity: 1; }
.feedback-btn {
    background: none; border: none;
    color: var(--light-text);
    cursor: pointer; font-size: 1rem;
    padding: 4px;
    transition: all 0.2s ease;
}
.feedback-btn:hover { color: var(--heading-text); transform: scale(1.2); }
.feedback-btn.active { color: var(--primary-color); }

/* --- Action Link (per la navigazione) --- */
.ai-action-link {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

/* ======================================= */
/* === AI CHAT ATTACHMENT STYLES       === */
/* ======================================= */

/* Aggiusta il padding dell'input per far spazio al pulsante + */
.solid-chat-input {
    padding-left: 3rem !important; /* Spazio per il pulsante + a sinistra */
}

/* Stile del pulsante + */
.btn-solid-attach {
    position: absolute;
    bottom: 10px; /* Distanza dal fondo del form */
    left: 10px;   /* Distanza dal lato sinistro */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background-color: var(--menu-hover-bg);
    color: var(--heading-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}
.btn-solid-attach:hover {
    background-color: var(--bs-border-color);
    color: var(--primary-color);
}


/* Stile del Mini Modal (Menu) */
.ai-attach-menu {
    position: absolute;
    bottom: 55px; /* Appare sopra il pulsante + */
    left: 0;
    width: 220px;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 0.5rem;
    z-index: 100;
    animation: slideUpFade 0.2s ease-out;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.attach-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--bs-body-color);
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: left;
}
.attach-menu-item:hover:not(:disabled) {
    background-color: var(--menu-hover-bg);
}
.attach-menu-item i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* Area di Anteprima Immagine */
/* Area di anteprima (opzionale, per quando carichi foto) */
.attachment-preview-area {
    padding: 10px 15px 0 15px;
    background-color: var(--input-bg);
}
.attachment-preview-area.hidden {
    display: none;
    border-bottom: none;
}

.preview-thumbnail-wrapper {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: visible; /* Per mostrare il pulsante X fuori */
}
.preview-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--input-border);
}
.remove-attachment-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 50%;
    color: var(--light-text);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem;
    transition: all 0.2s;
}
.remove-attachment-btn:hover {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

/* Stile per l'immagine all'interno del messaggio utente */
.message-content .user-uploaded-image {
    max-width: 300px;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    border: 1px solid var(--input-border);
    display: block;
}
/* ======================================= */
/* === NUOVI EFFETTI SPECIALI (FX PACK 2) === */
/* ======================================= */

/* --- 1. NEON FLUX EFFECT --- */
body.neon-effect .btn-primary,
body.neon-effect .btn-primary-filled,
body.neon-effect .kpi-card-v2:hover,
body.neon-effect .nav-link.active,
body.neon-effect .status-chip.running,
body.neon-effect .notification-dot {
    box-shadow: 0 0 15px color-mix(in srgb, var(--primary-color) 60%, transparent),
                0 0 30px color-mix(in srgb, var(--primary-color) 30%, transparent) !important;
    border-color: var(--primary-color) !important;
}

body.neon-effect .form-control-custom:focus,
body.neon-effect input:focus {
    box-shadow: 0 0 10px color-mix(in srgb, var(--primary-color) 50%, transparent) !important;
    border-color: var(--primary-color) !important;
}

/* Effetto pulsazione neon per elementi critici */
@keyframes neon-pulse {
    0% { box-shadow: 0 0 5px var(--primary-color); }
    50% { box-shadow: 0 0 20px var(--primary-color), 0 0 30px var(--primary-color); }
    100% { box-shadow: 0 0 5px var(--primary-color); }
}
body.neon-effect .ai-chat-send-btn:not(:disabled),
body.neon-effect .flowcoach-ai-tutor {
    animation: neon-pulse 3s infinite alternate;
}

/* --- 2. FILM GRAIN EFFECT --- */
/* Crea un overlay fisso con una texture di rumore SVG */
body.grain-effect::after {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none; /* Permette di cliccare attraverso */
    z-index: 9999;
    opacity: 0.06; /* Regola l'intensità della grana qui (0.03 - 0.15) */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}
/* Leggermente meno opaco in light mode per non sporcare troppo */
body.light-mode.grain-effect::after {
    opacity: 0.04;
    mix-blend-mode: multiply;
}


/* --- 3. FOCUS MODE EFFECT --- */
/* Quando Focus Mode è attivo, tutto ciò che NON è in hover si sfoca leggermente */
body.focus-effect .canvas:hover .card:not(:hover),
body.focus-effect .canvas:hover .kpi-card-v2:not(:hover),
body.focus-effect .grid-container:hover .grid-item:not(:hover) {
    filter: blur(2px) grayscale(30%);
    opacity: 0.7;
    transition: all 0.4s ease;
}

/* L'elemento in hover rimane nitido e si ingrandisce leggermente */
body.focus-effect .card:hover,
body.focus-effect .kpi-card-v2:hover {
    transform: scale(1.02) translateY(-5px);
    z-index: 10;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3) !important;
}
/* ======================================= */
/* === AI CHAT: ANTEPRIMA FILE & BLOCCHI === */
/* ======================================= */

/* Stile anteprima (sopra l'input) per file DOC */
.preview-thumbnail-doc {
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 8px;
    color: var(--light-text);
}
.preview-thumbnail-doc i {
    font-size: 1.5rem;
}
.preview-thumbnail-doc span {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Stile per l'info file accanto all'anteprima */
.attachment-preview-area {
    align-items: center;
}
.preview-file-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    flex-grow: 1;
}
.preview-file-info strong {
    color: var(--heading-text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.preview-file-info span {
    color: var(--light-text);
    font-size: 0.8rem;
}

/* Stile per il blocco file DENTRO la chat */
.user-uploaded-file {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    max-width: 350px;
}
.user-uploaded-file i {
    font-size: 1.2rem;
    color: var(--primary-color);
}
.user-uploaded-file span {
    font-weight: 500;
    color: var(--heading-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* ======================================= */
/* === AI SMART BLOCKS & FEATURES (V2) === */
/* ======================================= */

/* --- Smart Block generico --- */
.ai-smart-block {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    background-color: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-left-width: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.ai-smart-block .smart-block-content {
    flex-grow: 1;
    overflow: hidden; /* Impedisce al testo di "spingere" il bottone */
}

/* --- Task Smart Block --- */
.task-smart-block .task-title { 
    font-weight: 600; 
    color: var(--heading-text); 
    display: block; 
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.task-smart-block .task-meta { 
    font-size: 0.85rem; 
    color: var(--light-text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap; /* Va a capo su schermi piccoli */
}

/* --- Person/Contact Smart Block --- */
.person-smart-block {
    border-left-color: var(--primary-color);
}
.person-smart-block .person-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; font-weight: 600;
    flex-shrink: 0;
}
.person-smart-block .person-info { 
    flex-grow: 1; 
    overflow: hidden; 
}
.person-smart-block .person-name { 
    font-weight: 700; 
    color: var(--heading-text); 
    display: block; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.person-smart-block .person-role { 
    font-size: 0.9rem; 
    color: var(--light-text); 
}

/* --- AI Alert Box --- */
.ai-alert {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    border: 1px solid;
}
.ai-alert i {
    font-size: 1.2rem;
}

.ai-alert-info {
    background-color: color-mix(in srgb, var(--info-color) 15%, transparent);
    color: var(--info-color);
    border-color: color-mix(in srgb, var(--info-color) 30%, transparent);
}
.ai-alert-warning {
    background-color: color-mix(in srgb, var(--warning-color) 20%, transparent);
    color: var(--warning-color);
    border-color: color-mix(in srgb, var(--warning-color) 35%, transparent);
}
.ai-alert-danger {
    background-color: color-mix(in srgb, var(--danger-color) 15%, transparent);
    color: var(--danger-color);
    border-color: color-mix(in srgb, var(--danger-color) 30%, transparent);
}

/* --- Citazioni Fonti --- */
.citation-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent);
    color: var(--primary-color);
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.citation-link:hover {
    background-color: color-mix(in srgb, var(--primary-color) 20%, transparent);
    transform: translateY(-1px);
}
.citation-link i { font-size: 0.8em; }

/* --- Feedback Loop (Pollice Su/Giù) --- */
.ai-feedback-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}
.message-block:hover .ai-feedback-actions { opacity: 1; }
.feedback-btn {
    background: none; border: none;
    color: var(--light-text);
    cursor: pointer; font-size: 1rem;
    padding: 4px;
    transition: all 0.2s ease;
}
.feedback-btn:hover { color: var(--heading-text); transform: scale(1.2); }
.feedback-btn.active { color: var(--primary-color); }

/* --- Action Link (per la navigazione) --- */
.ai-action-link {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}
/* ======================================= */
/* === STATO DI CARICAMENTO CANVAS (SPA) === */
/* ======================================= */

/*
 * Questo loader copre l'intero canvas.
 * È invisibile (opacity: 0) di default.
*/
.canvas-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Usa lo sfondo del body per coprire il contenuto vecchio */
    background-color: var(--bs-body-bg); 
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

/*
 * Quando il canvas ha la classe .is-loading (aggiunta da JS),
 * il loader diventa visibile (opacity: 1) e blocca i click.
*/
.canvas.is-loading .canvas-loader {
    opacity: 1;
    pointer-events: auto;
}

/* * Usiamo lo spinner del Sentinel che già esiste,
 * ma lo rendiamo un po' più grande per il caricamento pagina.
*/
.canvas-loader .sentinel-loader {
    width: 60px;
    height: 60px;
    border-width: 5px;
}
/* ======================================= */
/* === STILI PER IL DROPDOWN DI RICERCA  === */
/* ======================================= */

/*
  Questo contenitore serve a posizionare il menu
  rispetto alla barra di ricerca.
*/
.search-bar-container {
    position: relative;
    flex-grow: 1;
    max-width: 650px;
}

/*
  Posiziona il menu sotto la barra di ricerca
*/
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px); /* 8px sotto la barra di ricerca */
    left: 0;
    right: 0;
    z-index: 1100; /* Sopra tutto il resto */
    background-color: var(--card-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius-lg);
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    max-height: 450px;
    overflow-y: auto;
    animation: fadeIn 0.2s ease-out;
}

.search-results-dropdown.hidden {
    display: none;
}

.search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Intestazione di sezione (es. "Tasks", "Documenti") */
.search-result-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--light-text);
    text-transform: uppercase;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--input-border);
}

/* Singolo elemento nei risultati */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: var(--menu-hover-bg);
}

.search-result-item .item-icon {
    font-size: 1.1rem;
    color: var(--light-text);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.search-result-item .item-details {
    overflow: hidden; /* Nasconde il testo che fuoriesce */
}

.search-result-item .item-name {
    font-weight: 500;
    color: var(--heading-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Aggiunge "..." */
}

.search-result-item .item-context {
    font-size: 0.85rem;
    color: var(--light-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Messaggio "Nessun risultato" o "Inizia a digitare" */
.no-search-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--light-text);
    font-style: italic;
    list-style-type: none;
}
/* ======================================= */
/* === STILI UPLOAD AVATAR (IMPOSTAZIONI) === */
/* ======================================= */

.avatar-uploader-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: var(--input-bg);
    border: 2px dashed var(--bs-border-color);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-uploader-preview .user-avatar-initial {
    font-size: 2.5rem;
    color: var(--light-text);
}

.avatar-uploader-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Classi per mostrare/nascondere l'iniziale o l'immagine */
.avatar-uploader-preview img.hidden,
.avatar-uploader-preview .user-avatar-initial.hidden {
    display: none;
}

.avatar-uploader-actions {
    flex-grow: 1;
}
/* ======================================= */
/* === STILI PAGE LOADER (TIPO LINKEDIN) === */
/* ======================================= */

#pageLoader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bs-body-bg); /* Usa lo sfondo del tema */
    z-index: 9999; /* Sopra tutto */
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    opacity: 1;
    transition: opacity 0.3s ease-out; /* Transizione per la scomparsa */
}

.loader-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 12px var(--shadow-color-primary-soft));
}

.loader-bar-container {
    width: 200px;
    height: 4px;
    background-color: var(--input-border);
    border-radius: 2px;
    overflow: hidden; /* Nasconde la barra quando è fuori */
}

.loader-bar-fill {
    width: 40%; /* La barra è solo il 40% del contenitore */
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 2px;
    
    /* Animazione "va e vieni" infinita */
    animation: slideIndeterminate 1.5s ease-in-out infinite;
}

/* Animazione che muove la barra da -40% a 240% */
@keyframes slideIndeterminate {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(250%); /* 100% (larghezza) + 100% (contenitore) + 40% (barra) */
    }
    100% {
        transform: translateX(-100%);
    }
}
/* === AGGIUNTE PER LUCIDE ICONS (V3) === */

/* --- Stile Base per le Icone Lucide --- */
.lucide {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    /* Le icone Lucide usano 'currentColor' per il colore, 
      quindi non abbiamo più bisogno del complicato filtro 'invert()' 
      per il dark/light mode. Questo semplifica molto il CSS!
    */
}

.sidebar-nav .nav-link .lucide {
    margin-right: 1rem;
    width: 20px;
    height: 20px;
    color: var(--light-text); /* Colore grigio di default */
    transition: color 0.2s, opacity 0.2s;
    flex-shrink: 0; /* Impedisce all'icona di deformarsi */
}

.sidebar-nav .nav-link:hover .lucide {
    color: var(--heading-text); /* Colore più luminoso all'hover */
}

/* L'icona attiva diventa del colore primario */
.sidebar-nav .nav-link.active .lucide {
    color: var(--primary-color);
}

/* ======================================= */
/* === STILI ICONE LUCIDE (SETTINGS NAV) === */
/* ======================================= */

.settings-nav-link .lucide {
    width: 18px;
    height: 18px;
    color: var(--light-text); /* Colore grigio di default */
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.settings-nav-link:hover .lucide {
    color: var(--heading-text); /* Colore più luminoso all'hover */
}

.settings-nav-link.active .lucide {
    color: var(--primary-color); /* Colore primario quando attivo */
}
/* ======================================= */
/* === STILI ICONE LUCIDE (PRIVACY CENTER) === */
/* ======================================= */

/* --- 1. Stile per i Badge Orizzontali (Header) --- */
.compliance-badge .lucide {
    width: 18px; /* Leggermente più grande */
    height: 18px;
    flex-shrink: 0; /* Impedisce all'icona di deformarsi */
}

/* Applica i colori di stato direttamente all'icona */
.compliance-badge .lucide.text-green {
    color: var(--success-color);
}
.compliance-badge .lucide.text-red {
    color: var(--danger-color);
}
.compliance-badge .lucide.text-yellow {
    color: var(--warning-color);
}
.compliance-badge .lucide.text-cookie {
    color: var(--info-color);
}

/* Colore per lo stato 'na' (non applicabile) */
.compliance-badge.status-na .lucide {
    color: var(--light-text);
}

/* --- 2. Stile per Icone nei Titoli (h2) e Pulsanti --- */

/* Stili per le icone Lucide negli header delle card (es. "Policy di Retention") */
#privacy-section .card-header h2 .lucide {
    width: 18px; 
    height: 18px;
    margin-right: 0.75rem; /* Spazio dal testo */
    color: var(--light-text); /* Colore grigio discreto */
    vertical-align: -3px; /* Allineamento verticale migliore */
}

/* Stili per le icone Lucide nei bottoni (es. "Apri Richiesta") */
#privacy-section .btn .lucide {
    width: 16px;
    height: 16px;
    margin-right: 0.5rem;
}
/* ======================================= */
/* === STILI ICONE LUCIDE (AI COPILOT)   === */
/* ======================================= */

/* --- Welcome Screen --- */
/* (La classe .card-icon-octi funziona già perfettamente) */

/* --- Input Form --- */
.btn-solid-attach .lucide {
    width: 20px;
    height: 20px;
}

.ai-attach-menu .lucide {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-solid-send .lucide {
    width: 18px;
    height: 18px;
}

/* --- Anteprima Allegato --- */
.preview-thumbnail-doc .lucide {
    width: 28px;
    height: 28px;
}

/* --- Messaggi in Chat --- */
.user-uploaded-file .lucide {
    width: 20px;
    height: 20px;
}

.ai-feedback-actions .lucide {
    width: 16px;
    height: 16px;
}

/* --- Smart Blocks --- */
.ai-alert .lucide {
    width: 20px;
    height: 20px;
}

.citation-link .lucide {
    width: 12px;
    height: 12px;
}

.ai-smart-block .btn-soft .lucide {
    width: 16px;
    height: 16px;
}
/* ======================================= */
/* === CONTROLLO PERMESSI (RBAC) UI    === */
/* ======================================= */

/*
  Nasconde il link alla Chat con il Project Manager
  per tutti gli utenti che hanno il ruolo "viewer".
*/
body.role-viewer .sidebar-nav .nav-link[data-section="chat-pm"] {
    display: none;
}