/* Main Styles */
:root {
    --smp-navy: #081d35;
    --smp-ink: #10243f;
    --smp-blue-dark: #073b78;
    --smp-blue: #0076e8;
    --smp-blue-hover: #005db8;
    --smp-blue-soft: #e7f2ff;
    --smp-orange: #ff7900;
    --smp-orange-soft: #fff0e3;
    --smp-muted: #607086;
    --smp-line: #dbe5ef;
    --smp-page: #f4f8ff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Navigation */
.navbar {
    background-color: #10243f;
    color: white;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 60px;
    position: fixed;
    top: 60px;
    left: 0;
    z-index: 999;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: white;
    border-radius: 3px;
    transition: 0.3s;
}

/* Mobile Menu Open State for Toggle */
.mobile-nav-active .nav-toggle span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.mobile-nav-active .nav-toggle span:nth-child(2) { opacity: 0; }
.mobile-nav-active .nav-toggle span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.navbar-menu a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

.navbar-menu a:hover {
    color: #0076e8;
}

/* Main Container */
.main-container {
    margin-top: 120px;
    padding: 2rem;
    width: 100%;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    color: #10243f;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #0076e8;
    color: white;
}

.btn-primary:hover {
    background-color: #005db8;
}

.btn-secondary {
    background-color: #607086;
    color: white;
}

.btn-secondary:hover {
    background-color: #607086;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group select {
    max-width: 250px; /* Prevents dropdowns from stretching too far on wide screens */
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.underwriting-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table thead {
    background-color: #073b78;
    color: white;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody tr.clickable-row {
    cursor: pointer;
}

.table tbody tr.clickable-row:focus {
    outline: 3px solid rgba(0, 118, 232, 0.25);
    outline-offset: -3px;
}

.table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-new {
    background-color: #0076e8;
    color: white;
}

.status-qualified {
    background-color: #ff7900;
    color: white;
}

.status-proposal_sent {
    background-color: #9b59b6;
    color: white;
}

.status-won {
    background-color: #27ae60;
    color: white;
}

/* Temperature Colors */
.temp-hot { border-left: 5px solid #e74c3c; }
.temp-warm { border-left: 5px solid #ff7900; }
.temp-cold { border-left: 5px solid #0076e8; }

/* Pipeline Stages */
.stage-soft_quote { background-color: #ecf0f1; color: #607086; }
.stage-ready_to_submit { background-color: #d1ecf1; color: #0c5460; }
.stage-payroll_needed { background-color: #fff3cd; color: #856404; }
.stage-loss_runs_needed { background-color: #fce8e8; color: #9b1c1c; }
.stage-ein_needed { background-color: #e0f2fe; color: #075985; }
.stage-hard_quote { background-color: #cce5ff; color: #004085; }
.stage-presented { background-color: #d4edda; color: #155724; }
.stage-closed_lost { background-color: #f8d7da; color: #721c24; }
.stage-closed_won { background-color: #27ae60; color: #ffffff; }

.pipeline-item {
    padding: 1rem;
    background: #fff;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.pipeline-item:hover {
    filter: brightness(96%);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.status-lost {
    background-color: #e74c3c;
    color: white;
}

.status-active {
    background-color: #27ae60;
    color: white;
}

.status-inactive {
    background-color: #607086;
    color: white;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 6rem auto 2rem;
    padding: 2rem;
    border-radius: 4px;
    width: 90%;
    max-width: 500px;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

/* Auth Page */
.auth-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(8, 29, 53, 0.96), rgba(7, 59, 120, 0.88)),
        radial-gradient(circle at 82% 18%, rgba(255, 121, 0, 0.24), transparent 28%),
        #081d35;
    padding-top: 100px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(4, 22, 43, 0.25);
    border: 1px solid rgba(219, 229, 239, 0.9);
}

/* Hide search bar on login/register pages */
.auth-page .topbar-search {
    display: none;
}

.login-box h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: #10243f;
}

.login-box p {
    color: #607086;
    margin-bottom: 2rem;
}

.forgot-password-link {
    display: block;
    text-align: right;
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.register-link {
    text-align: center;
    margin-top: 1rem;
    color: #607086;
}

.register-link a {
    color: #0076e8;
    text-decoration: none;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Dashboard */
.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.dashboard-card h3 {
    color: #607086;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #10243f;
}

.dashboard-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.dashboard-section h2 {
    margin-bottom: 1rem;
    color: #10243f;
}

.dashboard-section {
    margin-bottom: 2rem;
}

/* Filter Section */
.filter-section {
    margin-bottom: 2rem;
}

.filter-section select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    width: auto;
    min-width: 140px;
    max-width: 200px;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .navbar-menu {
        flex-direction: column;
        gap: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Topbar Navigation */
.topbar {
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    padding: 0;
    min-height: 60px;
}

.topbar-inner {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 1.5rem;
    min-height: 60px;
}

.topbar-search {
    flex: 0 1 400px;
    margin-left: 1.5rem;
}

.topbar-search form {
    position: relative;
    display: flex;
    align-items: center;
}

.topbar-search input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    font-size: 0.875rem;
    background-color: #f9fafb;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.topbar-search button {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
}

/* Live Search Results Dropdown */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    max-height: 450px;
    overflow-y: auto;
    display: none;
}

.search-result-group-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    padding: 0.75rem 1rem 0.25rem;
    background: #f9fafb;
}

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #111827;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
}

.search-result-item:hover {
    background-color: #eff6ff;
}

.topbar-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    list-style: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
}

.topbar-nav-item {
    position: relative;
}

/* Utility to push an item (like Account) to the far right of the topbar */
.nav-push-right {
    margin-left: auto;
}

.topbar-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.topbar-nav-link:hover,
.topbar-nav-link:focus {
    background-color: #f3f4f6;
    color: #111827;
}

.topbar-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    padding: 0.5rem 0;
    z-index: 1000;
}

/* Hover bridge: creates an invisible hit area between the topbar and the dropdown 
   to prevent the menu from disappearing when moving the mouse down */
.topbar-dropdown::before {
    content: "";
    position: absolute;
    top: -20px; /* Extends the hover area upwards */
    left: 0;
    right: 0;
    height: 20px;
    display: block;
}

/* Right-aligned utility for menus on the right side of the screen (e.g. Account/Profile) */
.topbar-dropdown.dropdown-right {
    left: auto;
    right: 0;
}

.topbar-nav-item:hover > .topbar-dropdown,
.topbar-nav-item:focus-within > .topbar-dropdown,
.topbar-nav-item.open > .topbar-dropdown {
    display: block;
}

.topbar-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

.topbar-dropdown-item:hover,
.topbar-dropdown-item:focus {
    background-color: #f9fafb;
    color: #111827;
}

/* Site header/logo */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid #dbe5ef;
    padding: 0.5rem 1rem;
}
.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}
.site-logo {
    height: 68px;
    max-width: 380px;
    object-fit: contain;
    object-position: left center;
    display: block;
}
.brand-link { display: inline-block; }

/* Adjust auth page to account for header */
.auth-page .login-container {
    margin-top: 0;
}

/* AI Assistant Widget Styles */
#support-widget-container {
    position: fixed;
    right: 20px;
    bottom: 96px;
    z-index: 2001;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#support-widget-toggle {
    min-width: 92px;
    height: 42px;
    border: 1px solid #0f766e;
    border-radius: 999px;
    background: #ffffff;
    color: #0f766e;
    box-shadow: 0 8px 24px rgba(15, 118, 110, 0.22);
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0;
}

#support-widget-toggle:hover {
    background: #0f766e;
    color: #ffffff;
}

#support-widget-window {
    width: min(380px, calc(100vw - 32px));
    max-height: min(620px, calc(100vh - 150px));
    margin-bottom: 12px;
    background: #ffffff;
    border: 1px solid #0f766e;
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    overflow: hidden;
    flex-direction: column;
}

.support-widget-header {
    background: #0f766e;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    font-weight: 800;
}

.support-close-btn {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
    font-size: 1.1rem;
}

.support-widget-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-bottom: 1px solid #d7dee8;
    background: #f8fafc;
}

.support-tab {
    border: 0;
    border-right: 1px solid #d7dee8;
    background: transparent;
    color: #334155;
    padding: 0.65rem 0.35rem;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
}

.support-tab:last-child {
    border-right: 0;
}

.support-tab.active {
    background: #ffffff;
    color: #0f766e;
    box-shadow: inset 0 -3px 0 #0f766e;
}

#support-request-form {
    padding: 1rem;
    overflow-y: auto;
}

#support-request-form .form-group select {
    max-width: 100%;
}

.support-helper-text {
    margin-bottom: 0.85rem;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.35;
}

.support-status {
    min-height: 20px;
    margin: 0.35rem 0 0.75rem;
    font-size: 0.88rem;
    color: #475569;
}

.support-status.success {
    color: #0f766e;
    font-weight: 700;
}

.support-status.warning {
    color: #9a5b00;
    font-weight: 700;
}

.support-status.error {
    color: #b42318;
    font-weight: 700;
}

.support-submit-btn {
    width: 100%;
}

#ai-assistant-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
}

#ai-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #0076e8;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ai-chat-window {
    width: 350px;
    height: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-header {
    background-color: #10243f;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    user-select: none;
}

.ai-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-header-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.ai-header-btn:hover { opacity: 1; }

#ai-chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#ai-chat-history {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: #fdfdfd;
}

.ai-history-header { padding: 0.5rem 1rem; border-bottom: 1px solid #eee; }
.ai-history-item { padding: 1rem; border-bottom: 1px solid #f0f0f0; }
.ai-history-date { font-size: 0.75rem; color: #607086; margin-bottom: 0.25rem; }
.ai-history-prompt { font-size: 0.85rem; color: #10243f; font-weight: 500; }
.ai-history-restore { 
    margin-top: 0.5rem;
    font-size: 0.8rem; 
    color: #0076e8; 
    background: none; 
    border: 1px solid #0076e8; 
    border-radius: 4px; 
    padding: 2px 8px; 
    cursor: pointer;
}
.ai-history-restore:hover { background: #0076e8; color: white; }

.ai-msg {
    position: relative;
    padding: 0.75rem;
    border-radius: 8px;
    max-width: 85%;
    font-size: 0.9rem;
    white-space: pre-wrap; /* Essential for preserving email draft formatting */
}

.ai-msg-bot { 
    background-color: #f1f1f1; 
    align-self: flex-start; 
    padding-right: 2.5rem; /* Room for the copy button */
}
.ai-msg-user { background-color: #0076e8; color: white; align-self: flex-end; }

.ai-copy-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.ai-copy-btn:hover { opacity: 1; }

#ai-chat-form {
    padding: 1rem;
    border-top: 1px solid #eee;
    display: flex;
    gap: 0.5rem;
}

#ai-chat-form input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.auth-page .login-container {
    margin-top: 0;
}
/* 1. Add clearance for the fixed header at the top of the page */
body.register-page {
    padding-top: 130px !important; /* Adjusted to match new unified header height */
    justify-content: flex-start !important; /* Prevent vertical centering from pushing the box under the header */
}

/* 2. Ensure the header always stays on top of the registration box */
header {
    z-index: 1050;
    position: fixed;
    top: 0;
    width: 100%;
}

.navbar {
    z-index: 999;
    position: fixed;
    top: 60px;
    width: 100%;
}

/* Public registration refresh */
body.register-page {
    justify-content: flex-start !important;
    align-items: stretch;
    padding-top: 110px !important;
    background:
        linear-gradient(135deg, rgba(8, 29, 53, 0.97), rgba(7, 59, 120, 0.88)),
        radial-gradient(circle at 82% 18%, rgba(255, 121, 0, 0.24), transparent 30%),
        #081d35;
}

.register-page .site-header {
    box-shadow: 0 10px 30px rgba(5, 31, 62, 0.12);
}

.register-page .topbar,
.register-page .topbar-inner {
    background: #ffffff;
}

.register-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto 48px;
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 0.82fr);
    gap: 28px;
    align-items: start;
}

.register-brand-panel {
    color: #ffffff;
    padding: 34px 0 0;
}

.register-logo-lockup {
    width: min(430px, 100%);
    height: 118px;
    overflow: hidden;
    border-radius: 8px;
    background: #ffffff;
    margin-bottom: 28px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.register-logo-lockup img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.register-brand-panel h1 {
    max-width: 680px;
    margin: 0 0 16px;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.05;
    letter-spacing: 0;
}

.register-brand-panel p {
    max-width: 620px;
    margin: 0 0 26px;
    color: #d7e7f8;
    font-size: 1.08rem;
}

.trial-snapshot {
    display: grid;
    grid-template-columns: repeat(3, minmax(100px, 1fr));
    gap: 12px;
    max-width: 620px;
    margin-bottom: 22px;
}

.trial-snapshot div {
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.trial-snapshot strong {
    display: block;
    font-size: 1.8rem;
    line-height: 1;
}

.trial-snapshot span {
    color: #bed4ea;
    font-size: 0.9rem;
}

.register-workflow-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 10px;
    max-width: 620px;
}

.register-workflow-list span {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-left: 3px solid #ff7900;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #f3f8ff;
    font-weight: 700;
}

.register-form-panel {
    max-width: none;
    padding: 0;
}

.register-page .login-box {
    padding: 28px;
    border-top: 4px solid #ff7900;
}

.register-page .login-box h1 {
    color: #073b78;
}

.register-page .login-box p {
    color: #607086;
}

.register-page .login-box small {
    color: #607086 !important;
}

.register-page .form-group label {
    color: #10243f;
    font-weight: 700;
}

.register-page input,
.register-page select {
    border-color: #cfe0f4;
}

.register-page input:focus,
.register-page select:focus {
    border-color: #0076e8;
    box-shadow: 0 0 0 3px rgba(0, 118, 232, 0.12);
    outline: none;
}

.register-page .btn-primary {
    background: #0076e8;
    border-color: #0076e8;
}

.register-page .btn-primary:hover {
    background: #005db8;
    border-color: #005db8;
}

@media (max-width: 900px) {
    body.register-page {
        padding-top: 100px !important;
    }

    .register-shell {
        grid-template-columns: 1fr;
    }

    .register-brand-panel {
        padding-top: 18px;
    }

    .register-logo-lockup {
        height: 96px;
    }

    .trial-snapshot,
    .register-workflow-list {
        grid-template-columns: 1fr;
    }
}

/* 3. Ensure the registration container has a lower stack order than the header */
.register-container, .registration-box {
    position: relative;
    z-index: 1;
    margin-top: 20px;
}

/* AI Assistant "Thinking" Animation */
.ai-msg.loading {
    padding-right: 0.75rem !important; /* Override standard bot msg padding */
    width: fit-content;
}
.ai-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}
.ai-typing span {
    width: 6px;
    height: 6px;
    background-color: #bdc3c7;
    border-radius: 50%;
    animation: ai-typing-pulse 1.4s infinite ease-in-out both;
}
.ai-typing span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing span:nth-child(2) { animation-delay: -0.16s; }
@keyframes ai-typing-pulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Snap Manager Pro brand system overrides */
body {
    background-color: var(--smp-page);
    color: var(--smp-ink);
}

.topbar {
    min-height: 84px;
    border-bottom-color: var(--smp-line);
    box-shadow: 0 8px 24px rgba(8, 29, 53, 0.08);
}

.topbar-inner {
    min-height: 84px;
}

.site-header {
    border-bottom-color: var(--smp-line);
}

.site-logo {
    height: 68px;
    max-width: 380px;
    object-fit: contain;
    object-position: left center;
}

.navbar {
    background-color: var(--smp-ink);
    top: 84px;
}

.navbar-menu a:hover {
    color: #ffb36b;
}

.main-container {
    margin-top: 144px;
}

.page-header h1,
.dashboard-section h2,
.stat-number {
    color: var(--smp-ink);
}

.btn-primary,
button.btn-primary,
input[type="submit"].btn-primary {
    background-color: var(--smp-blue);
    border-color: var(--smp-blue);
    color: #ffffff;
}

.btn-primary:hover,
button.btn-primary:hover,
input[type="submit"].btn-primary:hover {
    background-color: var(--smp-blue-hover);
    border-color: var(--smp-blue-hover);
}

.btn-secondary {
    background-color: var(--smp-blue-dark);
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: var(--smp-ink);
}

.form-group input,
.form-group textarea,
.form-group select,
.topbar-search input {
    border-color: #cfe0f4;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.topbar-search input:focus {
    border-color: var(--smp-blue);
    box-shadow: 0 0 0 3px rgba(0, 118, 232, 0.12);
    outline: none;
}

.table {
    box-shadow: 0 10px 24px rgba(8, 29, 53, 0.08);
}

.table thead {
    background-color: var(--smp-blue-dark);
}

.table tbody tr:hover,
.search-result-item:hover,
.topbar-nav-link:hover,
.topbar-nav-link:focus,
.topbar-dropdown-item:hover,
.topbar-dropdown-item:focus {
    background-color: var(--smp-blue-soft);
}

.topbar-nav-link,
.topbar-dropdown-item,
.search-result-item {
    color: var(--smp-ink);
}

.topbar-nav-link:hover,
.topbar-nav-link:focus,
.topbar-dropdown-item:hover,
.topbar-dropdown-item:focus {
    color: var(--smp-blue-dark);
}

.topbar-search button,
.register-link a,
a.btn-link,
.btn-link {
    color: var(--smp-blue);
}

.dashboard-card,
.dashboard-section,
.modal-content {
    border: 1px solid var(--smp-line);
    box-shadow: 0 10px 24px rgba(8, 29, 53, 0.08);
}

.dashboard-card {
    border-top: 3px solid var(--smp-blue);
}

.modal-content {
    border-top: 4px solid var(--smp-orange);
}

.status-new,
.temp-cold,
.ai-msg-user,
#ai-chat-toggle {
    background-color: var(--smp-blue);
}

.status-qualified {
    background-color: var(--smp-orange);
}

.temp-warm {
    border-left-color: var(--smp-orange);
}

.ai-chat-header {
    background: linear-gradient(135deg, var(--smp-navy), var(--smp-blue-dark));
}

.ai-history-prompt {
    color: var(--smp-ink);
}

.ai-history-restore {
    color: var(--smp-blue);
    border-color: var(--smp-blue);
}

.ai-history-restore:hover {
    background: var(--smp-blue);
    color: #ffffff;
}

#ai-assistant-container {
    z-index: 5000;
}

#ai-chat-toggle {
    width: 62px;
    height: 62px;
    background: #111827;
    color: #ffffff;
    border: 2px solid #f59e0b;
    box-shadow: 0 14px 34px rgba(17, 24, 39, 0.38);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0;
}

