:root {
    --color-primary: #0E9F6E;
    --color-primary-dark: #0a7d56;
    --color-surface: #ffffff;
    --color-muted: #6B7280;
    --color-border: #E5E7EB;
    --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background-color: #F5F6F8;
    color: #1F2933;
    min-height: 100%;
}

.app-loader {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    background: radial-gradient(circle at top, #ffffff 0%, #eef1f5 45%, #e5e9f0 100%);
    color: #1F2933;
    text-align: center;
}

.app-loader__badge {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: linear-gradient(135deg, #0E9F6E, #0a7d56);
    box-shadow: 0 18px 35px rgba(14, 159, 110, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 0.05em;
}

.app-loader__spinner {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 4px solid rgba(14, 159, 110, 0.2);
    border-top-color: #0E9F6E;
    animation: app-loader-spin 1s linear infinite;
}

.app-loader__text {
    font-size: 0.95rem;
    color: var(--color-muted);
    max-width: 320px;
}

@keyframes app-loader-spin {
    to {
        transform: rotate(360deg);
    }
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0E9F6E, #0a7d56);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
}

.brand-title {
    margin: 0;
    font-weight: 600;
}

.brand-subtitle {
    margin: 0;
    font-size: 0.75rem;
    color: var(--color-muted);
}

.user-menu {
    position: relative;
}

.user-trigger {
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    cursor: pointer;
}

.user-trigger:hover {
    background-color: #F3F4F6;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.chevron {
    color: var(--color-muted);
    font-size: 0.8rem;
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: 110%;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 180px;
}

.user-dropdown button {
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
}

.user-dropdown button:hover {
    background-color: #F3F4F6;
}

.user-dropdown button.danger {
    color: #DC2626;
}

.main-nav {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    gap: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.main-nav .nav-item {
    padding: 1rem 0;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    color: var(--color-muted);
}

.main-nav .nav-item.active,
.main-nav .nav-item:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.app-content {
    flex: 1;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.app-footer {
    background-color: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.footer-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-muted);
    font-size: 0.85rem;
}

.login-gate {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #ffffff 0%, #eef1f5 45%, #e5e9f0 100%);
    padding: 2rem;
    z-index: 2000;
}

.login-gate__card {
    background: #ffffff;
    border-radius: 1.5rem;
    padding: 2.5rem 3rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.15);
    text-align: center;
    max-width: 420px;
}

.login-gate__badge {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    border-radius: 18px;
    background: linear-gradient(135deg, #0E9F6E, #0a7d56);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.08em;
}

.login-gate__subtitle {
    color: var(--color-muted);
    margin-bottom: 1.75rem;
}

.login-gate__pulse {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    border: 2px solid rgba(14, 159, 110, 0.35);
    position: relative;
}

.login-gate__pulse::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(14, 159, 110, 0.2);
    animation: login-gate-pulse 1.6s ease-out infinite;
}

@keyframes login-gate-pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

.remember-row {
    display: flex;
    align-items: center;
    margin-top: 1rem;
}

.remember-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-muted);
    font-size: 0.9rem;
}

.remember-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.admin-role-pill {
    background: #E8F5EE;
    color: #0a7d56;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
}

.admin-card {
    background: #ffffff;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
    margin-bottom: 1.5rem;
}

.admin-card h2 {
    margin-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.admin-table {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-row {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr 0.7fr 0.4fr;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: #F8FAFC;
}

.admin-header-row {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    background: transparent;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #E5E7EB;
    color: #111827;
}

.role-badge.owner {
    background: #FFF7ED;
    color: #B45309;
}

.role-select {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--color-border);
    background: #ffffff;
}

.ghost-btn {
    border: none;
    background: transparent;
    color: #DC2626;
    cursor: pointer;
}

.link-btn {
    margin-top: 0.75rem;
    border: none;
    background: transparent;
    color: var(--color-primary);
    cursor: pointer;
    font-weight: 500;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0.25rem 0;
    font-size: 2rem;
}

.section-subtitle {
    color: var(--color-muted);
    margin: 0;
    font-size: 0.95rem;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.quick-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.download-btn {
    border: 1px solid var(--color-border);
    background-color: var(--color-surface);
    border-radius: 0.75rem;
    padding: 0.65rem 1rem;
    font-weight: 500;
    cursor: pointer;
}

.download-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.dashboard-hero {
    background-color: var(--color-surface);
    border-radius: 1.5rem;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: rgba(15, 23, 42, 0.04) 0 10px 20px;
}

.quick-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    padding: 0.5rem 1rem;
    color: #1F2933;
    font-weight: 500;
    transition: all 0.2s ease;
}

.quick-link:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--color-surface);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.stat-label {
    color: var(--color-muted);
    font-size: 0.85rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
}

.insights-panel,
.recent-updates {
    background-color: var(--color-surface);
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    height: 100%;
}

.insight-row,
.update-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-radius: 0.75rem;
    background-color: #F9FAFB;
    margin-bottom: 0.75rem;
}

