/* Unified HANDA-TAYO visual system, based on Weather Monitoring. */
:root {
    --ht-shell-sidebar: 240px;
    --ht-color-primary-50: #f3fafe;
    --ht-color-primary-100: #e5f5fc;
    --ht-color-primary-200: #c9eaf8;
    --ht-color-primary-300: #91d5f2;
    --ht-color-primary-500: #2f9ed8;
    --ht-color-primary-600: #1c7fb7;
    --ht-color-primary-700: #176895;
    --ht-color-primary-800: #165777;
    --ht-color-page: #f5f9fc;
    --ht-color-surface: #ffffff;
    --ht-color-surface-alt: #f8fbfd;
    --ht-color-ink: #0f172a;
    --ht-color-muted: #64748b;
    --ht-color-border: #dce8f0;
    --ht-color-sidebar: #0f2435;
    --ht-color-success: #15803d;
    --ht-color-warning: #d97706;
    --ht-color-danger: #b91c1c;
    --ht-color-hero: #eaf7fd;
    --ht-color-hero-border: #c8e6f3;
    --ht-radius-sm: 9px;
    --ht-radius-md: 12px;
    --ht-radius-lg: 16px;
    --ht-shadow-card: 0 1px 2px rgba(15, 23, 42, .03), 0 4px 16px rgba(15, 23, 42, .04);
    --ht-shadow-raised: 0 12px 28px rgba(15, 23, 42, .10);
    --blue: var(--ht-color-primary-600);
    --primary: var(--ht-color-primary-600);
    --panel: var(--ht-color-surface);
    --border: var(--ht-color-border);
    --bg: var(--ht-color-page);
    --ink: var(--ht-color-ink);
    --muted: var(--ht-color-muted);
}

html {
    color-scheme: light;
    background: var(--ht-color-page);
}

body {
    color: var(--ht-color-ink);
    background-color: var(--ht-color-page);
    font-family: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    color: var(--ht-color-primary-800);
    background: var(--ht-color-primary-200);
}

button,
input,
select,
textarea {
    font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--ht-color-primary-300) !important;
    outline-offset: 2px;
}

/* Shared authenticated shell */
.layout {
    min-height: 100vh;
    background: var(--ht-color-page);
}

.sidebar {
    width: var(--ht-shell-sidebar);
    color: #fff;
    background: var(--ht-color-sidebar) !important;
    border-right: 1px solid rgba(255, 255, 255, .08) !important;
    box-shadow: none !important;
}

.sidebar-top {
    padding: 20px 16px 16px !important;
    border-bottom: 1px solid rgba(255, 255, 255, .08) !important;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar .brand-logo,
.sidebar .logo {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    overflow: hidden;
    background: #fff;
    border-radius: 12px;
    box-shadow: none;
}

.sidebar .brand-logo img,
.sidebar .logo img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.sidebar .brand h1 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 750;
    letter-spacing: .04em;
}

.sidebar .brand p {
    margin: 2px 0 0;
    color: #b7cad7;
    font-size: 11px;
    letter-spacing: .035em;
}

.sidebar .nav {
    gap: 4px !important;
    padding: 14px 10px !important;
}

.sidebar .nav button,
.sidebar .nav a {
    min-height: 40px !important;
    align-items: center;
    gap: 10px !important;
    padding: 8px 10px !important;
    color: #c9d8e2 !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: var(--ht-radius-sm) !important;
    box-shadow: none !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    transform: none !important;
}

.sidebar .nav button:hover,
.sidebar .nav a:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, .07) !important;
}

.sidebar .nav button.active,
.sidebar .nav a.active,
.sidebar .nav [aria-current="page"] {
    color: #fff !important;
    background: var(--ht-color-primary-700) !important;
    border-color: rgba(255, 255, 255, .10) !important;
}

.sidebar .nav-icon {
    display: inline-grid !important;
    width: 20px !important;
    height: 20px;
    flex: 0 0 20px;
    place-items: center;
    color: currentColor;
    font-size: 0 !important;
}

