/* ── Base ── */
html { font-size: 17px; }
body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: #F8FAFC;
    color: #111827;
    margin: 0;
    font-size: 1rem;
    line-height: 1.55;
}
.page-wrapper { min-height: 100vh; }

/* Bump tables since dbc.Table size="sm" reduces them */
.table { font-size: 0.95rem; }
.table.table-sm { font-size: 0.92rem; }
.table.table-sm td, .table.table-sm th { padding: 0.45rem 0.6rem; }

/* ── App layout: sidebar + main column ── */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: #F8FAFC;
}
.main-column {
    flex: 1;
    min-width: 0;              /* allow flex child to shrink below content width */
    display: flex;
    flex-direction: column;
}

/* ── Sidebar ── */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #0F4C81;
    color: #fff;
    padding: 18px 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 6px rgba(0,0,0,0.10);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 0 20px 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    gap: 10px;
}
.sidebar-logo { font-size: 1.7rem; }
.sidebar-brand-text {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.3px;
}
.sidebar-section {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.7px;
    opacity: 0.7;
    padding: 8px 20px 4px 20px;
    font-weight: 600;
}
.sidebar-links { padding: 6px 8px; }
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    margin: 2px 0;
    border-radius: 6px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 0.92rem;
    transition: background 0.12s;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.10);
    color: #fff;
    text-decoration: none;
}
.sidebar-link.active {
    background: rgba(255,255,255,0.18);
    color: #fff;
    font-weight: 600;
}

/* ── Top bar ── */
.topbar {
    background: #fff;
    color: #111827;
    padding: 10px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #E5E7EB;
}
.topbar-context {
    font-size: 0.9rem;
    color: #6B7280;
    font-weight: 500;
}
.topbar-user {
    font-size: 0.92rem;
    color: #374151;
    margin-right: 12px;
}
.topbar-logout {
    background: #F1F5F9;
    color: #0F4C81 !important;
    border: 1px solid #CBD5E1;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
}
.topbar-logout:hover { background: #E2E8F0; }

/* ── Page content ── */
.page-content {
    padding: 22px 32px 40px 32px;
    max-width: 1500px;
    width: 100%;
    margin: 0 auto;
}

/* ── Page header (from pages/_ui.page_header) ── */
.page-title {
    color: #0F4C81;
    font-weight: 700;
    margin-bottom: 4px;
}
.page-subtitle {
    color: #6B7280;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

/* ── KPI cards (dashboard/ pages_dash style) ── */
.kpi-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-top: 4px solid #0F4C81;
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    height: 100%;
}
.kpi-label {
    font-size: 0.8rem;
    color: #6B7280;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0F4C81;
    margin-top: 4px;
    line-height: 1.15;
}
.kpi-delta {
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 4px;
}

/* ── Login ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #DCEAF8 0%, #F8FAFC 100%);
}
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 36px 42px;
    width: 440px;
    box-shadow: 0 8px 32px rgba(15,76,129,0.18);
    border: 1px solid #E5E7EB;
}
.login-logo  { font-size: 2.6rem; text-align: center; margin-bottom: 4px; }
.login-title {
    text-align: center;
    color: #0F4C81;
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 1.35rem;
}
.login-subtitle {
    text-align: center;
    color: #374151;
    font-size: 0.9rem;
    margin-bottom: 22px;
}
.login-card .form-label { font-weight: 600; font-size: 0.85rem; }

/* ── Headings ── */
h1 { color: #0F4C81; font-weight: 700; font-size: 1.6rem; }
h2 { color: #0F4C81; font-weight: 700; font-size: 1.3rem; }
h3 { color: #0F4C81; font-weight: 700; font-size: 1.15rem; }
h5.fw-semibold { color: #0F4C81; }

/* ── Heatmap legend chips ── */
.legend-chip {
    padding: 4px 10px;
    border-radius: 3px;
    color: #111827;
    font-weight: 500;
}

/* ── Cards ── */
.card { border: 1px solid #E5E7EB; }

/* ── Table header ── */
.table thead th {
    background: #F1F5F9;
    color: #0F4C81;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ── Chat bubbles (AI Assistant page) ── */
.chat-bubble-user, .chat-bubble-ai {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 14px;
    max-width: 78%;
    font-size: 0.93rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.chat-bubble-user {
    background: #0F4C81;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble-ai {
    background: #F1F5F9;
    color: #111827;
    border: 1px solid #E5E7EB;
    border-bottom-left-radius: 4px;
}

/* ── Hide browser's native password reveal button ── */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }
input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-textfield-decoration-container {
    visibility: hidden;
    display: none !important;
    pointer-events: none;
}

/* ── Password toggle button ── */
#login-pass-toggle {
    color: #6B7280;
    border-color: #D1D5DB;
    background: #fff;
}
#login-pass-toggle:hover,
#login-pass-toggle:focus {
    color: #0F4C81;
    background: #F1F5F9;
    border-color: #D1D5DB;
}
#login-pass-toggle i { font-size: 1.05rem; }

/* ── Small screens: collapse sidebar into a top bar ── */
@media (max-width: 900px) {
    .app-layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 10px 0;
    }
    .sidebar-links { display: flex; flex-wrap: wrap; }
    .sidebar-link { flex: 1 0 auto; }
    .page-content { padding: 16px; }
}