.skeleton {
    background: linear-gradient(90deg, #f4f4f4 25%, #e6e6e6 37%, #f4f4f4 63%);
    animation: shimmer 1.4s infinite;
    border-radius: 0.5rem;
}

@keyframes shimmer {
    0% {
        background-position: -400px 0;
    }
    100% {
        background-position: 400px 0;
    }
}

.filter-bar {
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.layout-panel {
    background-color: var(--color-surface);
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    overflow: hidden;
    display: flex;
    min-height: 520px;
}

.residences-shell {
    position: relative;
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    overflow: hidden;
    min-height: 640px;
    background-color: #0b1220;
}

.map-fullbleed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.residences-shell .map-container {
    height: 100%;
    min-height: 100%;
    flex: none;
}

.residences-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.25rem;
    height: 100%;
    pointer-events: none;
}

.panel-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.panel-stack.left {
    width: 340px;
    max-width: 40vw;
}

.panel-stack.right {
    width: 380px;
    max-width: 42vw;
}

.panel-card {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    padding: 1rem;
    box-shadow: rgba(15, 23, 42, 0.12) 0 24px 40px -24px;
    backdrop-filter: blur(6px);
}

.residences-shell .list-panel {
    border-left: none;
    padding: 1rem;
    min-width: auto;
}

.map-style-toggle {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 3;
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.3rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.4);
    pointer-events: auto;
}

.map-toggle-btn {
    background: transparent;
    color: #e2e8f0;
    border: none;
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}

.map-toggle-btn.active {
    background: rgba(226, 232, 240, 0.18);
}

.residence-list-panel {
    max-height: calc(100vh - 260px);
    overflow-y: auto;
}

.residence-item.active {
    border-color: var(--color-primary);
    box-shadow: rgba(46, 120, 92, 0.2) 0 16px 24px -16px;
}

.detail-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.street-view-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.street-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.street-view-media {
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.street-view-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.street-view-placeholder {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #e2e8f0;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem;
    gap: 0.35rem;
}

.detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
}

