:root {
    --ms-primary: #0f766e;
    --ms-primary-dark: #0d5c56;
    --ms-accent: #f59e0b;
    --ms-sidebar-bg: #f0fdfa;
    --ms-sidebar-border: #99f6e4;
    --ms-stat-color: #0f766e;
}

body {
    background-color: #f8fafc;
}

html.font-size-sm { font-size: 14px; }
html.font-size-md { font-size: 16px; }
html.font-size-lg { font-size: 18px; }

body.font-size-sm { font-size: 0.875rem; }
body.font-size-md { font-size: 1rem; }
body.font-size-lg { font-size: 1.125rem; }

body.font-size-sm .admin-sidebar-nav .nav-link { font-size: 0.82rem; }
body.font-size-lg .admin-sidebar-nav .nav-link { font-size: 0.98rem; }
body.font-size-sm h2 { font-size: 1.3rem; }
body.font-size-lg h2 { font-size: 1.65rem; }

.font-size-toolbar .btn.active {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.newsflash-bar {
    background: #1e293b;
    color: #fff;
    overflow: hidden;
    white-space: nowrap;
}
.newsflash-marquee {
    display: inline-block;
    padding: 0.45rem 0;
    animation: newsflash-scroll 40s linear infinite;
}
.newsflash-marquee:hover { animation-play-state: paused; }
@keyframes newsflash-scroll {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}
.newsflash-item {
    display: inline;
    padding: 0 2rem;
    font-size: 0.92em;
}
.newsflash-warning { background: #b45309; }
.newsflash-holiday-message { background: #0369a1; }
.newsflash-festival-greeting { background: #7c3aed; }
.newsflash-birthday { background: #be185d; }

.sidebar-group { margin-top: 0.15rem; }
/* Menu search: force collapsed groups open and hide non-matches */
.sidebar-menu-filtering .collapse {
    display: block !important;
    height: auto !important;
    visibility: visible !important;
    overflow: visible !important;
}
.sidebar-menu-filtering .menu-search-hide {
    display: none !important;
}

.sidebar-group-toggle {
    width: 100%;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.35rem 1rem 0.2rem;
    text-align: left;
}
.sidebar-group-toggle .toggle-icon {
    font-size: 0.65rem;
    margin-right: 0.25rem;
}
.admin-sidebar-nav .dashboard-link {
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.sidebar-group .nav-link {
    padding-left: 1.35rem;
}

.navbar-brand img.brand-logo {
    height: 36px;
    width: auto;
    margin-right: 0.5rem;
}

.navbar-ms {
    background: linear-gradient(135deg, var(--ms-primary-dark) 0%, var(--ms-primary) 100%) !important;
}

.hero-section {
    position: relative;
    overflow: hidden;
    color: #fff;
    min-height: 480px;
    background:
        radial-gradient(ellipse 70% 80% at 85% 15%, rgba(255, 255, 255, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse 50% 60% at 10% 80%, rgba(94, 234, 212, 0.22) 0%, transparent 50%),
        linear-gradient(118deg, #3b5bdb 0%, #4c6ef5 38%, #74c0fc 78%, #a5d8ff 100%);
    padding-bottom: 5.5rem;
}

.hero-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(160deg, transparent 55%, rgba(224, 244, 234, 0.35) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 400' fill='none'%3E%3Cg opacity='0.22'%3E%3Crect x='520' y='160' width='48' height='120' rx='4' fill='%23ffffff'/%3E%3Crect x='580' y='120' width='56' height='160' rx='4' fill='%23d8f3e7'/%3E%3Crect x='648' y='180' width='42' height='100' rx='4' fill='%23ffffff'/%3E%3Crect x='700' y='140' width='50' height='140' rx='4' fill='%23c3e6d8'/%3E%3Crect x='540' y='190' width='10' height='10' fill='%234c6ef5'/%3E%3Crect x='560' y='210' width='10' height='10' fill='%234c6ef5'/%3E%3Crect x='600' y='150' width='12' height='12' fill='%233b5bdb'/%3E%3Crect x='620' y='175' width='12' height='12' fill='%233b5bdb'/%3E%3Crect x='665' y='205' width='8' height='8' fill='%234c6ef5'/%3E%3Crect x='720' y='170' width='10' height='10' fill='%233b5bdb'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right top;
    background-size: min(720px, 90vw) auto;
    pointer-events: none;
    z-index: 0;
}

.hero-section .container {
    position: relative;
    z-index: 1;
}

.hero-wave {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    width: 100%;
    height: 110px;
    z-index: 2;
    pointer-events: none;
    line-height: 0;
}

.hero-wave svg {
    display: block;
    width: 100%;
    height: 100%;
}

.hero-card {
    background: rgba(255, 255, 255, 0.96);
    color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.18);
    backdrop-filter: blur(6px);
}

.hero-card-inline {
    max-width: 420px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.16);
}

.hero-card .text-primary {
    color: #4c6ef5 !important;
}

.home-soft-band {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 55%, #f1f5f9 100%);
    position: relative;
}

.home-soft-band::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(420px, 55vw);
    height: 180px;
    background:
        radial-gradient(ellipse at 70% 80%, rgba(116, 192, 252, 0.28) 0%, transparent 70%),
        radial-gradient(ellipse at 30% 90%, rgba(224, 244, 234, 0.55) 0%, transparent 65%);
    pointer-events: none;
}

.home-cta-band {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse 60% 80% at 90% 20%, rgba(255, 255, 255, 0.16) 0%, transparent 55%),
        linear-gradient(118deg, #3b5bdb 0%, #4c6ef5 45%, #339af0 100%);
    margin-bottom: 0 !important;
}

.home-cta-band::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -1px;
    height: 48px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 48' preserveAspectRatio='none'%3E%3Cpath fill='%23ffffff' d='M0,24 C240,48 480,0 720,16 C960,32 1200,48 1440,20 L1440,0 L0,0 Z'/%3E%3C/svg%3E")
        no-repeat center top / 100% 100%;
    pointer-events: none;
}

.site-footer-themed {
    position: relative;
    background:
        radial-gradient(ellipse 55% 90% at 12% 80%, rgba(94, 234, 212, 0.18) 0%, transparent 55%),
        linear-gradient(118deg, #3b5bdb 0%, #4c6ef5 42%, #339af0 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.site-footer-themed a {
    color: #fff;
}

/* Intensity heat-map (Low → High) */
.heatmap-wrap {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    flex-wrap: wrap;
}
.heatmap-grid {
    display: grid;
    gap: 6px;
    flex: 1 1 280px;
}
.heatmap-cell {
    border-radius: 6px;
    min-height: 52px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: #0f172a;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.heatmap-cell .hm-top { opacity: 0.85; font-size: 0.7rem; }
.heatmap-cell .hm-bottom { font-size: 0.9rem; }
.heatmap-legend {
    width: 42px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
}
.heatmap-legend-bar {
    width: 16px;
    flex: 1 1 auto;
    min-height: 120px;
    border-radius: 999px;
    background: linear-gradient(to top, #3b82f6, #22c55e, #eab308, #f97316, #ef4444);
    border: 1px solid rgba(15, 23, 42, 0.12);
}
.heatmap-legend span {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
}

@media (max-width: 768px) {
    .hero-section {
        min-height: 0;
        padding-bottom: 4rem;
    }
    .hero-wave {
        height: 72px;
    }
    .hero-section::before {
        opacity: 0.45;
        background-size: 420px auto;
    }
}

.nav-datetime {
    font-size: 0.65rem;
    font-weight: 400;
}

.sidebar {
    background: var(--ms-sidebar-bg);
    min-height: calc(100vh - 56px);
    border-right: 1px solid var(--ms-sidebar-border);
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    position: sticky;
    top: 56px;
}

#adminSidebarAccordion,
#adminSidebarAccordionMobile {
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    padding-bottom: 1.5rem;
}

.admin-sidebar-nav .nav-link {
    color: #334155;
    padding: 0.55rem 1rem;
    border-radius: 0.5rem;
    margin: 0.12rem 0.5rem;
    font-size: 0.925rem;
}

.admin-sidebar-nav .nav-link i {
    width: 1.35rem;
    opacity: 0.85;
}

.admin-sidebar-nav .nav-link:hover,
.admin-sidebar-nav .nav-link.active {
    background: #ccfbf1;
    color: var(--ms-primary-dark);
    font-weight: 500;
}

.stat-card h2, .stat-card h3 {
    color: var(--ms-stat-color);
    font-weight: 700;
}

.stat-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(15, 118, 110, 0.12) !important;
}

.feature-item {
    border-left: 3px solid var(--ms-primary);
    padding-left: 1rem;
}

.btn-primary {
    background-color: var(--ms-primary);
    border-color: var(--ms-primary);
}

.btn-primary:hover {
    background-color: var(--ms-primary-dark);
    border-color: var(--ms-primary-dark);
}

.btn-outline-primary {
    color: var(--ms-primary);
    border-color: var(--ms-primary);
}

.btn-outline-primary:hover {
    background-color: var(--ms-primary);
    border-color: var(--ms-primary);
}

.committee-banner-active { border-left: 4px solid #22c55e; background: #f0fdf4; }
.committee-banner-warning { border-left: 4px solid #f59e0b; background: #fffbeb; }
.committee-banner-expired { border-left: 4px solid #ef4444; background: #fef2f2; }
.committee-banner-none { border-left: 4px solid #94a3b8; background: #f8fafc; }

.hierarchy-tree .wing-node { font-weight: 600; color: var(--ms-primary-dark); }
.hierarchy-tree .room-node { margin-left: 1rem; }
.hierarchy-tree .tenant-node { margin-left: 2rem; font-size: 0.9rem; }
.chart-card canvas { max-height: 160px !important; }
.chart-card .card-body { padding: 1rem; }

.forum-nav-link { color: rgba(255,255,255,0.95) !important; }
.forum-badge { font-size: 0.65rem; }
.hierarchy-tree .tenant-active { color: #15803d; }
.hierarchy-tree .tenant-expiring { color: #b45309; }
.hierarchy-tree .tenant-expired { color: #b91c1c; }
.hierarchy-tree .tenant-blocked { color: #7f1d1d; font-weight: 600; }

.chart-card {
    min-height: 280px;
}

.quick-link-grid .btn {
    text-align: left;
}

.quick-link-grid .btn i {
    margin-right: 0.35rem;
}

.brand-stack {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.brand-stack .brand-logo-society {
    height: 36px;
    border-radius: 4px;
    background: #fff;
    padding: 2px;
}

body.theme-teal {
    --ms-primary: #0f766e;
    --ms-primary-dark: #0d5c56;
    --ms-sidebar-bg: #f0fdfa;
    --ms-sidebar-border: #99f6e4;
    --ms-stat-color: #0f766e;
}
body.theme-teal .admin-sidebar-nav .nav-link:hover,
body.theme-teal .admin-sidebar-nav .nav-link.active { background: #ccfbf1; color: #0d5c56; }

body.theme-ocean {
    --ms-primary: #0369a1;
    --ms-primary-dark: #075985;
    --ms-sidebar-bg: #f0f9ff;
    --ms-sidebar-border: #bae6fd;
    --ms-stat-color: #0369a1;
}
body.theme-ocean .admin-sidebar-nav .nav-link:hover,
body.theme-ocean .admin-sidebar-nav .nav-link.active { background: #e0f2fe; color: #075985; }

body.theme-royal {
    --ms-primary: #7c3aed;
    --ms-primary-dark: #5b21b6;
    --ms-sidebar-bg: #f5f3ff;
    --ms-sidebar-border: #ddd6fe;
    --ms-stat-color: #7c3aed;
}
body.theme-royal .admin-sidebar-nav .nav-link:hover,
body.theme-royal .admin-sidebar-nav .nav-link.active { background: #ede9fe; color: #5b21b6; }

body.theme-sunset {
    --ms-primary: #ea580c;
    --ms-primary-dark: #c2410c;
    --ms-sidebar-bg: #fff7ed;
    --ms-sidebar-border: #fed7aa;
    --ms-stat-color: #ea580c;
}
body.theme-sunset .admin-sidebar-nav .nav-link:hover,
body.theme-sunset .admin-sidebar-nav .nav-link.active { background: #ffedd5; color: #c2410c; }

body.theme-forest {
    --ms-primary: #15803d;
    --ms-primary-dark: #166534;
    --ms-sidebar-bg: #f0fdf4;
    --ms-sidebar-border: #bbf7d0;
    --ms-stat-color: #15803d;
}
body.theme-forest .admin-sidebar-nav .nav-link:hover,
body.theme-forest .admin-sidebar-nav .nav-link.active { background: #dcfce7; color: #166534; }

label.card { cursor: pointer; }
label.card:has(input:checked) { border-color: var(--ms-primary) !important; border-width: 2px; }
