/* TrackServe application styling */
html, body { height: 100%; overflow: hidden; }
.app-shell { height: 100vh; width: 100vw; display: flex; overflow: hidden; }
.sidebar { width: 220px; background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; flex: 0 0 220px; height: 100vh; position: sticky; top: 0; left: 0; z-index: 1000; overflow-y: auto; overflow-x: hidden; }
.brand { display: flex; align-items: center; gap: 9px; padding: 12px 14px 10px; border-bottom: 1px solid #edf0f4; flex-shrink: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(145deg,#0b4db8,#1e76df); color: white; display: grid; place-items: center; font-size: 13px; font-weight: 900; letter-spacing: -.05em; box-shadow: 0 4px 10px rgba(11,77,184,.22); flex-shrink: 0; }
.brand-name { font-size: 15px; font-weight: 900; line-height: 1.15; }
.brand-subtitle { color: var(--muted); font-size: 9px; margin-top: 1px; }
.side-nav { padding: 8px 8px; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 6px 10px; margin: 2px 0; border-radius: 7px; color: #34415b; font-size: 12px; font-weight: 600; line-height: 1.2; transition: all .12s ease; }
.nav-item:hover { background: #f3f6fb; color: var(--primary); }
.nav-item.active { background: var(--primary); color: white; box-shadow: 0 4px 10px rgba(11,77,184,.18); }
.nav-icon { width: 18px; text-align: center; font-size: 13px; flex-shrink: 0; }
.nav-section { margin: 10px 8px 3px; color: #8a94a7; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.sidebar-footer { border-top: 1px solid #edf0f4; padding: 8px 12px; font-size: 10px; font-weight: 700; flex-shrink: 0; background: #ffffff; }
.sidebar-footer .muted { font-size: 9px; font-weight: 500; margin-top: 1px; }
.version { margin-top: 4px; color: var(--primary); font-weight: 800; font-size: 9px; }

.main-area {
    min-width: 0;
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto !important;
    overflow-x: auto;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Mobile Left Nav Elements - hidden on desktop */
.mobile-nav-user-profile,
.mobile-nav-logout-section,
.sidebar-close-btn,
.sidebar-backdrop {
    display: none;
}

.topbar { height: 50px; background: var(--primary); color: white; display: flex; align-items: center; padding: 0 18px; gap: 14px; position: sticky; top: 0; z-index: 990; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.topbar-brand { display: flex; align-items: center; flex: 1; }
.topbar-logo { height: 34px; max-height: 36px; width: auto; object-fit: contain; display: block; filter: drop-shadow(1px 0 0 #ffffff) drop-shadow(-1px 0 0 #ffffff) drop-shadow(0 1px 0 #ffffff) drop-shadow(0 -1px 0 #ffffff) drop-shadow(0 0 3px rgba(255, 255, 255, 0.85)); transition: filter 0.2s ease, transform 0.2s ease; }
.topbar-logo:hover { filter: drop-shadow(1px 0 0 #ffffff) drop-shadow(-1px 0 0 #ffffff) drop-shadow(0 1px 0 #ffffff) drop-shadow(0 -1px 0 #ffffff) drop-shadow(0 0 6px rgba(255, 255, 255, 1)); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.notification { position: relative; font-size: 18px; cursor: pointer; }
.notification-dot { position: absolute; top: -5px; right: -7px; background: #ef4444; border: 2px solid var(--primary); border-radius: 50%; width: 15px; height: 15px; font-size: 8px; display: grid; place-items: center; }
.user-chip { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.14); padding: 3px 8px 3px 5px; border-radius: 20px; border: 1px solid rgba(255,255,255,.20); transition: all .15s ease; }
.user-chip:hover { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.35); }
.my-profile-btn { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.14); padding: 4px 10px 4px 6px; border-radius: 20px; border: 1px solid rgba(255,255,255,.22); color: white; cursor: pointer; transition: all .15s ease; outline: none; }
.my-profile-btn:hover { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.38); transform: translateY(-1px); }
.my-profile-btn:active { transform: translateY(0); }
.profile-menu-item:hover { background: #f1f5f9 !important; color: var(--primary) !important; }
.user-profile-link { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; cursor: pointer; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: white; color: var(--primary); display: grid; place-items: center; font-weight: 900; font-size: 12px; flex-shrink: 0; }
.user-chip-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 95px; }
.user-chip-text strong { font-size: 11px; color: #ffffff; }
.user-chip-text small { font-size: 9.5px; opacity: .82; color: #ffffff; }
.icon-button { border: 0; background: transparent; color: white; font-size: 16px; cursor: pointer; }
.mobile-menu { display: none; border: 0; background: transparent; color: white; font-size: 20px; }

.content-area { padding: 20px; max-width: 1800px; width: 100%; margin: 0 auto; flex: 1; }
.dashboard-header, .page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.dashboard-header h1, .page-heading h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.dashboard-header p, .page-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.date-label { color: #59657b; font-size: 12px; white-space: nowrap; }

.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.user-mgmt-stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { position: relative; min-height: 125px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(20,45,90,0.08); border-color: #bad3ff; }
.stat-icon { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); font-size: 18px; margin-bottom: 8px; }
.stat-content { display: flex; flex-direction: column; }
.stat-title { font-size: 11px; font-weight: 700; color: #647087; }
.stat-content strong { font-size: 22px; line-height: 1.2; color: #17233c; margin: 2px 0 1px 0; }
.stat-content small { font-size: 10px; color: var(--muted); }
.stat-link { font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; }

.dashboard-row { display: grid; gap: 14px; margin-bottom: 14px; }
.charts-row { grid-template-columns: 1fr 1.35fr; }
.bottom-row { grid-template-columns: 1fr 280px; }
.card-heading { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #edf0f4; flex-wrap: wrap; gap: 8px; }
.card-heading h2 { margin: 0; font-size: 13px; font-weight: 800; }
.card-heading span { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.province-layout { padding: 12px 14px; display: grid; grid-template-columns: 190px 1fr; gap: 14px; align-items: center; min-height: 280px; }
.province-map-wrap { background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%); border: 1px solid #e2eaf4; border-radius: 10px; padding: 8px; display: flex; align-items: center; justify-content: center; overflow: visible; position: relative; box-shadow: inset 0 1px 3px rgba(0,0,0,0.03); }
.map-image-wrapper { position: relative; width: 100%; max-width: 175px; display: inline-block; line-height: 0; }
.aurora-map-img { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,0.08); border: 1px solid #e2e8f0; }
.map-hotspot { position: absolute; transform: translate(-50%, -50%); z-index: 10; cursor: pointer; outline: none; display: flex; align-items: center; justify-content: center; }
.name-pulse-wrap { position: absolute; inset: 0; border-radius: 6px; border: 1.5px solid transparent; transition: all 0.2s ease; pointer-events: none; }
.name-pulse-ring { position: absolute; inset: -3px; border-radius: 8px; border: 2px solid currentColor; opacity: 0; pointer-events: none; }
.map-hotspot:hover .name-pulse-wrap, .map-hotspot.active .name-pulse-wrap { border-color: currentColor; background: rgba(255, 255, 255, 0.45); box-shadow: 0 0 10px currentColor, inset 0 0 6px currentColor; }
.map-hotspot:hover .name-pulse-ring, .map-hotspot.active .name-pulse-ring { opacity: 1; animation: namePulseGlow 1.6s infinite ease-out; }
.hotspot-tooltip { position: absolute; bottom: 125%; left: 50%; transform: translateX(-50%) translateY(4px); background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(4px); color: #ffffff; padding: 4px 8px; border-radius: 6px; font-size: 10px; line-height: 1.25; white-space: nowrap; pointer-events: none; opacity: 0; visibility: hidden; transition: all 0.2s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.25); z-index: 50; }
.hotspot-tooltip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 4px solid transparent; border-top-color: rgba(15, 23, 42, 0.95); }
.hotspot-tooltip strong { display: block; font-size: 10.5px; color: #ffffff; }
.hotspot-tooltip span { color: #cbd5e1; font-size: 9.5px; font-weight: 600; }
.map-hotspot:hover .hotspot-tooltip, .map-hotspot.active .hotspot-tooltip { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
@keyframes namePulseGlow {
    0% { transform: scale(0.92); opacity: 0.95; box-shadow: 0 0 0 0 currentColor; }
    70% { transform: scale(1.28); opacity: 0; box-shadow: 0 0 12px 3px currentColor; }
    100% { transform: scale(1.32); opacity: 0; }
}
.province-list { display: flex; flex-direction: column; gap: 5.5px; flex: 1; justify-content: center; }
.province-item, .province-total { display: grid; grid-template-columns: 8px 1fr auto auto; gap: 7px; font-size: 11px; align-items: center; padding: 3px 6px; border-radius: 6px; transition: background 0.15s ease; cursor: pointer; }
.province-item:hover, .province-item.active { background: #f0f6ff; }
.province-bar-wrap { width: 45px; height: 5px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.province-bar-fill { height: 100%; background: #0b4db8; border-radius: 99px; transition: width 0.3s ease; }
.province-item strong, .province-total strong { font-size: 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #0b4db8; transition: transform 0.15s ease; }
.province-item:hover .dot { transform: scale(1.3); background: #093c90; }
.province-total { grid-template-columns: 1fr auto; border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px; font-weight: 800; }

/* Comparative Trend & Agency Fulfillment */
.trend-card { overflow: hidden; display: flex; flex-direction: column; }
.trend-controls-bar { padding: 10px 14px; background: #fafcff; border-bottom: 1px solid #edf0f4; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.month-pills-wrap { display: flex; gap: 4px; overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
.month-pill { border: 1px solid #dce4ed; background: white; color: #5a6882; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.month-pill:hover { background: #f0f4f9; border-color: #cbd5e1; }
.month-pill.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 1px 3px rgba(11,77,184,0.25); }
.trend-kpi-row { display: flex; gap: 8px; align-items: center; }
.trend-kpi-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; border: 1px solid transparent; }
.trend-kpi-referred { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.trend-kpi-served { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.trend-kpi-rate { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }

.comparative-chart-wrap { padding: 12px 14px 6px; position: relative; }
.comparative-svg { width: 100%; height: 165px; }
.chart-bars-group { display: flex; justify-content: space-between; height: 135px; align-items: flex-end; padding: 0 6px 6px; border-bottom: 1px solid #dfe5ee; }
.month-bar-pair { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; position: relative; }
.bars-dual { display: flex; gap: 2px; align-items: flex-end; height: 110px; width: 100%; justify-content: center; }
.bar-col { width: 8px; border-radius: 3px 3px 0 0; transition: height 0.3s ease; position: relative; }
.bar-col.referred { background: #f59e0b; }
.bar-col.served { background: #10b981; }
.month-label { font-size: 9px; font-weight: 700; color: #8791a4; }
.month-bar-pair.current .month-label { color: var(--primary); font-weight: 900; }

.agency-fulfillment-list { display: flex; flex-direction: column; gap: 7px; padding: 10px 14px; max-height: 185px; overflow-y: auto; }
.agency-perf-row { display: grid; grid-template-columns: 85px 1fr 45px 45px 42px; gap: 8px; align-items: center; font-size: 10.5px; padding: 4px 6px; border-radius: 6px; background: #f8fafc; border: 1px solid #eef2f6; }
.agency-badge-pill { font-weight: 800; font-size: 9.5px; padding: 2px 6px; border-radius: 4px; background: #eef4ff; color: #0b4db8; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dual-progress-bar { height: 6px; background: #e2e8f0; border-radius: 99px; overflow: hidden; display: flex; }
.dual-bar-served { height: 100%; background: #10b981; }
.dual-bar-referred { height: 100%; background: #f59e0b; }

/* Demand Matrix Table */
.demand-table-card { overflow: hidden; }
.demand-toolbar { padding: 10px 14px; background: #fafcff; border-bottom: 1px solid #edf0f4; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.demand-search-input { min-width: 180px; flex: 1; font-size: 11px; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px; }
.demand-select-filter { font-size: 11px; padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px; background: white; }
.demand-table-wrap { overflow-x: auto; max-height: 380px; }
.demand-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.demand-table th { background: #f8fafc; color: #475569; font-weight: 800; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; padding: 9px 12px; border-bottom: 1px solid #e2e8f0; text-align: left; position: sticky; top: 0; z-index: 2; }
.demand-table td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; color: #1e293b; }
.demand-table tr:hover td { background: #f8fbff; }
.demand-count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; padding: 2px 7px; border-radius: 12px; font-weight: 800; font-size: 11px; background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.demand-rate-bar-wrap { width: 60px; height: 5px; background: #e2e8f0; border-radius: 99px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px; }
.demand-rate-bar-fill { height: 100%; background: #10b981; border-radius: 99px; }

/* Printable Slips Quick Actions */
.print-slips-card { overflow: hidden; }
.print-actions-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.print-slip-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 9px; border: 1px solid #e2e8f0; background: white; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.print-slip-row:hover { border-color: #93c5fd; background: #f8fbff; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(11,77,184,0.08); }
.print-slip-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.print-slip-btn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; border: 1px solid #e2e8f0; background: white; text-decoration: none; color: #1e293b; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.print-slip-btn:hover { border-color: #93c5fd; background: #f8fbff; transform: translateY(-1px); box-shadow: 0 3px 8px rgba(11,77,184,0.08); }
.print-slip-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; flex-shrink: 0; }
.print-slip-info { flex: 1; min-width: 0; }
.print-slip-title { font-size: 11.5px; font-weight: 800; display: block; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.print-slip-desc { font-size: 10px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.print-slip-actions { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }
.btn-doc-pill { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; font-size: 9.5px; font-weight: 700; padding: 3px 7px; border-radius: 5px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; transition: all 0.15s ease; text-decoration: none; }
.btn-doc-pill:hover { background: #1d4ed8; color: #ffffff; border-color: #1d4ed8; }
.btn-print-pill { background: #f8fafc; color: #475569; border: 1px solid #cbd5e1; font-size: 9.5px; font-weight: 700; padding: 3px 7px; border-radius: 5px; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; transition: all 0.15s ease; text-decoration: none; }
.btn-print-pill:hover { background: #0f172a; color: #ffffff; border-color: #0f172a; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0 !important; border-radius: 6px; font-size: 13px; cursor: pointer; flex-shrink: 0; }
.print-tag { font-size: 9px; font-weight: 800; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.03em; }

.quick-actions { padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.quick-action { border: 1px solid var(--border); border-radius: 9px; padding: 10px; color: #35415a; display: flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 700; }
.quick-action:hover { border-color: #b8c9e4; background: #f9fbff; }
.quick-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: white; font-weight: 900; }
.quick-icon.green { background:#27a653; } .quick-icon.orange { background:#e89a00; } .quick-icon.purple { background:#7850c8; } .quick-icon.blue { background:#1965d8; } .quick-icon.cyan { background:#1d9db7; }
.dashboard-footer { text-align: center; color: #8b95a6; font-size: 10px; padding: 4px 0 10px; }
.placeholder-card { min-height: 340px; display: grid; place-items: center; text-align: center; padding: 50px; }
.placeholder-icon { width: 68px; height: 68px; border-radius: 18px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 900; font-size: 20px; margin: auto; }

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    background: #f7f9fc;
}
.auth-visual { background: linear-gradient(135deg,#063985,#0b4db8 55%,#1d72d5); position: relative; overflow: hidden; }
.auth-visual::after { content:""; position:absolute; width: 600px; height:600px; border: 90px solid rgba(255,255,255,.08); border-radius:50%; right:-250px; bottom:-250px; }
.auth-visual-overlay { position: absolute; inset: 0; padding: 10%; color: white; display:flex; flex-direction:column; justify-content:center; max-width: 680px; }
.auth-brand-large { font-size: clamp(38px, 4vw, 54px); font-weight: 950; letter-spacing: -.05em; }
.auth-visual-overlay p { font-size: clamp(14px, 1.4vw, 17px); line-height: 1.6; opacity: .88; margin-top: 10px; }
.auth-points { display:flex; flex-direction:column; gap:10px; margin-top: 20px; font-weight:700; font-size: clamp(12.5px, 1.1vw, 14px); }

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2vh, 28px) clamp(16px, 2.5vw, 32px);
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100dvh;
    box-sizing: border-box;
    overflow: hidden;
}
.auth-card {
    width: min(430px, 100%);
    max-height: calc(100dvh - clamp(16px, 3vh, 40px));
    overflow-y: auto;
    overflow-x: hidden;
    padding: clamp(4px, 1vh, 12px) clamp(6px, 1vw, 12px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.auth-card::-webkit-scrollbar { width: 5px; }
.auth-card::-webkit-scrollbar-track { background: transparent; }
.auth-card::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; }
.auth-card::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.auth-card h1 { margin: clamp(6px, 1.4vh, 16px) 0 clamp(2px, 0.5vh, 4px); font-size: clamp(21px, 2.4vw, 26px); font-weight: 800; color: #0f172a; }
.auth-subtitle { color: var(--muted); margin: 0 0 clamp(10px, 1.6vh, 18px); font-size: clamp(12px, 1.2vw, 13px); }
.stack-form { display: flex; flex-direction: column; gap: clamp(8px, 1.4vh, 14px); }
.check-row { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: #59657b; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: clamp(10px, 1.6vh, 16px) 0; color: #8a94a7; font-size: 11px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.privacy-note { font-size: 10px; line-height: 1.45; color: #7a8496; margin-top: clamp(8px, 1.4vh, 14px); text-align: center; }
.auth-version { text-align: center; color: var(--primary); font-size: 10.5px; font-weight: 800; margin-top: clamp(8px, 1.2vh, 14px); }
.mobile-brand { display: none; }

.register-page, .policy-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(6px, 1.5vh, 20px) clamp(10px, 1.8vw, 20px);
    box-sizing: border-box;
    background: #f7f9fc;
}
.register-card, .policy-card {
    width: min(720px, 100%);
    max-height: calc(100dvh - clamp(12px, 2.8vh, 36px));
    background: white;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    border-radius: 14px;
    padding: clamp(14px, 2.2vh, 26px) clamp(16px, 2.2vw, 30px);
    margin: auto;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
.register-card::-webkit-scrollbar, .policy-card::-webkit-scrollbar { width: 5px; }
.register-card::-webkit-scrollbar-track, .policy-card::-webkit-scrollbar-track { background: transparent; }
.register-card::-webkit-scrollbar-thumb, .policy-card::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 5px; }
.register-card::-webkit-scrollbar-thumb:hover, .policy-card::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.register-heading { display: flex; gap: 12px; align-items: center; margin-bottom: clamp(10px, 1.6vh, 16px); }
.register-heading .brand-mark { width: clamp(34px, 4.2vh, 40px); height: clamp(34px, 4.2vh, 40px); font-size: clamp(13px, 1.6vh, 15px); border-radius: 9px; flex-shrink: 0; }
.register-heading h1 { margin: 0 0 2px; font-size: clamp(18px, 2.1vw, 21px); font-weight: 800; color: #0f172a; }
.register-heading p { margin: 0; color: var(--muted); font-size: clamp(11px, 1.1vw, 12px); }

.register-card .form-grid { gap: clamp(6px, 1.2vh, 11px) 14px; }
.register-card .form-field { gap: 3px; }
.register-card .form-field label { font-size: 11px; font-weight: 700; color: #334155; margin-bottom: 1px; }
.register-card .input { padding: clamp(5px, 0.9vh, 8px) 10px; font-size: 12.5px; border-radius: 6px; }

.privacy-consent { margin-top: clamp(6px, 1.2vh, 12px); display: flex; gap: 8px; align-items: flex-start; font-size: 11px; color: #566178; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: clamp(8px, 1.5vh, 16px); }
.form-actions .btn { padding: clamp(6px, 1.1vh, 9px) 16px; font-size: 12.5px; }
.policy-card h1 { font-size: 26px; margin-top: 14px; }
.policy-card h2 { font-size: 15px; margin-top: 20px; }
.policy-card p { color: #5d687d; line-height: 1.65; font-size: 12.5px; }
.login-footer { position: fixed; bottom: 6px; left: 0; right: 0; text-align: center; color: #98a1b0; font-size: 10px; pointer-events: none; z-index: 10; }
.register-page ~ .login-footer { display: none; }

@media (max-width: 1200px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .bottom-row { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    /* Hide topbar user profile menu container in mobile view */
    .topbar .user-profile-menu-container {
        display: none !important;
    }

    /* Mobile Navigation Drawer */
    .sidebar {
        position: fixed !important;
        left: -290px !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 285px !important;
        flex: 0 0 285px !important;
        height: 100vh !important;
        z-index: 2100 !important;
        box-shadow: none !important;
        transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        background: #ffffff !important;
    }

    .sidebar.open {
        left: 0 !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35) !important;
    }

    .sidebar-backdrop {
        display: block !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(15, 23, 42, 0.6) !important;
        backdrop-filter: blur(3px) !important;
        -webkit-backdrop-filter: blur(3px) !important;
        z-index: 2050 !important;
        animation: mobileBackdropFadeIn 0.2s ease-out !important;
    }

    .sidebar-close-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-left: auto !important;
        width: 28px !important;
        height: 28px !important;
        border-radius: 6px !important;
        background: #f1f5f9 !important;
        color: #475569 !important;
        border: 1px solid #e2e8f0 !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        cursor: pointer !important;
        transition: background 0.15s ease, color 0.15s ease !important;
    }

    .sidebar-close-btn:hover {
        background: #fee2e2 !important;
        color: #dc2626 !important;
        border-color: #fca5a5 !important;
    }

    /* Inside Left Nav: Mobile User Profile */
    .mobile-nav-user-profile {
        display: block !important;
        padding: 12px 14px !important;
        background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%) !important;
        border-bottom: 1px solid #e2e8f0 !important;
        flex-shrink: 0 !important;
    }

    .mobile-nav-user-card {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        margin-bottom: 9px !important;
    }

    .mobile-nav-avatar-wrap {
        position: relative !important;
        flex-shrink: 0 !important;
    }

    .mobile-nav-avatar {
        width: 38px !important;
        height: 38px !important;
        border-radius: 50% !important;
        object-fit: cover !important;
        border: 2px solid #0b4db8 !important;
        box-shadow: 0 2px 6px rgba(11, 77, 184, 0.2) !important;
    }

    .mobile-nav-avatar-initials {
        width: 38px !important;
        height: 38px !important;
        border-radius: 50% !important;
        background: linear-gradient(135deg, #0b4db8, #2563eb) !important;
        color: #ffffff !important;
        display: grid !important;
        place-items: center !important;
        font-size: 13.5px !important;
        font-weight: 800 !important;
        border: 2px solid #ffffff !important;
        box-shadow: 0 2px 6px rgba(11, 77, 184, 0.2) !important;
    }

    .mobile-nav-user-details {
        min-width: 0 !important;
        flex: 1 !important;
    }

    .mobile-nav-user-name {
        font-weight: 800 !important;
        font-size: 13px !important;
        color: #0f172a !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.25 !important;
    }

    .mobile-nav-user-meta {
        display: flex !important;
        align-items: center !important;
        gap: 5px !important;
        margin-top: 3px !important;
        flex-wrap: wrap !important;
    }

    .mobile-nav-office-badge {
        font-size: 9.5px !important;
        color: #64748b !important;
        font-weight: 600 !important;
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        padding: 1px 6px !important;
        border-radius: 4px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 130px !important;
    }

    .mobile-nav-profile-actions {
        display: flex !important;
        gap: 6px !important;
    }

    .mobile-nav-action-btn {
        flex: 1 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 5px !important;
        padding: 5px 8px !important;
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 6px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: #334155 !important;
        text-decoration: none !important;
        cursor: pointer !important;
        transition: all 0.15s ease !important;
    }

    .mobile-nav-action-btn:hover {
        background: #eff6ff !important;
        color: #0b4db8 !important;
        border-color: #93c5fd !important;
    }

    /* Inside Left Nav: Dedicated Logout Section at Bottom */
    .mobile-nav-logout-section {
        display: block !important;
        padding: 10px 12px !important;
        background: #ffffff !important;
        border-top: 1px solid #e2e8f0 !important;
        flex-shrink: 0 !important;
    }

    .mobile-nav-logout-btn {
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        padding: 9px 14px !important;
        background: #fee2e2 !important;
        color: #b91c1c !important;
        border: 1px solid #fca5a5 !important;
        border-radius: 8px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        cursor: pointer !important;
        transition: all 0.15s ease !important;
    }

    .mobile-nav-logout-btn:hover {
        background: #fecaca !important;
        color: #991b1b !important;
        border-color: #f87171 !important;
    }

    .mobile-menu {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 32px !important;
        height: 32px !important;
        border-radius: 6px !important;
        background: rgba(255, 255, 255, 0.15) !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        color: #ffffff !important;
        font-size: 18px !important;
        cursor: pointer !important;
        transition: background 0.15s ease !important;
    }

    .mobile-menu:hover {
        background: rgba(255, 255, 255, 0.25) !important;
    }

    .topbar { padding:0 14px; }
    .topbar-title { font-size:14px; }
    .agency-selector, .user-chip-text { display:none; }
    .content-area { padding:14px 12px; }
    .stat-grid { grid-template-columns: repeat(2,1fr); }
    .charts-row, .bottom-row { grid-template-columns:1fr; }
    .auth-page { grid-template-columns:1fr; }
    .auth-visual { display:none; }
    .mobile-brand { display:grid; place-items:center; width:45px; height:45px; border-radius:12px; background:var(--primary); color:white; font-weight:900; }

    /* Module Headers & Actions Stacked on Mobile */
    .page-header,
    .page-heading,
    .dashboard-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .header-actions,
    .heading-actions,
    .referrals-header-actions {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .header-actions .btn,
    .heading-actions .btn,
    .referrals-header-actions .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Filters and Search Fields Vertically Stacked with Full Width */
    .filter-card,
    .filter-card .card-body {
        padding: 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .filter-row-horizontal,
    .filter-controls-horizontal,
    .filter-toolbar,
    .filter-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 8px !important;
    }

    .filter-row-horizontal .search-box,
    .filter-controls-horizontal .search-box,
    .search-box,
    .search-input-wrap,
    .sidebar-agency-search {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        box-sizing: border-box !important;
    }

    .filter-row-horizontal .search-input,
    .filter-controls-horizontal .search-input,
    .filter-controls-horizontal .select-input,
    .search-box input,
    .search-input,
    .select-input,
    .sidebar-search-input,
    .filter-card select,
    .filter-card input,
    .filter-controls-horizontal select,
    .filter-controls-horizontal .btn,
    .demand-search-input,
    .demand-select-filter,
    .view-mode-toggle {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .view-mode-toggle {
        display: flex !important;
        width: 100% !important;
    }

    .view-mode-toggle .view-mode-btn {
        flex: 1 !important;
        justify-content: center !important;
    }

    .reports-module-hub {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 8px !important;
        overflow: visible !important;
        white-space: normal !important;
        padding: 10px 12px !important;
        box-sizing: border-box !important;
    }

    .reports-module-hub .module-hub-label {
        width: 100% !important;
        margin-bottom: 2px !important;
        font-size: 11.5px !important;
    }

    .reports-module-hub .module-hub-chip {
        display: flex !important;
        width: 100% !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 9px 12px !important;
        font-size: 12.5px !important;
        box-sizing: border-box !important;
        border-radius: 8px !important;
    }

    .reports-module-hub .module-hub-chip .chip-count {
        margin-left: auto !important;
    }

    /* User Management Mobile Responsiveness */
    .user-profile-overview-card {
        padding: 12px !important;
    }

    .user-profile-overview-card .user-profile-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .user-profile-overview-card .user-profile-actions {
        width: 100% !important;
    }

    .user-profile-overview-card .user-profile-actions button {
        width: 100% !important;
        justify-content: center !important;
        padding: 8px 14px !important;
    }

    .user-mgmt-main-tabs {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 6px !important;
        border-bottom: none !important;
        margin-bottom: 14px !important;
    }

    .user-mgmt-main-tabs button {
        width: 100% !important;
        justify-content: space-between !important;
        padding: 9px 12px !important;
        box-sizing: border-box !important;
    }

    .user-status-tabs {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 6px !important;
    }

    .user-status-tabs button {
        width: 100% !important;
        justify-content: center !important;
    }

    /* User Management Summary Cards (2 cols on tablet/mobile, 1 col on narrow phone, full text visible) */
    .user-mgmt-stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

    .user-mgmt-stats-grid .stat-card {
        height: auto !important;
        min-height: 56px !important;
        padding: 8px 10px !important;
        gap: 8px !important;
        box-sizing: border-box !important;
    }

    .user-mgmt-stats-grid .stat-card .stat-icon {
        width: 28px !important;
        height: 28px !important;
        font-size: 13px !important;
        border-radius: 6px !important;
        flex-shrink: 0 !important;
    }

    .user-mgmt-stats-grid .stat-card .stat-content {
        min-width: 0 !important;
        flex: 1 !important;
        overflow: hidden !important;
    }

    .user-mgmt-stats-grid .stat-card .stat-title {
        font-size: 9px !important;
        line-height: 1.15 !important;
        white-space: normal !important;
    }

    .user-mgmt-stats-grid .stat-card strong {
        font-size: 15px !important;
        line-height: 1.15 !important;
        margin: 0 !important;
    }

    .user-mgmt-stats-grid .stat-card small {
        font-size: 8.5px !important;
        line-height: 1.15 !important;
        white-space: normal !important;
    }
}

@media (max-width: 480px) {
    .user-mgmt-stats-grid {
        grid-template-columns: 1fr !important;
    }
}

@keyframes mobileBackdropFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 600px) {
    .stat-grid { grid-template-columns:1fr; }
    .dashboard-header { align-items:flex-start; flex-direction:column; }
    .dashboard-header h1, .page-heading h1 { font-size:20px; }
    .province-layout { grid-template-columns:1fr; }
    .province-map-wrap { max-height: 200px; }
    .topbar-actions { gap:8px; }
    .register-card, .policy-card { padding:22px; }
    .form-actions { flex-direction:column-reverse; }
    .form-actions .btn { width:100%; }
}

.privacy-link-button { border:0; background:transparent; padding:0; color:var(--primary); font-weight:800; font-size:inherit; cursor:pointer; }
.forgot-password-link { display:inline-block; border:0; background:transparent; padding:4px 8px; color:#64748b; font-size:12px; font-weight:600; cursor:pointer; text-decoration:underline; text-underline-offset:3px; transition:color 0.2s ease, opacity 0.2s ease; border-radius:4px; }
.forgot-password-link:hover { color:var(--primary); opacity:0.95; }
.forgot-password-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.modal-backdrop { position:fixed; inset:0; z-index:2000; background:rgba(10,24,48,.65); backdrop-filter: blur(4px); display:grid; place-items:center; padding:20px; }
.privacy-modal { width:min(680px,100%); max-height:min(760px,90vh); overflow:hidden; background:white; border-radius:16px; box-shadow:0 25px 70px rgba(0,0,0,.25); display:flex; flex-direction:column; z-index:2001; }
.modal-header { padding:18px 20px; display:flex; justify-content:space-between; align-items:flex-start; border-bottom:1px solid var(--border); }
.modal-eyebrow { color:var(--primary); font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:.08em; }
.modal-header h2 { margin:3px 0 0; font-size:20px; }
.icon-button.dark { color:#34415b; font-size:24px; }
.modal-tabs { display:flex; gap:4px; padding:8px 12px 0; border-bottom:1px solid var(--border); }
.modal-tabs button { border:0; background:transparent; padding:9px 12px; color:#7b8495; font-weight:800; border-bottom:2px solid transparent; }
.modal-tabs button.active { color:var(--primary); border-bottom-color:var(--primary); }
.modal-body { padding:20px; overflow:auto; }
.modal-body h3 { font-size:14px; margin:0 0 6px; }
.modal-body p { color:#5d687d; line-height:1.65; font-size:13px; margin:0 0 18px; }
.modal-footer { padding:14px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; }

/* Slim Top Navigation Loading Bar */
.nav-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #60a5fa, #3b82f6, #f59e0b, #10b981);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, width 0.3s ease;
}

.nav-loading-bar.is-active {
    opacity: 1;
    width: 85%;
    animation: navProgressPulse 1.5s infinite ease-in-out;
}

@keyframes navProgressPulse {
    0% { width: 20%; }
    50% { width: 78%; }
    100% { width: 93%; }
}

/* Page content smooth entrance */
.content-area {
    animation: fadeInPage 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInPage {
    from { opacity: 0.75; transform: translateY(2px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   ANIMATED PASSWORD STRENGTH & MATCH INDICATOR
   ========================================================= */
.password-strength-wrap,
.password-match-wrap {
    min-height: 24px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    box-sizing: border-box;
}

.password-strength-track {
    display: flex;
    gap: 4px;
    height: 4px;
    width: 100%;
}

.password-strength-segment {
    flex: 1;
    height: 100%;
    background: #e2e8f0;
    border-radius: 9999px;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.password-strength-wrap.idle .password-strength-segment {
    background: #edf2f7;
}

.password-strength-segment.active.strength-very-weak {
    background-color: #ef4444; /* Red (25%) */
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.35);
}

.password-strength-segment.active.strength-weak-fair {
    background-color: #f97316; /* Orange (50%) */
    box-shadow: 0 0 5px rgba(249, 115, 22, 0.35);
}

.password-strength-segment.active.strength-good {
    background-color: #3b82f6; /* Blue/Yellow (75%) */
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.35);
}

.password-strength-segment.active.strength-strong {
    background-color: #10b981; /* Green (100%) */
    box-shadow: 0 0 5px rgba(16, 185, 129, 0.35);
}

.password-strength-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    line-height: 1.2;
}

.password-strength-label {
    font-weight: 700;
    transition: color 0.3s ease;
}

.password-strength-wrap.idle .password-strength-label,
.password-strength-wrap.idle .password-strength-desc {
    color: #94a3b8;
    font-weight: 500;
}

.password-strength-label.strength-very-weak { color: #ef4444; }
.password-strength-label.strength-weak-fair { color: #ea580c; }
.password-strength-label.strength-good { color: #2563eb; }
.password-strength-label.strength-strong { color: #059669; }

.password-strength-desc {
    font-size: 10px;
    color: #64748b;
}

.password-match-status {
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.password-match-status.match-idle {
    color: #94a3b8;
    font-weight: 500;
}
.password-match-status.match-ok {
    color: #059669;
}
.password-match-status.match-error {
    color: #dc2626;
}

@media (max-height: 720px) {
    .register-page, .policy-page { padding: 6px 12px; }
    .register-card, .policy-card { padding: 12px 18px; border-radius: 12px; }
    .register-heading { margin-bottom: 8px; }
    .register-heading h1 { font-size: 17px; }
    .register-card .form-grid { gap: 5px 12px; }
    .register-card .input { padding: 5px 9px; font-size: 12px; }
    .register-card .form-actions { margin-top: 8px; }
    .register-card .form-actions .btn { padding: 5px 14px; font-size: 12px; }
    .auth-panel { padding: 8px 14px; }
    .auth-card h1 { font-size: 19px; margin: 4px 0 2px; }
    .auth-subtitle { margin-bottom: 8px; font-size: 11.5px; }
    .stack-form { gap: 7px; }
    .auth-divider { margin: 6px 0; }
    .privacy-note { margin-top: 6px; }
}

/* Role & Status Badge Utilities */
.badge-purple {
    background: #f3e8ff;
    color: #7e22ce;
    border: 1px solid #d8b4fe;
}

.badge-teal {
    background: #f0fdfa;
    color: #0f766e;
    border: 1px solid #99f6e4;
}

.badge-primary {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}