#ai-chat-toggle:hover {
    background: #0f766e;
    transform: translateY(-1px);
}

#ai-chat-window {
    width: min(390px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 160px));
    min-height: 420px;
    background: #ffffff;
    border: 1px solid #111827;
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.34);
}

.ai-chat-header {
    background: #111827;
    border-bottom: 3px solid #f59e0b;
}

.ai-chat-header > span {
    font-weight: 800;
}

.ai-chat-header-actions {
    gap: 0.45rem;
}

#ai-mode-label {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.42);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.ai-header-btn {
    min-width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    opacity: 1;
}

.ai-header-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

#ai-chat-messages {
    background: #f8fafc;
}

.ai-msg {
    border-radius: 8px;
    line-height: 1.45;
}

.ai-msg-bot {
    background: #ffffff;
    color: #172033;
    border: 1px solid #d7dee8;
}

.ai-msg-local {
    border-left: 4px solid #0f766e;
}

.ai-msg-user {
    background: #0f766e;
    color: #ffffff;
}

.ai-copy-btn {
    color: #0f766e;
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.85;
}

#ai-chat-form {
    background: #ffffff;
    border-top: 1px solid #d7dee8;
}

#ai-chat-form input {
    min-width: 0;
    border: 1px solid #9aa8ba;
    border-radius: 6px;
}