.study-card {
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 1.5rem;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.study-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.status-pill {
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #1e3a8a;
    font-size: 0.75rem;
    font-weight: 600;
}

.study-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.study-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.study-shell {
    min-height: 720px;
}

.study-overlay {
    padding-bottom: 5.5rem;
}

.query-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.query-section {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.query-chipset {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.query-chip {
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    background: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    color: #0f172a;
}

.query-chip.active {
    border-color: var(--color-primary);
    background: rgba(46, 120, 92, 0.12);
}

.query-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.query-field select,
.query-field input {
    border: 1px solid var(--color-border);
    border-radius: 0.6rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
}

.query-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.insights-panel .insight-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
}

.insights-panel .insight-row:last-child {
    border-bottom: none;
}

.saved-queries-panel,
.guided-chat-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.study-results {
    position: absolute;
    left: 1.25rem;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 3;
}

.result-grid {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 0.85rem;
    padding: 0.75rem 1rem;
    background: #fff;
}

.map-panel {
    padding: 1rem;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.map-stack {
    position: relative;
    width: 100%;
    height: 520px;
    border-radius: 0.75rem;
    overflow: hidden;
}

.map-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.map-layer.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.map-layer.is-active {
    opacity: 1;
}

.map-fixed {
    width: 100%;
    height: 520px;
    border-radius: 0.75rem;
    overflow: hidden;
}

.map-panel .map-container,
.map-panel .map-stack {
    height: 520px;
    min-height: 520px;
}

.query-support-drawer {
    width: 420px;
    max-width: 90vw;
    padding: 1rem;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chat-shell {
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #fff;
}

.chat-feed {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 220px;
    overflow-y: auto;
}

.chat-bubble {
    background: #f1f5f9;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.85rem;
}

.chat-bubble--agent {
    background: #0f172a;
    color: #fff;
    align-self: flex-end;
}

.chat-input {
    display: flex;
    gap: 0.5rem;
}

.chat-input input {
    flex: 1;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.query-panel,
.data-grid-panel {
    padding: 1rem;
}

.data-grid-panel .mud-table-container,
.data-grid-panel .mud-data-grid {
    margin-top: 0.75rem;
}

.permit-list-item.active {
    background: rgba(46, 120, 92, 0.1);
    border-radius: 0.75rem;
}

.permit-panel,
.permit-detail {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.permit-item {
    border: 1px solid var(--color-border);
    border-radius: 0.85rem;
    padding: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: #fff;
    cursor: pointer;
    text-align: left;
}

.permit-item.active {
    border-color: var(--color-primary);
    box-shadow: rgba(46, 120, 92, 0.15) 0 12px 20px -16px;
}

.permit-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.map-container {
    height: calc(100vh - 260px);
    min-height: 420px;
    flex: 2;
}

.list-panel {
    padding: 1.5rem;
    border-left: 1px solid var(--color-border);
    overflow-y: auto;
    flex: 1;
    min-width: 320px;
}

.business-item,
.residence-item,
.incentive-item {
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 1.25rem;
    transition: border 0.2s ease, transform 0.2s ease;
}

.business-item:hover,
.residence-item:hover,
.incentive-item:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background-color: #E5F6EF;
    color: var(--color-primary-dark);
}

.login-card {
    max-width: 420px;
    margin: 4rem auto;
    background-color: var(--color-surface);
    border-radius: 1.5rem;
    padding: 2.5rem;
    box-shadow: rgba(15, 23, 42, 0.08) 0 25px 50px -12px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-field label {
    font-size: 0.9rem;
    color: #1F2933;
    font-weight: 500;
}

.form-field input,
.filter-controls select,
.filter-controls input[type="text"] {
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
}

.primary-btn {
    border: none;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border-radius: 0.75rem;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    width: 100%;
    cursor: pointer;
    font-weight: 600;
}

.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.75rem;
    border-radius: 9999px;
    background-color: #E0E7FF;
    color: #312E81;
    font-size: 0.75rem;
    font-weight: 600;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.list-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.login-error {
    color: #DC2626;
    margin-top: 0.75rem;
    text-align: center;
}

.portal-marker {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.portal-marker.marker-highlight {
    transform: scale(1.4);
    background: #16a34a;
    box-shadow: 0 0 10px rgba(22, 163, 74, 0.6);
}

.geo-shell {
    padding: 1.5rem 0 2rem;
}

.geo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.geo-layout {
    display: grid;
    grid-template-columns: 320px 1fr 360px;
    gap: 1rem;
    min-height: 620px;
}

.geo-sidebar,
.geo-details-panel {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 1rem;
    padding: 1.25rem;
    overflow-y: auto;
    box-shadow: 0 24px 40px rgba(15, 23, 42, 0.25);
}

.geo-map-wrapper {
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 24px 40px rgba(15, 23, 42, 0.2);
    min-height: 620px;
}

.geo-map-canvas {
    width: 100%;
    height: 100%;
}

.streetview-shell {
    padding: 1.5rem 0 2rem;
}

.streetview-map {
    width: 100%;
    height: 70vh;
    min-height: 520px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 24px 40px rgba(15, 23, 42, 0.2);
    background: #0b1220;
}

.streetish-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.geo-marker,
.geo-region-marker {
    border-radius: 999px;
    border: 2px solid rgba(4, 16, 32, 0.8);
    width: 16px;
    height: 16px;
    background: #f97316;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
}

.geo-marker.selected {
    transform: scale(1.4);
    background: #38bdf8;
}

.geo-region-marker {
    width: 32px;
    height: 32px;
    background: #6366f1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.geo-region-marker.selected {
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.8);
}

.geo-region-marker .count {
    font-size: 0.8rem;
}

.geo-mode-header {
    margin: 0.5rem 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #38bdf8;
}

.geo-aggregation-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.geo-aggregation-list li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.5rem 0;
}

.geo-aggregation-list li:last-child {
    border-bottom: none;
}

.geo-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0.5rem 0;
}

.geo-details-panel img {
    max-width: 100%;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
}

.geo-details-panel button {
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.55rem;
    border: none;
    border-radius: 0.6rem;
    background: #38bdf8;
    color: #0f172a;
    font-weight: 600;
    cursor: pointer;
}

.geo-details-panel button.secondary {
    background: #6366f1;
    color: #fff;
}

.geo-details-panel button:disabled {
    background: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

.geo-ai-panel {
    margin-top: 1rem;
    padding: 0.75rem;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
}

.geo-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    color: #0f172a;
    background: #38bdf8;
    font-weight: 600;
}

.geo-meta {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 1200px) {
    .geo-layout {
        grid-template-columns: 1fr;
    }

    .geo-map-wrapper {
        min-height: 460px;
    }
}

@media (max-width: 768px) {
    .header-inner,
    .main-nav,
    .app-content,
    .footer-inner {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .main-nav {
        overflow-x: auto;
    }

    .filter-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .layout-panel {
        flex-direction: column;
    }

    .map-container {
        height: 320px;
    }

    .list-panel {
        border-left: none;
        border-top: 1px solid var(--color-border);
        min-width: auto;
    }

    .residences-shell {
        min-height: auto;
        display: block;
    }

    .map-fullbleed {
        position: relative;
        height: 320px;
    }

    .residences-shell .map-container {
        height: 320px;
        min-height: 320px;
    }

    .map-panel .map-container,
    .map-panel .map-stack {
        height: 320px;
        min-height: 320px;
    }

    .query-support-drawer {
        width: 100%;
        max-width: 100%;
    }

    .residences-overlay {
        position: relative;
        flex-direction: column;
        padding: 1rem;
        pointer-events: auto;
    }

    .panel-stack.left,
    .panel-stack.right {
        width: 100%;
        max-width: none;
        pointer-events: auto;
    }

    .study-results {
        position: relative;
        left: auto;
        right: auto;
        bottom: auto;
        padding: 1rem;
    }

    .result-row {
        flex-direction: column;
        align-items: flex-start;
    }
}
:root {
  --error-ui-bg: #1e293b;
  --error-ui-border: rgba(148, 163, 184, 0.4);
  --error-ui-text: #e2e8f0;
}

#blazor-error-ui {
  background: var(--error-ui-bg);
  border: 1px solid var(--error-ui-border);
  border-radius: 12px;
  bottom: 1.5rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.3);
  color: var(--error-ui-text);
  display: none;
  font-size: 0.95rem;
  left: 50%;
  max-width: min(90vw, 420px);
  padding: 0.75rem 1rem;
  position: fixed;
  transform: translateX(-50%);
  z-index: 9999;
}

#blazor-error-ui.show {
  display: block;
}

#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
  color: #38bdf8;
  font-weight: 600;
  margin-left: 0.5rem;
  text-decoration: none;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
}

/* Study Workspace Styles */
.study-workspace {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 200px);
}