.sidebar .nav-icon svg {
    width: 17px;
    height: 17px;
    overflow: visible;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-bottom {
    padding: 14px !important;
    border-top: 1px solid rgba(255, 255, 255, .08) !important;
}

.sidebar .profile {
    min-width: 0;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
}

.sidebar .avatar {
    width: 38px !important;
    height: 38px !important;
    flex: 0 0 38px;
    color: #fff;
    background: var(--ht-color-primary-600) !important;
    border-radius: 50%;
    box-shadow: none !important;
}

.main {
    background: var(--ht-color-page);
}

.topbar {
    min-height: 68px;
    padding: 12px 28px !important;
    background: rgba(255, 255, 255, .96) !important;
    border-bottom: 1px solid var(--ht-color-border) !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.topbar-title,
.topbar .title h2,
.topbar .title h3 {
    color: var(--ht-color-ink);
    font-weight: 700 !important;
}

.topbar-context,
.topbar .title p {
    color: var(--ht-color-muted) !important;
}

.menu-btn {
    width: 42px !important;
    height: 42px !important;
    place-items: center;
    color: var(--ht-color-primary-800) !important;
    background: var(--ht-color-primary-50) !important;
    border: 1px solid var(--ht-color-primary-200) !important;
    border-radius: 11px !important;
    box-shadow: none !important;
    font-size: 0 !important;
}

.menu-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.icon-btn svg {
    width: 19px;
    height: 19px;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.content {
    width: min(100%, 1480px) !important;
    margin: 0 auto !important;
    padding: 28px !important;
}

.content h1,
.content h2,
.content h3,
.content h4 {
    color: var(--ht-color-ink);
}

.content p,
.panel-subtitle,
.card-subtitle,
.page-description {
    color: var(--ht-color-muted);
}

/* Shared light-blue page hero, matching the Weather Intelligence visual language. */
.app-page-hero {
    position: relative;
    isolation: isolate;
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    overflow: hidden;
    margin: 0 0 24px;
    padding: 22px 24px;
    background: linear-gradient(135deg, var(--ht-color-hero) 0%, #f7fcff 56%, #e6f5fc 100%);
    border: 1px solid var(--ht-color-hero-border);
    border-radius: var(--ht-radius-lg);
    box-shadow: 0 9px 24px rgba(23, 104, 149, .08);
}

.app-page-hero::after {
    position: absolute;
    z-index: -1;
    top: -92px;
    right: -52px;
    width: 190px;
    height: 190px;
    background: rgba(145, 213, 242, .18);
    border-radius: 50%;
    content: "";
}

.app-page-hero > * {
    position: relative;
    z-index: 1;
}

.app-page-hero-lead {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 16px;
}

.app-page-hero-icon {
    display: grid;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    place-items: center;
    color: var(--ht-color-primary-700);
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(47, 158, 216, .22);
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(23, 104, 149, .08);
}

.app-page-hero-icon svg {
    width: 26px;
    height: 26px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-page-hero-copy {
    min-width: 0;
}

.app-page-hero-eyebrow {
    margin: 0 0 5px !important;
    color: var(--ht-color-primary-700) !important;
    font-size: 11px !important;
    font-weight: 750 !important;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.app-page-hero h1,
.app-page-hero h2 {
    margin: 0;
    color: var(--ht-color-ink);
    font-size: clamp(25px, 3vw, 32px);
    font-weight: 750;
    line-height: 1.15;
}

.app-page-hero-description {
    max-width: 720px;
    margin: 6px 0 0 !important;
    color: #526b7c !important;
    font-size: 14px;
    line-height: 1.5;
}

.app-page-hero-actions,
.app-page-hero .heading-controls,
.app-page-hero .page-actions {
    flex: 0 1 auto;
}

.weather-stack > .app-page-hero {
    margin-bottom: 0;
}

/* Common content surfaces */
.layout .card,
.layout .panel,
.layout .settings-card,
.layout .table-card,
.layout .chart-card,
.layout .stat-card,
.layout .summary-card,
.layout .resident-profile-card {
    background-color: var(--ht-color-surface);
    border-color: var(--ht-color-border) !important;
    border-radius: var(--ht-radius-lg) !important;
    box-shadow: var(--ht-shadow-card) !important;
}

.layout .stat-card,
.layout .summary-card {
    overflow: hidden;
}

.layout .stat-card::before,
.layout .summary-card::before {
    background: var(--ht-color-primary-500) !important;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    color: var(--ht-color-ink) !important;
    background: #fff !important;
    border-color: var(--ht-color-border) !important;
    border-radius: var(--ht-radius-sm) !important;
    box-shadow: none !important;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    border-color: var(--ht-color-primary-500) !important;
    box-shadow: 0 0 0 3px rgba(47, 158, 216, .15) !important;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--ht-color-primary-600);
}

.primary-btn,
.create-btn,
.add-btn,
.save-btn,
.export-btn,
.send-all-btn,
button.primary {
    color: #fff !important;
    background: var(--ht-color-primary-600) !important;
    border-color: var(--ht-color-primary-700) !important;
    box-shadow: none !important;
}

.primary-btn:hover,
.create-btn:hover,
.add-btn:hover,
.save-btn:hover,
.export-btn:hover,
.send-all-btn:hover,
button.primary:hover {
    background: var(--ht-color-primary-700) !important;
    transform: none !important;
}

.secondary-btn,
.cancel-btn,
button.ghost {
    color: #334155 !important;
    background: #fff !important;
    border-color: var(--ht-color-border) !important;
    box-shadow: none !important;
}

.logout-btn {
    color: #fff !important;
    background: var(--ht-color-danger) !important;
    border: 1px solid #991b1b !important;
    border-radius: var(--ht-radius-sm) !important;
    box-shadow: none !important;
}

table thead th {
    color: #526477;
    background: var(--ht-color-surface-alt);
}

table tbody tr:hover {
    background: var(--ht-color-primary-50);
}

.modal-content,
.register-modal-card,
.map-modal-content,
.details-modal,
.security-code-card,
.password-reset-card {
    border: 1px solid var(--ht-color-border) !important;
    border-radius: 20px !important;
    box-shadow: var(--ht-shadow-raised) !important;
}

/* Login inherits the same weather-led palette. */
body > .shell {
    border: 1px solid var(--ht-color-border);
    box-shadow: var(--ht-shadow-raised);
}

body > .shell > .left {
    color: var(--ht-color-ink);
    background: linear-gradient(145deg, #e7f6fd 0%, #f7fcff 58%, #dff2fb 100%);
    border-right: 1px solid var(--ht-color-hero-border);
}

body > .shell > .left .brand h1,
body > .shell > .left .hero h2,
body > .shell > .left .stat strong {
    color: var(--ht-color-ink);
}

body > .shell > .left .brand p,
body > .shell > .left .hero p,
body > .shell > .left .stat span {
    color: #526b7c;
}

body > .shell > .left .blob1 {
    background: rgba(145, 213, 242, .32);
}

body > .shell > .left .blob2 {
    background: rgba(47, 158, 216, .18);
}

body > .shell .stat {
    border-color: rgba(47, 158, 216, .22);
    background: rgba(255, 255, 255, .72);
}

body > .shell .right {
    background: #fff;
}

@media (max-width: 920px) {
    .main {
        margin-left: 0;
    }

    .topbar {
        padding-right: max(18px, var(--ht-safe-right, 0px)) !important;
        padding-left: max(18px, var(--ht-safe-left, 0px)) !important;
    }

    .content {
        padding: 22px !important;
    }
}

@media (max-width: 768px) {
    .topbar {
        padding: 12px max(14px, var(--ht-safe-right, 0px)) 12px max(14px, var(--ht-safe-left, 0px)) !important;
    }

    .content {
        padding: 18px 14px 28px !important;
    }

    .app-page-hero {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
        padding: 19px;
    }

    .app-page-hero-actions,
    .app-page-hero .heading-controls,
    .app-page-hero .page-actions {
        width: 100%;
    }

    .app-page-hero .page-actions > * {
        flex: 1 1 150px;
    }
}

@media (max-width: 430px) {
    .app-page-hero-lead {
        align-items: flex-start;
        gap: 12px;
    }

    .app-page-hero-icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
        border-radius: 12px;
    }

    .app-page-hero-icon svg {
        width: 23px;
        height: 23px;
    }
}

@media (max-width: 380px) {
    .topbar {
        padding: 10px max(8px, var(--ht-safe-right, 0px)) 10px max(8px, var(--ht-safe-left, 0px)) !important;
    }

    .content {
        padding: 10px max(8px, var(--ht-safe-right, 0px)) max(14px, var(--ht-safe-bottom, 0px)) max(8px, var(--ht-safe-left, 0px)) !important;
    }

    .app-page-hero {
        gap: 14px;
        padding: 14px;
        border-radius: 14px;
    }

    .app-page-hero::after {
        top: -72px;
        right: -68px;
        width: 150px;
        height: 150px;
    }

    .app-page-hero-lead {
        display: grid;
        width: 100%;
        grid-template-columns: 40px minmax(0, 1fr);
        align-items: start;
        gap: 10px;
    }

    .app-page-hero-icon {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
        border-radius: 11px;
    }

    .app-page-hero-icon svg {
        width: 21px;
        height: 21px;
    }

    .app-page-hero h1,
    .app-page-hero h2 {
        font-size: 22px;
        overflow-wrap: anywhere;
    }

    .app-page-hero-description {
        font-size: 13px;
    }

    .app-page-hero-actions,
    .app-page-hero .heading-controls,
    .app-page-hero .page-actions {
        display: grid !important;
        width: 100% !important;
        min-width: 0 !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 10px !important;
    }

    .app-page-hero .control-group {
        min-width: 0;
        grid-column: 1 !important;
    }

    .app-page-hero .updated-block,
    .app-page-hero .location-select,
    .app-page-hero .refresh-btn,
    .app-page-hero .page-actions > * {
        width: 100% !important;
        min-width: 0 !important;
    }

    body > .shell {
        width: 100%;
        min-width: 0;
        border-radius: 14px;
    }

    body > .shell > .right {
        min-width: 0;
        padding: 16px 12px !important;
    }

    body > .shell .mobile-header {
        align-items: flex-start;
        gap: 8px;
    }

    body > .shell .row {
        align-items: flex-start;
        flex-direction: column;
    }

    body > .shell .account-register-section {
        flex-wrap: wrap;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