#ai-chat-form button {
    background: #111827;
    color: #ffffff;
    border: 0;
    border-radius: 6px;
    padding: 0 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

#ai-chat-form button:hover {
    background: #0f766e;
}

@media (max-width: 520px) {
    #support-widget-container {
        right: 12px;
        bottom: 86px;
        left: 12px;
        align-items: stretch;
    }

    #support-widget-toggle {
        align-self: flex-end;
    }

    #support-widget-window {
        width: 100%;
        max-height: min(570px, calc(100vh - 150px));
    }

    #ai-assistant-container {
        right: 12px;
        bottom: 12px;
        left: 12px;
    }

    #ai-chat-window {
        width: 100%;
        height: min(520px, calc(100vh - 145px));
    }
}

@media (max-width: 768px) {
    .main-container {
        margin-top: 144px;
    }

    .site-logo {
        height: 56px;
        max-width: 300px;
    }
}

/* Unified interface polish */
:root {
    --smp-surface: #ffffff;
    --smp-surface-soft: #f8fbff;
    --smp-radius: 6px;
    --smp-control-height: 42px;
    --smp-action-width: 190px;
    --smp-market-action-width: 164px;
    --smp-shadow: 0 8px 24px rgba(8, 29, 53, 0.08);
}

body {
    background: var(--smp-page);
    color: var(--smp-ink);
}

