:root { --tcas-navy: #12263f; --tcas-navy-2: #1b3a5c; --tcas-teal: #0f7c7c; --tcas-line: #e2e8f0; --tcas-muted: #5b6b7f; }

/* Sign-in pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(145deg, var(--tcas-navy), var(--tcas-navy-2) 60%, var(--tcas-teal)); }
.auth-box { width: 100%; max-width: 420px; }
.auth-box .card { border: 0; border-radius: 12px; box-shadow: 0 16px 40px rgba(6, 20, 38, .35) !important; }
.auth-brand { text-align: center; margin-bottom: 18px; color: #fff; }
.auth-brand strong { display: block; font-size: 1.75rem; letter-spacing: .1em; }
.auth-brand span { display: block; font-size: .875rem; color: #d3deea; }
.auth-brand small { display: block; font-size: .75rem; color: #a9bbcd; margin-top: 2px; }
.auth-brand .auth-mark, .brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 12px; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.35rem; }
.auth-note { text-align: center; font-size: .75rem; color: #d3deea; margin-top: 14px; }
.code-input { font-size: 1.25rem; letter-spacing: .2em; text-align: center; }
.qr-image { width: 200px; height: 200px; image-rendering: pixelated; }
.secret-key code { font-size: .875rem; white-space: nowrap; color: var(--tcas-navy-2); }

/* Password eye */
.password-field { position: relative; }
.password-field .form-control { padding-right: 42px; }
.password-eye { position: absolute; top: 0; right: 0; width: 42px; height: 100%; border: 0; background: none; color: var(--tcas-muted); }
.password-eye:hover { color: var(--tcas-navy-2); }
.password-eye:focus-visible { outline: 2px solid var(--tcas-teal); outline-offset: -2px; border-radius: 6px; }

/* App shell */
.app-sidebar { background: var(--tcas-navy) !important; }
.sidebar-brand { border-bottom: 1px solid rgba(255, 255, 255, .1) !important; }
.sidebar-brand .brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; margin: 0; border-radius: 8px; font-size: 1rem; background: var(--tcas-teal); }
.brand-text { color: #fff; letter-spacing: .08em; }
.sidebar-menu .nav-link.active { background: var(--tcas-teal) !important; color: #fff !important; }
.sidebar-menu .nav-header { font-size: .7rem; letter-spacing: .08em; opacity: .65; }
.app-main { background: #f4f6f9; }
.app-content-header h3 { color: var(--tcas-navy); font-weight: 600; }
.card { border-color: var(--tcas-line); border-radius: 10px; box-shadow: 0 1px 3px rgba(18, 38, 63, .06); }
.card-header { background: #fff; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--tcas-muted); background: #f8fafc; }
.btn-primary { --bs-btn-bg: var(--tcas-navy-2); --bs-btn-border-color: var(--tcas-navy-2); --bs-btn-hover-bg: var(--tcas-teal); --bs-btn-hover-border-color: var(--tcas-teal); --bs-btn-active-bg: var(--tcas-teal); --bs-btn-active-border-color: var(--tcas-teal); }
.form-control:focus, .form-select:focus { border-color: var(--tcas-teal); box-shadow: 0 0 0 3px rgba(15, 124, 124, .18); }
.small-box { border-radius: 10px; }
.small-box.text-bg-primary { background: var(--tcas-navy-2) !important; }
.small-box.text-bg-success, .small-box.text-bg-info { background: var(--tcas-teal) !important; color: #fff !important; }
.small-box.text-bg-secondary { background: #52667c !important; }

/* Map */
.tcas-map { height: calc(100vh - 250px); min-height: 420px; border-radius: 10px; border: 1px solid var(--tcas-line); background: #eef2f6; }
.map-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.map-toolbar .form-label { font-weight: 600; color: var(--tcas-navy); white-space: nowrap; }
.map-toolbar .form-select { max-width: 320px; }

.cell-path { max-width: 180px; }
.field-validation-error, .validation-summary-errors ul { margin-bottom: 0; }
.validation-summary-valid { display: none; }

/* Layer switches */
.map-wrap { position: relative; }
.layer-card { position: absolute; top: 12px; right: 12px; z-index: 1000; width: 230px; padding: 12px 14px; background: rgba(255, 255, 255, .96); border: 1px solid var(--tcas-line); border-radius: 12px; box-shadow: 0 8px 24px rgba(18, 38, 63, .16); }
.layer-card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tcas-muted); }
.layer-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; margin: 0; cursor: pointer; color: var(--tcas-navy); font-size: .875rem; font-weight: 500; }
.layer-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.layer-track { position: relative; flex: 0 0 38px; height: 22px; border-radius: 999px; background: #c9d3df; transition: background .18s ease; }
.layer-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(18, 38, 63, .3); transition: transform .18s ease; }
.layer-switch input:checked + .layer-track { background: var(--tcas-teal); }
.layer-switch input:checked + .layer-track::after { transform: translateX(16px); }
.layer-switch input:focus-visible + .layer-track { outline: 2px solid var(--tcas-navy-2); outline-offset: 2px; }
@media (max-width: 575px) { .layer-card { position: static; width: 100%; margin-top: 12px; } }
/* Mauza panel and legend */
.map-layout { display: flex; gap: 14px; align-items: stretch; }
.map-layout .map-wrap { flex: 1 1 auto; min-width: 0; }
.mauza-panel { flex: 0 0 370px; display: flex; flex-direction: column; height: calc(100vh - 250px); min-height: 480px; background: #fff; border: 1px solid var(--tcas-line); border-radius: 10px; overflow: hidden; }
.mauza-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--tcas-line); }
.mauza-head h2 { margin: 0; font-size: 1rem; font-weight: 600; color: var(--tcas-navy); }
.mauza-head span { font-size: .75rem; color: var(--tcas-muted); }
.mauza-sections { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.mauza-section { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.mauza-section + .mauza-section { border-top: 1px solid var(--tcas-line); }
.mauza-section-head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 12px; border: 0; color: #fff; font-size: .8125rem; font-weight: 600; text-align: left; }
.mauza-section-head:disabled { opacity: 1; cursor: default; }
.status-not-section .mauza-section-head { background: #a61b1b; }
.status-partial-section .mauza-section-head { background: #b97400; }
.status-full-section .mauza-section-head { background: #1a7a3e; }
.mauza-section-head.is-clickable:hover, .mauza-section-head.is-clickable:focus-visible { filter: brightness(1.12); outline: 0; }
.mauza-section-body { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.mauza-empty { padding: 10px 12px; font-size: .75rem; color: var(--tcas-muted); }
.mauza-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 12px; border: 0; border-bottom: 1px solid #eef2f6; background: #fff; color: var(--tcas-navy); font-size: .8125rem; text-align: left; }
.mauza-row:hover { background: #f1f6fa; }
.mauza-row:focus-visible { background: #e6f3f3; outline: 0; }
.mauza-row.is-selected { background: #fff4b8; box-shadow: inset 3px 0 0 #e0b100; font-weight: 600; }
.mauza-row.is-flash { animation: row-flash 1.2s ease-out; }
@keyframes row-flash { 0%, 40% { background: #ffd400; } 100% { background: #fff4b8; } }
@media (prefers-reduced-motion: reduce) { .mauza-row.is-flash { animation: none; } }
.m-name { min-width: 0; overflow-wrap: anywhere; }
.status-badge { flex: 0 0 auto; display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .6875rem; font-weight: 600; white-space: nowrap; }
.status-not { background: #fde8e8; color: #a61b1b; }
.status-partial { background: #fff1d6; color: #8a5a00; }
.status-full { background: #dcf3e3; color: #136c34; }
.mauza-stats { padding: 12px 14px; border-bottom: 1px solid var(--tcas-line); background: linear-gradient(135deg, #f4fbfb, #fff); }
.stats-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: var(--tcas-navy); font-size: .875rem; }
.stats-close { border: 0; background: none; padding: 2px 4px; color: var(--tcas-muted); font-size: .75rem; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 8px; background: #fff; border: 1px solid var(--tcas-line); border-radius: 8px; text-align: center; }
.stat-value { display: block; font-size: .9375rem; font-weight: 700; color: var(--tcas-navy); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-label { display: block; font-size: .6875rem; color: var(--tcas-muted); }
.stats-bar { height: 7px; margin-top: 10px; border-radius: 999px; background: #e3e9f0; overflow: hidden; }
.stats-bar span { display: block; height: 100%; border-radius: 999px; background: var(--tcas-teal); }
.stats-percent { margin-top: 4px; font-size: .75rem; color: var(--tcas-muted); text-align: right; }
.tcas-popup .leaflet-popup-content-wrapper { border-radius: 10px; }
.tcas-popup .leaflet-popup-content { margin: 12px 14px; }
.mauza-popup strong { display: block; margin-bottom: 4px; font-size: .9375rem; color: var(--tcas-navy); }
.mauza-popup dl { display: grid; grid-template-columns: 1fr auto; gap: 3px 16px; margin: 8px 0 0; font-size: .8125rem; }
.mauza-popup dt { font-weight: 400; color: var(--tcas-muted); }
.mauza-popup dd { margin: 0; font-weight: 700; color: var(--tcas-navy); text-align: right; font-variant-numeric: tabular-nums; }
.district-name { width: auto !important; height: auto !important; pointer-events: none; }
.district-name span { display: inline-block; transform: translate(-50%, -50%); white-space: nowrap; font-size: .875rem; font-weight: 700; color: #000; text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff; }
.search-select { position: relative; width: 320px; max-width: 100%; }
.search-select-toggle { text-align: left; }
.search-select-panel { position: absolute; z-index: 1100; top: calc(100% + 4px); left: 0; right: 0; padding: 8px; background: #fff; border: 1px solid var(--tcas-line); border-radius: 10px; box-shadow: 0 12px 28px rgba(18, 38, 63, .18); }
.search-select-input, .picker-search { position: relative; }
.search-select-input i, .picker-search i { position: absolute; top: 50%; left: 11px; transform: translateY(-50%); color: var(--tcas-muted); font-size: .8125rem; }
.search-select-input input, .picker-search input { padding-left: 32px; }
.search-select-list { max-height: 260px; margin-top: 6px; overflow-y: auto; }
.search-select-option { display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--tcas-navy); font-size: .875rem; text-align: left; }
.search-select-option:hover, .search-select-option:focus-visible { background: #eef6f6; outline: 0; }
.search-select-option.is-active { background: #d8efee; font-weight: 600; }
.search-select-empty { padding: 8px 10px; font-size: .8125rem; color: var(--tcas-muted); }
.layer-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.layer-check { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; margin: 0; border: 1px solid var(--tcas-line); border-radius: 8px; font-size: .875rem; cursor: pointer; }
.layer-check:has(input:checked) { border-color: var(--tcas-teal); background: #eaf6f6; }
.picker-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.picker-count { font-weight: 400; color: var(--tcas-muted); }
.area-tree { max-height: 360px; margin-top: 8px; padding: 6px; overflow-y: auto; border: 1px solid var(--tcas-line); border-radius: 8px; }
.area-tree details { margin: 0; }
.area-tree summary { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; list-style: none; }
.area-tree summary::-webkit-details-marker { display: none; }
.area-tree summary::before { content: "\F285"; font-family: "bootstrap-icons"; font-size: .6875rem; color: var(--tcas-muted); transition: transform .15s ease; }
.area-tree details[open] > summary::before { transform: rotate(90deg); }
.area-tree summary:hover { background: #f1f6fa; }
.area-province > summary { font-weight: 700; color: var(--tcas-navy); }
.area-division { margin-left: 18px; }
.area-division > summary { font-weight: 600; color: var(--tcas-navy-2); font-size: .875rem; }
.area-districts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 6px; margin: 2px 0 6px 40px; }
.area-count { margin-left: auto; font-size: .6875rem; font-weight: 500; color: var(--tcas-muted); }
.picker-item { display: flex; align-items: center; gap: 8px; padding: 5px 7px; margin: 0; border-radius: 6px; font-size: .8125rem; cursor: pointer; }
.picker-item:hover { background: #f1f6fa; }
.picker-item:has(input:checked) { background: #eaf6f6; font-weight: 600; }
.legend-box { position: absolute; right: 12px; bottom: 28px; z-index: 1000; width: 190px; max-height: calc(100% - 200px); overflow-y: auto; padding: 10px 12px; background: rgba(255, 255, 255, .96); border: 1px solid var(--tcas-line); border-radius: 10px; box-shadow: 0 8px 24px rgba(18, 38, 63, .16); }
.legend-group + .legend-group { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--tcas-line); }
.legend-title { margin-bottom: 4px; font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--tcas-muted); }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: .75rem; color: var(--tcas-navy); }
.legend-swatch { flex: 0 0 22px; height: 12px; border: 1px solid rgba(0, 0, 0, .18); border-radius: 2px; }
.legend-swatch.lg-boundary { height: 0; border: 0; border-top: 3px dashed #000; outline: 1px solid #000; outline-offset: 0; }
.legend-swatch.lg-mauza { height: 0; border: 0; border-top: 2px solid #c2185b; border-radius: 0; }
@media (max-width: 991px) { .map-layout { flex-direction: column-reverse; } .mauza-panel { flex: 0 0 auto; width: 100%; height: 520px; } }

/* Search dropdown */
.search-select { position: relative; width: 320px; max-width: 100%; }
.search-select .form-control { padding-right: 34px; }
.search-select > .bi-chevron-down { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: var(--tcas-muted); font-size: .75rem; pointer-events: none; }
.search-list { display: none; position: absolute; z-index: 1300; top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; margin: 0; padding: 4px; overflow-y: auto; list-style: none; background: #fff; border: 1px solid var(--tcas-line); border-radius: 8px; box-shadow: 0 10px 28px rgba(18, 38, 63, .18); }
.search-list li { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: .875rem; color: var(--tcas-navy); }
.search-list li:hover, .search-list li.is-active { background: #e6f3f3; }

/* Permission form */
.layer-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-chip { position: relative; margin: 0; cursor: pointer; }
.choice-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice-chip span { display: block; padding: 7px 12px; border: 1px solid var(--tcas-line); border-radius: 8px; background: #fff; color: var(--tcas-navy); font-size: .8125rem; transition: background .15s ease, border-color .15s ease; }
.choice-chip span:hover { border-color: var(--tcas-teal); }
.choice-chip input:checked + span { background: var(--tcas-teal); border-color: var(--tcas-teal); color: #fff; font-weight: 600; }
.choice-chip input:focus-visible + span { outline: 2px solid var(--tcas-navy-2); outline-offset: 2px; }
.district-picker { padding: 12px; background: #f8fafc; border: 1px solid var(--tcas-line); border-radius: 10px; }
.district-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.district-search { position: relative; flex: 1 1 220px; }
.district-search .bi-search { position: absolute; top: 50%; left: 11px; transform: translateY(-50%); color: var(--tcas-muted); font-size: .8125rem; }
.district-search .form-control { padding-left: 32px; }
.district-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; max-height: 300px; overflow-y: auto; padding-right: 4px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset legend.form-label { float: none; width: auto; margin-bottom: 8px; padding: 0; font-size: 1rem; font-weight: 400; }

/* Security switches */
.security-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; }
.security-switch + .security-switch { border-top: 1px solid var(--tcas-line); }
.security-switch strong { display: block; color: var(--tcas-navy); }
.security-switch span:not(.layer-track):not(.switch-text) { font-size: .8125rem; color: var(--tcas-muted); }
.switch-button { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px; font-weight: 600; color: var(--tcas-muted); }
.switch-button.is-on { color: var(--tcas-teal); }
.switch-button .layer-track { background: #c9d3df; }
.switch-button.is-on .layer-track { background: var(--tcas-teal); }
.switch-button.is-on .layer-track::after { transform: translateX(16px); }
.switch-button:focus-visible { outline: 2px solid var(--tcas-navy-2); outline-offset: 2px; border-radius: 6px; }

/* Mauza row figures and basemap switch */
.mauza-row .m-name { flex: 1 1 auto; }
.mauza-row .m-pop { flex: 0 0 auto; font-size: .75rem; color: var(--tcas-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.base-switch { display: flex; overflow: hidden; background: #fff; border: 1px solid var(--tcas-line); border-radius: 10px; box-shadow: 0 6px 18px rgba(18, 38, 63, .16); }
.base-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border: 0; background: #fff; color: var(--tcas-navy); font-size: .8125rem; font-weight: 600; }
.base-btn + .base-btn { border-left: 1px solid var(--tcas-line); }
.base-btn:hover { background: #f1f6fa; }
.base-btn.is-active { background: var(--tcas-teal); color: #fff; }
.base-btn:focus-visible { outline: 2px solid var(--tcas-navy-2); outline-offset: -2px; }
