@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&display=swap');

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
    /* Primary: Teal Brand */
    --primary:        #0d9488;
    --primary-dark:   #0b7a70;
    --primary-darker: #0a6560;
    --primary-light:  #d0f5f1;
    --primary-xlight: #f0fdfb;

    /* Gold Accent */
    --gold:           #d4af37;
    --gold-light:     #fef9e7;
    --gold-dark:      #b8960c;

    /* Neutral */
    --bg:             #f4f7f9;
    --surface:        #ffffff;
    --border:         #e2e8f0;
    --text-primary:   #0f172a;
    --text-secondary: #64748b;
    --text-muted:     #94a3b8;

    /* Sidebar */
    --sidebar-width:  260px;
    --sidebar-bg:     #0a6560;
    --sidebar-text:   rgba(255, 255, 255, 0.75);
    --sidebar-active: rgba(255, 255, 255, 0.15);
    --sidebar-hover:  rgba(255, 255, 255, 0.08);

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.05);
    --shadow-lg:  0 10px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);
    --shadow-glow: 0 0 25px rgba(13,148,136,0.25);

    /* Override Bootstrap 5 font variables */
    --bs-font-sans-serif: 'Nunito', system-ui, -apple-system, sans-serif;
    --bs-body-font-family: 'Nunito', system-ui, -apple-system, sans-serif;
}

/* ============================================
   BASE & RESET
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    height: 100%;
    overflow-x: hidden;
    font-family: 'Nunito', system-ui, -apple-system, sans-serif !important;
    background-color: var(--bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}


/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar            { width: 6px; height: 6px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover{ background: var(--text-muted); }

/* ============================================
   TYPOGRAPHY
   ============================================ */
.fw-black  { font-weight: 900 !important; }
.fw-heavy  { font-weight: 800 !important; }
.tracking-tight  { letter-spacing: -0.025em; }
.tracking-wider  { letter-spacing: 0.06em; }

/* ============================================
   COLOR UTILITIES
   ============================================ */
.text-primary-brand { color: var(--primary) !important; }
.text-teal          { color: var(--primary) !important; }
.text-teal-dark     { color: var(--primary-dark) !important; }
.text-teal-light    { color: var(--primary-light) !important; }
.text-gold          { color: var(--gold) !important; }
.text-gold-dark     { color: var(--gold-dark) !important; }

.bg-primary-brand    { background-color: var(--primary) !important; }
.bg-teal             { background-color: var(--primary) !important; }
.bg-teal-light       { background-color: var(--primary-light) !important; }
.bg-teal-xlight      { background-color: var(--primary-xlight) !important; }
.bg-gold             { background-color: var(--gold) !important; }
.bg-gold-light       { background-color: var(--gold-light) !important; }

.bg-teal-gradient {
    background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary) 100%) !important;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-teal {
    background: var(--primary);
    color: #fff;
    border: none;
    transition: all 0.25s ease;
    font-weight: 600;
}
.btn-teal:hover, .btn-teal:focus {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13,148,136,0.35);
}

.btn-outline-teal {
    color: var(--primary);
    border: 1.5px solid var(--primary);
    background: transparent;
    transition: all 0.25s ease;
    font-weight: 600;
}
.btn-outline-teal:hover, .btn-outline-teal:focus {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(13,148,136,0.25);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #fff;
    border: none;
    font-weight: 700;
    transition: all 0.25s ease;
}
.btn-gold:hover {
    background: linear-gradient(135deg, #9a7b08, var(--gold-dark));
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212,175,55,0.4);
}

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* ============================================
   TOP NAVBAR (Full Width)
   ============================================ */
#top-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    width: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}


#top-navbar .navbar-brand {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50vw;
}
#top-navbar .navbar-brand i {
    font-size: 1.3rem;
    flex-shrink: 0;
}
#top-navbar .brand-handle {
    overflow: hidden;
    text-overflow: ellipsis;
}