.topbar,
.site-header {
    background: var(--smp-surface);
    border-bottom: 1px solid var(--smp-line);
    box-shadow: var(--smp-shadow);
}

.topbar {
    min-height: 72px;
}

.topbar-inner {
    min-height: 72px;
    gap: 18px;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    height: 48px;
}

.site-logo {
    width: auto;
    height: 48px;
    max-width: 260px;
    max-height: 48px;
    object-fit: contain;
    object-position: left center;
    display: block;
}

.navbar {
    top: 72px;
}

.main-container {
    margin-top: 132px;
}

.topbar-nav {
    gap: 4px;
}

.topbar-nav-link {
    min-height: 40px;
    padding: 0 12px;
    border-radius: var(--smp-radius);
    font-weight: 600;
}

.topbar-dropdown {
    border-color: var(--smp-line);
    border-radius: var(--smp-radius);
    box-shadow: var(--smp-shadow);
}

.topbar-dropdown-item {
    min-height: 40px;
    display: flex;
    align-items: center;
}

.topbar-search {
    flex-basis: 360px;
}

.topbar-search form {
    height: 40px;
}

.topbar-search input {
    height: 40px;
    border-radius: var(--smp-radius);
    background: var(--smp-surface-soft);
}

.topbar-search button {
    right: 4px;
    width: 34px;
    height: 34px;
    border-radius: var(--smp-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--smp-blue);
}

