/* Village Planning — dashboard control styling (blue/white theme) */
.vp-select {
    width: 100%;
    margin-top: 2px;
    border-radius: 0.5rem;
    border: 1px solid rgb(209 213 219);
    background-color: #fff;
    padding: 0.4rem 0.6rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: rgb(17 24 39);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.03);
}
.vp-select:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    border-color: #1E3A5F;
    box-shadow: 0 0 0 1px #1E3A5F;
}
.dark .vp-select {
    background-color: rgb(255 255 255 / 0.05);
    border-color: rgb(255 255 255 / 0.1);
    color: rgb(243 244 246);
}
.dark .vp-select option { color: #111827; }
.leaflet-container { font: inherit; }

/* ============================================================
   Dark-navy sidebar (aligned to the logo), light text + icons.
   Applies in both light and dark mode.
   ============================================================ */
.fi-sidebar,
.fi-sidebar-header,
.fi-sidebar-nav {
    background-color: #16304d !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}
.fi-sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.10) !important;
}

/* Group headings */
.fi-sidebar-group-label {
    color: #8fb0d4 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.68rem;
}
.fi-sidebar-group-collapse-button,
.fi-sidebar-group-collapse-button .fi-icon {
    color: #8fb0d4 !important;
}

/* Nav items — light text + icons that stand out */
.fi-sidebar-item-button {
    color: #dbe7f4 !important;
}
.fi-sidebar-item-icon,
.fi-sidebar-item-button .fi-icon {
    color: #a9c6e4 !important;
}
.fi-sidebar-item-button:hover {
    background-color: rgba(255, 255, 255, 0.09) !important;
}
.fi-sidebar-item-button:hover,
.fi-sidebar-item-button:hover .fi-sidebar-item-icon,
.fi-sidebar-item-button:hover .fi-icon {
    color: #ffffff !important;
}

/* Active item — highlighted */
.fi-sidebar-item.fi-active > .fi-sidebar-item-button,
.fi-sidebar-item-active > .fi-sidebar-item-button {
    background-color: rgba(96, 165, 250, 0.22) !important;
}
.fi-sidebar-item.fi-active > .fi-sidebar-item-button,
.fi-sidebar-item.fi-active > .fi-sidebar-item-button .fi-sidebar-item-icon,
.fi-sidebar-item.fi-active > .fi-sidebar-item-button .fi-icon,
.fi-sidebar-item-active > .fi-sidebar-item-button,
.fi-sidebar-item-active > .fi-sidebar-item-button .fi-icon {
    color: #ffffff !important;
}

/* Sidebar badges (e.g. Roles count) */
.fi-sidebar-item .fi-badge {
    background-color: rgba(255, 255, 255, 0.16) !important;
    color: #eaf2fb !important;
}

/* Collapse-sidebar toggle button */
.fi-sidebar-close-overlay-button,
.fi-topbar .fi-icon-btn { color: inherit; }

/* Hide brand text when the desktop sidebar is collapsed (keeps just the logo). */
.fi-sidebar-collapsed .vp-brand-text { display: none !important; }

/* Label spans are coloured separately by Filament — brighten them explicitly. */
.fi-sidebar-item-label {
    color: #e6eefb !important;
    font-weight: 500;
}
.fi-sidebar-item-button:hover .fi-sidebar-item-label {
    color: #ffffff !important;
}
.fi-sidebar-item.fi-active > .fi-sidebar-item-button .fi-sidebar-item-label,
.fi-sidebar-item-active > .fi-sidebar-item-button .fi-sidebar-item-label {
    color: #ffffff !important;
    font-weight: 600;
}

/* ============================================================
   Brand (logo + Village Planner + v1.1.0).
   Layout + colour adapt to context:
     • base / sidebar → compact row, small text
     • login (.fi-simple-header) → logo ABOVE name, centred, larger
   ============================================================ */
/* Filament wraps the brand in a fixed-height (1.5rem) .fi-logo box; let it grow
   to our two-line brand so the login heading below never overlaps it. */
.fi-logo { height: auto !important; }

.vp-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.vp-brand-logo {
    width: 2.1rem;
    height: 2.1rem;
    flex: none;                 /* never let the text squeeze the logo */
    border-radius: 0.5rem;
    background: #fff;
    padding: 0.18rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.10);
    object-fit: contain;
}
.vp-brand-name {
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
    white-space: nowrap;
    color: #1e3a5f;
}
.vp-brand-version {
    font-size: 0.66rem;
    font-weight: 500;
    margin-top: 1px;
    color: #64748b;
}

/* Dark mode (login screen in dark) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .vp-brand-name { color: #e8eef7; }
    :root:not([data-theme="light"]) .vp-brand-version { color: #94a3b8; }
}
:root[data-theme="dark"] .vp-brand-name { color: #e8eef7; }
:root[data-theme="dark"] .vp-brand-version { color: #94a3b8; }

/* Sidebar — compact row, smaller text, light colour on the navy background. */
.fi-sidebar .vp-brand-name { color: #ffffff !important; font-size: 0.8rem; }
.fi-sidebar .vp-brand-version { color: #93c5fd !important; }
.fi-sidebar-header { padding-top: 0.85rem !important; padding-bottom: 0.85rem !important; }

/* Login screen — logo ABOVE the app name, centred, larger logo.
   Order top→bottom: logo · Village Planner · v1.1.0 · Sign in · form. */
.fi-simple-header .vp-brand {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.3rem;
}
/* On the white login card the navy emblem needs no chip — plain image, no
   background / border / shadow, minimal margin. */
.fi-simple-header .vp-brand-logo {
    width: 9.5rem;
    height: 9.5rem;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.fi-simple-header .vp-brand-name { font-size: 1.3rem; white-space: normal; margin-top: 0.1rem; }
.fi-simple-header .vp-brand-version { font-size: 0.78rem; letter-spacing: 0.04em; }

/* Space Filament's native "Sign in" heading from the brand above it. */
.fi-simple-header .fi-simple-header-heading { margin-top: 0.5rem; }

/* ============================================================
   Login screen fit — keep it a single, un-scrolled simple page.
   The bigger logo made the card tall; shift it up + tighten spacing
   so it fits the viewport on desktop and mobile without scrolling.
   ============================================================ */
.fi-simple-layout { min-height: 100dvh; }
.fi-simple-main {
    margin-top: 1.75rem !important;
    margin-bottom: 1.75rem !important;
    padding-top: 1.75rem !important;
    padding-bottom: 1.75rem !important;
}
.fi-simple-header { margin-bottom: 0.25rem; }
.fi-simple-page { row-gap: 1rem !important; }

/* Shorter viewports / mobile: shrink the logo + spacing so no scroll is needed. */
@media (max-height: 760px), (max-width: 480px) {
    .fi-simple-header .vp-brand-logo { width: 6.5rem; height: 6.5rem; }
    .fi-simple-header .vp-brand-name { font-size: 1.15rem; }
    .fi-simple-main {
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
        padding-top: 1.25rem !important;
        padding-bottom: 1.25rem !important;
    }
    .fi-simple-header .fi-simple-header-heading { margin-top: 0.35rem; }
    .fi-simple-page { row-gap: 0.75rem !important; }
}