#top-navbar .nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 576px) {
    #top-navbar { padding: 0 1rem; }
    #top-navbar .navbar-brand { font-size: 1rem; max-width: 45vw; }
    #top-navbar .nav-actions { gap: 6px; }
    #top-navbar .nav-actions .btn { 
        padding: 0 !important; 
        width: 36px; 
        height: 36px; 
        display: flex; 
        align-items: center; 
        justify-content: center; 
        border-radius: 50% !important;
    }
    #top-navbar .nav-actions .btn .btn-text { display: none !important; }
    #top-navbar .nav-actions .btn i { margin: 0 !important; font-size: 1.1rem; }
    #top-navbar #nav-user-info { display: none !important; }
    #top-navbar #nav-login-btn {
        padding: 0.3rem 0.9rem !important;
        width: auto !important;
        height: auto !important;
        border-radius: 50rem !important;
    }
    #top-navbar #nav-login-btn .btn-text { display: inline !important; }
    #top-navbar #nav-login-btn i { margin-right: 0.25rem !important; font-size: 0.9rem !important; }
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

/* Activated when dashboard is showing — locks body scroll, zero gaps */
body.dashboard-active {
    overflow: hidden;
    height: 100vh;
    padding: 0;
    margin: 0;
}
body.dashboard-active #top-navbar {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    overflow: hidden !important;
    visibility: hidden !important;
}
body.dashboard-active #app-content {
    height: 100vh !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block;
    position: relative;
}

#dashboard-layout {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* --- Sidebar --- */
.db-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-darker) 0%, #0a6560 50%, #085753 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transition: transform 0.3s ease;
    overflow: hidden; /* children handle their own scroll */
}

.db-sidebar .sidebar-brand {
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    gap: 12px;
    flex-shrink: 0;
}
.db-sidebar .sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}
.db-sidebar .sidebar-brand .brand-text {
    font-weight: 800;
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.2;
}
.db-sidebar .sidebar-brand .brand-text span {
    display: block;
    font-size: 0.72rem;
    font-weight: 400;
    color: rgba(255,255,255,0.6);
}

.db-sidebar .sidebar-profile {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.db-sidebar .sidebar-profile .profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.db-sidebar .sidebar-profile .profile-info { overflow: hidden; }
.db-sidebar .sidebar-profile .profile-name {
    font-weight: 700;
    color: #fff;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.db-sidebar .sidebar-profile .profile-credit {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.db-sidebar .sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}
.db-sidebar .sidebar-nav::-webkit-scrollbar { width: 0; }

.sidebar-group-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
    padding: 0.75rem 0.75rem 0.4rem;
    user-select: none;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    cursor: pointer;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 2px;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}
.sidebar-nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    opacity: 0.75;
    transition: opacity 0.2s;
}
.sidebar-nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.sidebar-nav-item:hover i { opacity: 1; }
.sidebar-nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--gold);
}
.sidebar-nav-item.active i { opacity: 1; color: var(--gold); }

.db-sidebar .sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.25);
    color: #fca5a5;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.sidebar-logout-btn:hover {
    background: rgba(239,68,68,0.25);
    color: #fff;
}

/* --- Main Content --- */
.db-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;  /* main scroll container */
}

.db-topbar {
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.db-topbar .topbar-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
}
.db-topbar .topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}


/* --- Dashboard Footer (fixed at bottom, always visible like a bottom nav) --- */
:root { --footer-height: 52px; }

.db-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--footer-height);
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0.75rem;
    z-index: 99;
    box-shadow: 0 -1px 8px rgba(0,0,0,0.05);
}

/* Push page content up so footer doesn't overlap it */
.db-page {
    padding: 2rem 1.75rem calc(var(--footer-height) + 1.5rem) 1.75rem;
    flex: 1;
}

.db-footer-copy {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.db-footer-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
}
.db-footer-links a {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}
.db-footer-links a:hover { color: var(--primary); }
.db-footer-sep { color: var(--border); }

/* --- Mobile overlay sidebar --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 190;
}
.sidebar-overlay.active { display: block; }

/* ============================================
   RESPONSIVE — MOBILE
   ============================================ */