.study-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 1.5rem 0;
  margin: -2rem -1.5rem 0;
  padding: 1.5rem;
}

.study-header-content {
  max-width: 1440px;
  margin: 0 auto;
}

.study-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--color-muted);
}

.study-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.study-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.study-tabs {
  margin-top: 1rem;
}

/* Projection Workspace Styles */
.projection-workspace {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 200px);
}

.projection-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  margin: -2rem -1.5rem 0;
  padding: 1.5rem;
}

.projection-header-content {
  max-width: 1440px;
  margin: 0 auto;
}

.projection-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--color-muted);
}

.projection-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.projection-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.projection-tabs {
  margin-top: 1rem;
}

/* Projections List Page */
.projections-page .page-header {
  margin-bottom: 1.5rem;
}

.projection-card {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.projection-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.1);
}

/* Query Tab Styles */
.study-query-tab .filter-panel {
  max-height: calc(100vh - 300px);
  overflow-y: auto;
}

.study-query-tab .agent-panel {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.study-query-tab .map-container {
  background: #0b1220;
  border-radius: 0.75rem;
  overflow: hidden;
}

.study-query-tab .map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
}

.study-query-tab .map-wrapper {
  height: 400px;
  position: relative;
}

.study-query-tab .query-map {
  width: 100%;
  height: 100%;
}

.study-query-tab .map-legend {
  border-top: 1px solid var(--color-border);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.legend-high {
  background-color: #ef4444;
}

.legend-dot.legend-medium {
  background-color: #f59e0b;
}

.legend-dot.legend-low {
  background-color: #22c55e;
}

/* Data Tab Styles */
.study-data-tab .upload-dropzone {
  border: 2px dashed var(--color-border);
  transition: all 0.2s ease;
}

.study-data-tab .upload-dropzone:hover,
.study-data-tab .upload-dropzone.drag-over {
  border-color: var(--color-primary);
  background: rgba(14, 159, 110, 0.05);
}

.study-data-tab .available-sources-list .available-source-item {
  padding: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.study-data-tab .available-sources-list .available-source-item:last-child {
  border-bottom: none;
}

/* Saved Queries Tab Styles */
.study-saved-queries-tab .saved-query-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.study-saved-queries-tab .saved-query-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.08);
}

/* Projection Overview Styles */
.projection-overview .stat-card {
  text-align: center;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 0.75rem;
}

.projection-overview .workflow-card {
  transition: all 0.2s ease;
}

.projection-overview .workflow-card:hover {
  border-color: var(--color-primary);
  background: rgba(14, 159, 110, 0.02);
}

/* Projection Tasks Styles */
.projection-tasks .mud-data-grid {
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  overflow: hidden;
}

/* Projection Map Styles */
.projection-map .map-container {
  background: #0b1220;
}

/* Projection Team Styles */
.projection-team .stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.projection-team .stat-row:last-child {
  border-bottom: none;
}

/* Insight Card Styles */
.insight-card {
  padding: 1rem;
  background: #f8fafc;
  border-radius: 0.75rem;
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .study-header,
  .projection-header {
    margin: -1rem -1rem 0;
    padding: 1rem;
  }

  .study-title-row,
  .projection-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .study-actions,
  .projection-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .study-query-tab .map-wrapper {
    height: 300px;
  }
}