.page-header,
.acord-header,
.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--smp-line) !important;
    padding-bottom: 16px;
    margin-bottom: 22px;
}

.page-header h1,
.acord-header h1,
.dashboard-header h1 {
    color: var(--smp-ink);
    letter-spacing: 0;
}

.form-section,
.acord-section,
.dashboard-card,
.dashboard-section,
.modal-content,
.table {
    border: 1px solid var(--smp-line);
    border-radius: var(--smp-radius);
    box-shadow: var(--smp-shadow);
}

.section-header {
    border-bottom-color: var(--smp-line) !important;
    color: var(--smp-ink) !important;
}

.btn,
.dash-btn,
button.btn,
input[type="submit"].btn,
input[type="button"].btn {
    min-height: var(--smp-control-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: var(--smp-radius);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn:hover,
.dash-btn:hover {
    transform: translateY(-1px);
}

.btn-sm,
.btn-small {
    min-height: 34px;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
}

.btn-primary,
.dash-btn-primary,
button.btn-primary,
input[type="submit"].btn-primary {
    background: var(--smp-blue);
    border-color: var(--smp-blue);
    color: #ffffff;
}

.btn-primary:hover,
.dash-btn-primary:hover,
button.btn-primary:hover,
input[type="submit"].btn-primary:hover {
    background: var(--smp-blue-hover);
    border-color: var(--smp-blue-hover);
}

.btn-secondary,
.dash-btn-secondary {
    background: var(--smp-blue-dark);
    border-color: var(--smp-blue-dark);
    color: #ffffff;
}

.btn-secondary:hover,
.dash-btn-secondary:hover {
    background: var(--smp-ink);
    border-color: var(--smp-ink);
}

.btn-link {
    min-height: auto;
    padding: 0;
    background: transparent;
    box-shadow: none;
    color: var(--smp-blue);
}

.sticky-actions,
.form-actions,
.modal-actions,
.dashboard-actions,
.reading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: stretch;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    padding: 15px;
    margin-top: 20px;
    background: var(--smp-surface-soft);
    border: 1px solid var(--smp-line);
    border-radius: var(--smp-radius) var(--smp-radius) 0 0;
    box-shadow: 0 -8px 24px rgba(8, 29, 53, 0.08);
}

.sticky-actions .btn,
.form-actions .btn,
.modal-actions .btn,
.dashboard-actions .btn,
.dashboard-actions .dash-btn,
.reading-actions .btn,
.reading-actions .dash-btn {
    width: var(--smp-action-width);
    min-height: var(--smp-control-height);
}

.page-header .btn,
.acord-header .btn {
    min-width: var(--smp-action-width);
}

.inline-actions,
.table-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline-actions .btn,
.table-actions .btn {
    min-width: 118px;
    min-height: 36px;
}

.status-badge {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 5px 12px;
    font-weight: 700;
}

#carrier_proposals_body .market-file-link,
#carrier_proposals_body .market-action,
.carrier-market-section .carrier-automation-action {
    width: var(--smp-market-action-width);
    min-height: var(--smp-control-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 9px 12px !important;
    border: 1px solid var(--smp-line);
    border-radius: var(--smp-radius);
    background: var(--smp-surface-soft);
    color: var(--smp-blue-dark) !important;
    font-size: 0.88rem !important;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    text-align: center;
    white-space: normal;
    box-shadow: none;
}

#carrier_proposals_body .carrier-actions-cell {
    min-width: 340px;
    text-align: right;
}

#carrier_proposals_body .carrier-actions {
    display: grid;
    grid-template-columns: repeat(2, var(--smp-market-action-width));
    gap: 8px;
    justify-content: end;
    align-items: stretch;
}