@media (max-width: 767.98px) {
    #dashboard-layout { height: 100dvh; }
    .db-sidebar {
        transform: translateX(-100%);
    }
    .db-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .db-main {
        margin-left: 0;
        height: 100dvh;
    }
    .db-topbar { padding: 0 1rem; }
    .db-page   { padding: 1.25rem 1rem calc(var(--footer-height) + 1rem) 1rem; }

    /* Mobile: footer spans full width (sidebar hidden) */
    .db-footer {
        left: 0;
        padding: 0 1rem;
        gap: 0.5rem;
    }
    .db-footer-copy { display: none; } /* Hide copyright on mobile to save space */
    .db-footer-links { gap: 0.75rem; }
    .db-footer-sep { display: none; }
}

/* --- Legal Page Typography --- */
#legal-content-body h2 { font-size: 1.4rem; font-weight: 800; color: var(--primary-darker); margin-bottom: 0.5rem; }
#legal-content-body h3 { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-top: 1.5rem; margin-bottom: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
#legal-content-body p  { font-size: 0.92rem; color: var(--text-secondary); margin-bottom: 0.75rem; line-height: 1.8; }
#legal-content-body ul, #legal-content-body ol { font-size: 0.92rem; color: var(--text-secondary); padding-left: 1.5rem; margin-bottom: 0.75rem; }
#legal-content-body li { margin-bottom: 0.35rem; }

/* --- Fix dash-section layout (prevent overflow bleed-through) --- */
.dash-section { min-height: 0; }
.db-page { overflow: visible; }

/* ============================================
   STAT CARDS
   ============================================ */
.stat-card {
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    background: var(--surface);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.stat-card.primary {
    background: linear-gradient(135deg, var(--primary-darker), var(--primary));
    border: none;
    color: #fff;
}
.stat-card .stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}
.stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 0.5rem;
}
.stat-card .stat-bg-icon {
    position: absolute;
    bottom: -12px;
    right: -8px;
    font-size: 5rem;
    opacity: 0.08;
}
.stat-card.primary .stat-bg-icon { opacity: 0.15; color: #fff; }

/* ============================================
   SECTION HEADER
   ============================================ */
.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.section-header .section-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15rem;
}
.section-header .section-title { font-weight: 800; font-size: 1.3rem; margin: 0; }
.section-header .section-subtitle { color: var(--text-secondary); font-size: 0.85rem; margin: 0; }

/* ============================================
   CARDS
   ============================================ */
.content-card {
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.content-card .card-inner { padding: 1.5rem; }
.content-card .card-inner-lg { padding: 2rem; }

/* ============================================
   PRICING CARDS
   ============================================ */
.pricing-card {
    background: var(--surface);
    border-radius: 20px;
    border: 2px solid var(--border);
    overflow: hidden;
    transition: all 0.3s ease;
    text-align: center;
}
.pricing-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.pricing-card.featured {
    border-color: var(--primary);
    transform: scale(1.04);
    box-shadow: var(--shadow-glow);
}
.pricing-card.featured:hover { transform: scale(1.04) translateY(-6px); }
.pricing-ribbon {
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.4rem 1rem;
}
.pricing-card.featured .pricing-ribbon {
    background: linear-gradient(90deg, var(--primary-darker), var(--primary));
}
.pricing-card.gold-card { border-color: var(--gold); }
.pricing-card.gold-card .pricing-ribbon {
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
    color: #fff;
}
.pricing-body { padding: 2rem 1.5rem; }
.pricing-price { font-size: 1.5rem; font-weight: 900; color: var(--text-primary); }
.pricing-credits { font-size: 3rem; font-weight: 900; color: var(--primary); line-height: 1; }
.pricing-card.gold-card .pricing-credits { color: var(--gold-dark); }

/* ============================================
   FORMS
   ============================================ */
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(13,148,136,0.18);
}
.form-floating > label { color: var(--text-muted); }
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--primary);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0);    }
}
.fade-in { animation: fadeInUp 0.4s ease both; }
#app-content { animation: fadeInUp 0.35s ease both; }
.dash-section { animation: fadeInUp 0.3s ease both; }