#carrier_proposals_body .market-file-link:hover,
#carrier_proposals_body .market-action:hover,
.carrier-market-section .carrier-automation-action:hover {
    background: var(--smp-blue-soft);
    border-color: #b8d7f6;
    color: var(--smp-ink) !important;
    transform: none;
}

.carrier-market-section .table th:last-child,
.carrier-market-section .table td:last-child {
    text-align: right;
}

#carrier_proposals_body .market-action-primary,
.carrier-market-section .carrier-automation-action {
    background: var(--smp-blue);
    border-color: var(--smp-blue);
    color: #fff !important;
}

#carrier_proposals_body .market-action-primary:hover,
.carrier-market-section .carrier-automation-action:hover {
    background: var(--smp-blue-dark);
    border-color: var(--smp-blue-dark);
    color: #fff !important;
}

#carrier_proposals_body .market-action-success {
    background: #e8f7ef;
    border-color: #bfe6cf;
    color: #1f7a45 !important;
}

#carrier_proposals_body .market-action-danger {
    background: #fff0f0;
    border-color: #f4c7c7;
    color: #b42318 !important;
}

@media (max-width: 900px) {
    .topbar {
        min-height: auto;
    }

    .topbar-inner {
        min-height: 72px;
        flex-wrap: wrap;
        padding: 10px 16px;
    }

    .topbar-search {
        flex: 1 1 100%;
        margin-left: 0;
    }

    .site-logo {
        height: 42px;
        max-height: 42px;
        max-width: 220px;
    }
}

@media (max-width: 720px) {
    .main-container {
        margin-top: 132px;
    }

    .sticky-actions,
    .form-actions,
    .modal-actions,
    .dashboard-actions,
    .reading-actions {
        justify-content: stretch;
    }

    .sticky-actions .btn,
    .form-actions .btn,
    .modal-actions .btn,
    .dashboard-actions .btn,
    .dashboard-actions .dash-btn,
    .reading-actions .btn,
    .reading-actions .dash-btn {
        width: 100%;
    }

    #carrier_proposals_body .carrier-actions {
        grid-template-columns: 1fr;
    }

    #carrier_proposals_body .market-file-link,
    #carrier_proposals_body .market-action,
    .carrier-market-section .carrier-automation-action {
        width: 100%;
    }
}