/* ============================================
   AUTH MODAL — GLASSMORPHISM
   ============================================ */
#authModal .modal-content {
    border-radius: 1.5rem;
    border: 1px solid rgba(255,255,255,0.2);
    overflow: hidden;
}
#authModal .nav-pills .nav-link.active {
    background: var(--primary);
    color: #fff;
}
#authModal .nav-pills .nav-link {
    color: var(--text-secondary);
    font-weight: 600;
    border-radius: 999px;
}

/* ============================================
   SWEETALERT CUSTOM
   ============================================ */
.swal2-popup.swal2-toast { font-family: 'Plus Jakarta Sans', sans-serif; }

/* ============================================
   BOOTSTRAP OVERRIDES
   ============================================ */
.card { border-radius: 12px; border-color: var(--border); }
.badge { font-weight: 600; }
.table > :not(caption) > * > * { padding: 0.85rem 1rem; }
.table-hover > tbody > tr:hover > * { background-color: var(--primary-xlight); }
.accordion-button:not(.collapsed) { color: var(--primary); box-shadow: none; }
.accordion-button:focus { box-shadow: none; }
.accordion-button:not(.collapsed)::after { filter: none; }

/* ============================================
   ASSESSMENT FORM REDESIGN
   ============================================ */
.custom-section-header {
    background: linear-gradient(135deg, #37685a, #284b42);
    color: #fff;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.custom-section-title {
    font-weight: 800;
    font-size: 1.15rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.custom-section-num {
    background: #fcd34d;
    color: #315f53;
    font-weight: 900;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.95rem;
}
.custom-section-desc {
    color: #fcd34d;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 6px 0 0 0;
}
.btn-autofill {
    border: 1px solid #fcd34d;
    color: #fcd34d;
    background: transparent;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-autofill:hover {
    background: #fcd34d;
    color: #315f53;
}

/* Assessment Inputs overriden to look clean */
.assessment-input {
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
    padding: 12px 14px !important;
}

/* Scale buttons (rating 1-5) */
.scale-row { display: flex; gap: 10px; }
.scale-btn {
    flex: 1; padding: 12px 6px; border-radius: 8px; border: 1px solid #e2e8f0;
    background: #fff; color: #94a3b8; font-weight: 800;
    font-size: 1rem; cursor: pointer; transition: all 0.18s ease; text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.scale-btn:hover { background: #f0fdf4; color: #1f6155; }
.scale-btn.active { 
    background: linear-gradient(135deg, #1f6155, #14443b); 
    border-color: transparent; 
    color: #fcd34d; 
    box-shadow: 0 8px 16px rgba(31,97,85,0.4); 
}

/* Question items */
.q-item {
    border: none; border-radius: 16px; padding: 1.5rem;
    margin-bottom: 1rem; background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.q-item .q-label { font-weight: 700; font-size: 0.95rem; margin-bottom: 1.25rem; color: #1f6155; }

/* Problem cards */
.problem-card {
    border: 2px solid transparent; border-radius: 14px; padding: 1.5rem 1.25rem;
    cursor: pointer; transition: all 0.2s ease; background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    height: 100%; display: flex; flex-direction: column;
    position: relative; overflow: hidden;
}
.problem-card:hover { transform: translateY(-3px); box-shadow: 0 8px 16px rgba(0,0,0,0.08); }
.problem-card.selected {
    background: linear-gradient(135deg, #1f6155, #14443b); color: #fff;
    border-color: #fcd34d;
    box-shadow: 0 8px 16px rgba(31,97,85,0.4);
}
.problem-card.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.problem-card .card-icon {
    width: 48px; height: 48px; border-radius: 12px; 
    background: #ffffff; border: 1px solid #a7f3d0; color: #14b8a6;
    display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 1.25rem;
}
.problem-card.selected .card-icon { background: rgba(0,0,0,0.2); border-color: transparent; color: #fcd34d; }
.problem-card .card-title { font-weight: 800; font-size: 1.05rem; color: #1f6155; margin-bottom: 6px; }
.problem-card.selected .card-title { color: #fcd34d; }
.problem-card .card-desc { font-size: 0.8rem; color: var(--text-secondary); margin: 0; line-height: 1.5; }
.problem-card.selected .card-desc { color: rgba(255,255,255,0.8); }

/* Prioritas Ribbon */
.prioritas-ribbon {
    position: absolute; top: 0; right: 0; background: #fcd34d; color: #1f6155;
    font-size: 0.65rem; font-weight: 900; padding: 6px 14px;
    border-bottom-left-radius: 14px; letter-spacing: 0.05em;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Followup options (Rincian) */
.followup-option-custom {
    display: flex; align-items: center; gap: 14px; padding: 1rem 1.25rem;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; cursor: pointer; transition: all 0.2s;
}
.followup-option-custom:hover { border-color: #cbd5e1; }
.followup-option-custom.selected { border: 2px solid #315f53; }
.followup-radio { display: none; }
.followup-circle {
    width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cbd5e1;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.followup-option-custom.selected .followup-circle { border-color: #a855f7; }
.followup-circle-inner { width: 12px; height: 12px; background: #a855f7; border-radius: 50%; }

/* Navigation buttons */
.btn-kembali {
    border: 1px solid rgba(255,255,255,0.6);
    color: #fff; background: rgba(255,255,255,0.15);
    border-radius: 12px; padding: 10px 24px; font-weight: 700; transition: all 0.2s;
}
.btn-kembali:hover { background: rgba(255,255,255,0.25); color: #fff; border-color: #fff; }

.btn-lanjut {
    background: #fcd34d; color: #1f6155;
    border: none; border-radius: 12px; padding: 10px 24px; font-weight: 800;
    box-shadow: 0 4px 12px rgba(252,211,77,0.3); transition: all 0.2s;
}
.btn-lanjut:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(252,211,77,0.4); color: #1f6155; }

/* Loading button */
.btn-loading { pointer-events: none; opacity: 0.7; }

/* ============================================
   AUTH MODAL TABS (no Bootstrap nav-link blue)
   ============================================ */
.auth-tabs {
    display: flex;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 5px;
    border-radius: 50px;
}
.auth-tab {
    flex: 1;
    padding: 9px 16px;
    border-radius: 50px;
    border: none;
    background: transparent;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}
.auth-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 3px 10px rgba(13,148,136,0.3);
}
.auth-tab:not(.active):hover {
    background: var(--primary-xlight);
    color: var(--primary);
}

/* Auth form fields */
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}
.auth-label i { color: var(--text-muted); font-size: 0.78rem; }
.auth-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-input::placeholder { color: var(--text-muted); font-size: 0.88rem; }
.auth-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
    background: #fff;
}

/* ============================================
   FORM INPUTS (Assessment & General)
   ============================================ */
.form-control, .form-select {
    border: 1.5px solid var(--border) !important;
    border-radius: 10px !important;
    font-family: inherit !important;
    font-size: 0.9rem !important;
    color: var(--text-primary) !important;
    background: var(--surface) !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    padding: 10px 14px !important;
}
.form-control::placeholder, .form-select::placeholder {
    color: var(--text-muted) !important;
    font-size: 0.85rem !important;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12) !important;
    background: #fff !important;
    outline: none !important;
}
.form-select { cursor: pointer !important; }

/* Fix Bootstrap form-floating label color */
.form-floating > label { color: var(--text-muted) !important; font-size: 0.88rem !important; }
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label { color: var(--primary) !important; }

/* ============================================
   RESULT PAGE — FREEMIUM BLUR SYSTEM
   ============================================ */
.result-locked {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
}
.result-locked-content {
    filter: blur(6px);
    user-select: none;
    pointer-events: none;
}
.result-lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(2px);
    border-radius: 14px;
    gap: 12px;
    padding: 2rem;
    text-align: center;
    z-index: 10;
}
.lock-badge {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary-darker), var(--primary));
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 20px rgba(13,148,136,0.35);
}
.lock-title { font-weight: 800; font-size: 1.05rem; color: var(--text-primary); margin: 0; }
.lock-desc { font-size: 0.83rem; color: var(--text-secondary); margin: 0; max-width: 280px; }

/* Free result summary card styling */
.result-section { margin-bottom: 2rem; }
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}
.result-card-header {
    padding: 1rem 1.5rem;
    background: var(--primary-xlight);
    border-bottom: 1px solid var(--primary-light);
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--primary-darker);
    display: flex;
    align-items: center;
    gap: 8px;
}
.result-card-body { padding: 1.5rem; }

/* ============================================
   DASHBOARD FILTER & LIST
   ============================================ */
.diag-filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.diag-tab {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.diag-tab:hover { color: var(--primary); background: var(--primary-xlight); }
.diag-tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }

.diag-date-input {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.8rem;
    color: var(--text-primary);
    background: var(--surface);
    outline: none;
    font-family: inherit;
}
.diag-date-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(13,148,136,0.1); }
.diag-filter-clear {
    border: none;
    background: var(--bg);
    color: var(--text-muted);
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s;
}
.diag-filter-clear:hover { background: #fee2e2; color: #dc2626; }

/* Diagnosis Grid */
.diag-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.85rem;
    align-items: stretch;
}

/* Diagnosis List Card */
.diag-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    transition: all 0.2s;
    height: 100%;
}
.diag-card:hover { border-color: var(--primary-light); box-shadow: 0 4px 12px rgba(0,0,0,0.05); transform: translateY(-2px); }
.diag-card-top { display: flex; align-items: center; gap: 0.75rem; }
.diag-card-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}
.diag-card-body { flex: 1; min-width: 0; }
.diag-card-title { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diag-card-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.diag-card-actions { display: flex; gap: 6px; flex-shrink: 0; margin-top: auto; padding-top: 0.5rem; border-top: 1px solid var(--border); }

/* New Diagnosis Striped Box */
.new-diag-box {
    border: 2px dashed var(--primary-light);
    border-radius: 14px;
    padding: 1.5rem 1rem;
    text-align: center;
    background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 10px, var(--primary-xlight) 10px, var(--primary-xlight) 20px);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    height: 100%;
    min-height: 110px;
}
.new-diag-box:hover {
    border-color: var(--primary);
    background: repeating-linear-gradient(45deg, var(--primary-xlight), var(--primary-xlight) 10px, var(--primary-light) 10px, var(--primary-light) 20px);
}

/* ============================================
   PRODUCT RECOMMENDATION SLIDER
   ============================================ */
.prod-rec-section { margin-top: 2rem; }
.prod-rec-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1rem; }
.prod-rec-title { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--text-primary); }
.prod-rec-subtitle { font-size: 0.8rem; color: var(--text-muted); margin: 3px 0 0; }
.prod-rec-see-all { color: var(--primary); font-weight: 600; font-size: 0.85rem; text-decoration: none; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.prod-rec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 14px;
    padding: 4px 2px;
}
.prod-rec-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.prod-rec-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.08); border-color: var(--primary-light); }
.prod-rec-cover { width: 100%; height: 115px; object-fit: cover; display: block; background: var(--bg); }
.prod-rec-body { padding: 0.7rem; flex: 1; display: flex; flex-direction: column; }
.prod-rec-name { font-weight: 700; font-size: 0.82rem; color: var(--text-primary); margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; }
.prod-rec-desc { font-size: 0.74rem; color: var(--text-muted); margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1; line-height: 1.4; }
.prod-rec-badge { display: inline-block; background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 2px 8px; font-size: 0.68rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.prod-rec-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 1rem;
}
.prod-rec-pg-btn {
    min-width: 34px; height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.prod-rec-pg-btn:hover:not(:disabled) { background: var(--primary-xlight); border-color: var(--primary); color: var(--primary); }
.prod-rec-pg-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.prod-rec-pg-btn:disabled { opacity: 0.35; cursor: default; }

/* Mobile banner */
.prod-rec-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
    text-decoration: none;
}
.prod-rec-banner:hover { border-color: var(--primary-light); }
.prod-rec-banner-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    background: var(--primary-xlight);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 1.4rem;
    color: var(--primary);
}
.prod-rec-banner-title { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); margin-bottom: 2px; }
.prod-rec-banner-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }

/* ============================================
   TICKET DETAIL — CHAT UI
   ============================================ */

/* The ticket-detail section fills the remaining db-main height */
.ticket-detail-section {
    flex-direction: column;
    height: calc(100vh - 64px - var(--footer-height));  /* topbar + footer */
    min-height: 0;
    margin: -2rem -1.75rem 0;          /* cancel db-page padding (top+sides) */
    padding: 0;
}
/* Only activate flex layout when the section is actually visible */
#dash-ticket-detail:not(.d-none) {
    display: flex !important;
}
@media (max-width: 767.98px) {
    .ticket-detail-section {
        margin: -1.25rem -1rem 0;
        height: calc(100dvh - 64px - var(--footer-height));
    }
}

/* ---- Chat Header ---- */
.chat-header-bar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.chat-header-info {
    min-width: 0;
    flex: 1;
}
.chat-header-subject {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-header-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ---- Chat Body (scrollable messages) ---- */
.chat-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #f0f4f8;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(13,148,136,0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 10%, rgba(99,102,241,0.04) 0%, transparent 50%);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ---- Chat Footer (reply bar) ---- */
.chat-footer-bar {
    flex-shrink: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0.85rem 1.25rem;
}
.chat-reply-form {
    display: flex;
    align-items: flex-end;
    gap: 0.65rem;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.chat-reply-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,148,136,0.12);
}
.chat-reply-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--text-primary);
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    padding: 0.25rem 0;
    overflow-y: auto;
}
.chat-reply-input::placeholder { color: var(--text-muted); }

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-darker), var(--primary));
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(13,148,136,0.3);
}
.chat-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(13,148,136,0.4);
}
.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---- Closed Banner ---- */
.chat-closed-banner {
    flex-shrink: 0;
    background: #f1f5f9;
    border-top: 1px solid var(--border);
    padding: 0.9rem 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* ---- Close-ticket action row ---- */
.chat-close-action {
    flex-shrink: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0.6rem 1.25rem;
    display: flex;
    justify-content: flex-end;
}

/* ---- Chat Bubble overrides (minor layout tweaks) ---- */
.chat-body .chat-msg-wrap {
    width: 100%;
    margin-bottom: 1.2rem;
    animation: fadeInUp 0.2s ease both;
}


/* ============================================
   404 PAGE
   ============================================ */
.page-404 {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(13,148,136,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(212,175,55,0.06) 0%, transparent 50%);
}
.page-404-inner {
    text-align: center;
    max-width: 520px;
}
.page-404-code {
    font-size: clamp(6rem, 18vw, 10rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary) 50%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse404 3s ease-in-out infinite;
    margin-bottom: 0;
}
@keyframes pulse404 {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.8; }
}
.page-404-icon {
    font-size: 2.5rem;
    margin: 0.5rem 0 1rem;
    animation: bounce404 2s ease-in-out infinite;
}
@keyframes bounce404 {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}
.page-404-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}
.page-404-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
}
.page-404-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   PDF EXPORT OVERRIDES
   ============================================ */
body.pdf-export-mode #pdf-export-container {
    background: linear-gradient(to bottom, #43937f, #337664) !important;
    padding: 2rem !important;
    max-width: 800px !important;
    width: 800px !important;
    margin: 0 auto !important;
}
body.pdf-export-mode .result-section,
body.pdf-export-mode .result-card,
body.pdf-export-mode .p-4,
body.pdf-export-mode .p-md-5,
body.pdf-export-mode .p-lg-5 {
    page-break-inside: avoid !important;
}
body.pdf-export-mode .btn,
body.pdf-export-mode .sticky-top {
    display: none !important;
}

.voucher-code-input::placeholder { color: rgba(255,255,255,0.5); }
