html,
body {
    height: 100%;
    margin: 0;
}

* {
    box-sizing: border-box;
}

body {
    font-family: Inter, Segoe UI, Arial, sans-serif;
    background: #f5f7fa;
}

/* =========================
   TOP BAR
========================= */

#topbar {
    height: 64px;
    background: white;
    border-bottom: 1px solid #e5e7eb;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 24px;

    position: fixed;
    top: 0;
    left: 0;
    right: 0;

    z-index: 1000;
}

#logo {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

#navlinks {
    display: flex;
    gap: 24px;
}

#navlinks a {
    text-decoration: none;
    color: #6b7280;
    font-weight: 500;
}

#navlinks a:hover {
    color: #2563eb;
}

.account-name {
    color: #6b7280;
    font-weight: 500;
}

#navlinks form {
    margin: 0;
}

.logout-btn {
    border: 0;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font: inherit;
    font-weight: 500;
    padding: 0;
}

.logout-btn:hover {
    color: #2563eb;
}

.auth-page {
    align-items: center;
    background: #f5f7fa;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .08);
    max-width: 420px;
    padding: 32px;
    width: 100%;
}

.auth-card h1 {
    margin: 0 0 8px;
}

.auth-card p {
    color: #6b7280;
    margin: 0 0 24px;
}

.auth-field {
    margin-bottom: 16px;
}

.auth-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.auth-field input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
    padding: 10px;
    width: 100%;
}

.auth-submit {
    background: #2563eb;
    border: 0;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: 11px;
    width: 100%;
}

.auth-error {
    color: #b91c1c;
    font-size: 14px;
    margin-top: 5px;
}

.flash-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    margin-bottom: 16px;
    padding: 10px;
}

.settings-page {
    background: #f5f7fa;
    padding-top: 64px;
}

.settings-main {
    margin: 0 auto;
    max-width: 920px;
    padding: 40px 24px;
}

.settings-intro h1,
.settings-card h2 {
    color: #111827;
    margin: 0 0 8px;
}

.settings-intro p,
.settings-card > p,
.settings-row span {
    color: #6b7280;
}

.settings-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-top: 22px;
    padding: 24px;
}

.settings-form {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr 1fr auto;
    margin: 20px 0;
}

.settings-form input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
    padding: 10px;
}

.settings-form button {
    background: #2563eb;
    border: 0;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: 10px 14px;
}

.group-form {
    grid-template-columns: 1fr auto;
}

.contact-choices {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    grid-column: 1 / -1;
    padding: 10px;
}

.contact-choices label,
.preference-toggle {
    display: block;
    margin: 7px 0;
}

.contact-choices span {
    color: #6b7280;
    font-size: 13px;
}

.settings-row {
    align-items: center;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
}

.settings-row strong,
.settings-row span {
    display: block;
}

.text-danger {
    background: transparent;
    border: 0;
    color: #dc2626;
    cursor: pointer;
    font: inherit;
}

.secondary-button {
    background: white;
    border: 1px solid #2563eb;
    border-radius: 8px;
    color: #2563eb;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    margin: 4px 0 10px;
    padding: 9px 12px;
}

.secondary-button:hover:not(:disabled) {
    background: #eff6ff;
}

.secondary-button:disabled {
    cursor: wait;
    opacity: .65;
}

.scope-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.group-form-actions,
.row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-scope {
    color: #4b5563;
    font-size: 13px;
}

.preference-group {
    border-top: 1px solid #e5e7eb;
    padding: 14px 0;
}

.preference-group h3 {
    margin: 0 0 10px;
}

.settings-message {
    color: #047857;
    min-height: 22px;
    padding-top: 12px;
}

.settings-message.error {
    color: #b91c1c;
}

.empty-state {
    color: #6b7280;
}

.history-header {
    align-items: end;
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.history-header select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
    padding: 10px;
}

.history-item {
    border-top: 1px solid #e5e7eb;
    padding: 18px 0;
}

.history-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.history-item-title {
    align-items: start;
    display: flex;
    gap: 15px;
    justify-content: space-between;
}

.history-item-title strong,
.history-item-title span {
    display: block;
}

.history-item-title > div > span {
    color: #6b7280;
    margin-top: 3px;
}

.severity-badge {
    background: #fef2f2;
    border-radius: 999px;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 8px;
    white-space: nowrap;
}

.history-meta {
    display: flex;
    gap: 32px;
    margin: 14px 0;
}

.history-meta dt {
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.history-meta dd {
    margin: 4px 0 0;
}

.history-description {
    color: #374151;
    line-height: 1.5;
    margin-bottom: 0;
    white-space: pre-line;
}

.sr-only {
    height: 1px;
    margin: -1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

@media (max-width: 700px) {
    .settings-form,
    .group-form {
        grid-template-columns: 1fr;
    }

    .history-header,
    .history-meta {
        align-items: start;
        flex-direction: column;
        gap: 10px;
    }
}

/* =========================
   MAIN LAYOUT
========================= */

#main-content {
    display: flex;
    width: 100%;
    height: calc(100vh - 64px);
    margin-top: 64px;
}

/* =========================
   SIDEBAR
========================= */

#sidebar {
    width: 340px;
    min-width: 340px;

    background: white;
    border-right: 1px solid #e5e7eb;

    padding: 20px;
    overflow-y: auto;
}

#sidebar h2 {
    margin-top: 0;
    margin-bottom: 5px;
    color: #111827;
}

.subtitle {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

/* =========================
   MAP
========================= */

#map {
    flex: 1;
    height: 100%;
    width: 100%;
}

/* =========================
   BUTTONS
========================= */

#addPropertyBtn,
#saveEditBtn {
    width: 100%;
    padding: 12px;

    border: none;
    border-radius: 10px;

    color: white;
    font-size: 15px;
    font-weight: 600;

    cursor: pointer;
}

#addPropertyBtn {
    background: #2563eb;
    margin-bottom: 20px;
}

#addPropertyBtn:hover {
    background: #1d4ed8;
}

#saveEditBtn {
    background: #f59e0b;
    margin-bottom: 20px;
}

#saveEditBtn:hover {
    background: #d97706;
}

/* =========================
   PROPERTY CARDS
========================= */

.property-card {
    background: white;

    border: 1px solid #e5e7eb;
    border-radius: 12px;

    padding: 12px;
    margin-bottom: 12px;

    box-shadow: 0 2px 4px rgba(0,0,0,.05);
}

.property-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 10px;
}

.card-buttons {
    display: flex;
    gap: 8px;
}

.view-btn,
.edit-btn,
.delete-btn {
    flex: 1;

    border: none;
    border-radius: 8px;

    padding: 8px;

    cursor: pointer;
    font-weight: 600;

    color: white;
}

.view-btn {
    background: #2563eb;
}

.view-btn:hover {
    background: #1d4ed8;
}

.edit-btn {
    background: #f59e0b;
}

.edit-btn:hover {
    background: #d97706;
}

.delete-btn {
    background: #ef4444;
}

.delete-btn:hover {
    background: #dc2626;
}

/* =========================
   LEAFLET
========================= */

.leaflet-draw {
    display: none;
}

.weather-panel {
    margin-bottom: 25px;
}

.weather-toggle {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 8px 0;

    font-size: 14px;
    color: #374151;

    cursor: pointer;
}

.weather-toggle input {
    width: 16px;
    height: 16px;
}

.alert-card {
    background: #fef2f2;
    border: 1px solid #ef4444;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
}

.alert-title {
    font-weight: 700;
    color: #b91c1c;
}

.alert-property {
    margin-top: 4px;
    font-size: 14px;
}

.details-btn {
    margin-top: 8px;
    border: none;
    background: #2563eb;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.alert-details {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #374151;
}

.section-header {
    font-size: 13px;
    font-weight: 700;
    color: #6b7280;
    letter-spacing: 1px;
    margin-bottom: 10px;
    cursor: pointer;
}

#weatherPanel {
    margin-bottom: 20px;
}

.section-header {
    cursor: pointer;
    user-select: none;
}

#dashboardStats {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}

.stat-number {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
}

.alert-view-btn {
    margin-left: 10px;

    border: 1px solid #2563eb;
    border-radius: 6px;

    padding: 4px 8px;

    background: white;
    color: #2563eb;

    font-weight: 600;
    font-size: 12px;

    cursor: pointer;
}

.alert-view-btn:hover {
    background: #eff6ff;
}

.address-search {
    position: fixed;
    top: 88px;
    left: 364px;
    z-index: 700;
    width: min(390px, calc(100vw - 390px));
    padding: 14px;
    background: rgba(255, 255, 255, .97);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
}

.address-search label {
    display: block;
    margin-bottom: 8px;
    color: #1f2937;
    font-size: 13px;
    font-weight: 700;
}

.address-search-input { display: flex; gap: 8px; }
.address-search input { min-width: 0; flex: 1; padding: 10px 11px; border: 1px solid #cbd5e1; border-radius: 7px; font: inherit; }
.address-search button { border: 0; border-radius: 7px; background: #2563eb; color: white; cursor: pointer; font-weight: 600; padding: 0 13px; }
.address-search button:hover { background: #1d4ed8; }
.address-results { max-height: 240px; overflow-y: auto; margin-top: 8px; color: #4b5563; font-size: 13px; }
.address-results button { display: block; width: 100%; margin-top: 4px; padding: 10px; background: #fff; border: 1px solid #e5e7eb; color: #1f2937; text-align: left; }
.address-results button:hover { background: #eff6ff; border-color: #93c5fd; }
.choice-backdrop { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; background: rgba(15, 23, 42, .35); padding: 20px; }
.choice-backdrop[hidden], .address-search[hidden] { display: none !important; }
.choice-card { position: relative; width: min(390px, 100%); padding: 26px; border-radius: 14px; background: white; box-shadow: 0 18px 55px rgba(15, 23, 42, .25); }
.choice-card h2 { margin: 0 0 8px; }
.choice-card p { margin: 0 0 20px; color: #4b5563; }
.choice-card button:not(.choice-close) { display: block; width: 100%; margin-top: 10px; padding: 12px; border: 0; border-radius: 8px; background: #2563eb; color: white; cursor: pointer; font: inherit; font-weight: 600; }
.choice-card .secondary-button { background: #e5e7eb !important; color: #1f2937 !important; }
.choice-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; color: #6b7280; cursor: pointer; font-size: 24px; }

@media (max-width: 800px) {
    .address-search { left: 12px; top: 76px; width: calc(100vw - 24px); }
}

.back-home { display: inline-block; margin-bottom: 20px; color: #2563eb; font-size: 14px; font-weight: 700; text-decoration: none; }
.back-home:hover { text-decoration: underline; }
.admin-totals { display: flex; gap: 12px; margin: 20px 0; }.admin-account { margin-top: 18px; padding: 20px; border: 1px solid #e2e8f0; border-radius: 12px; background: white; }.admin-account h2 { margin: 0; font-size: 19px; }.admin-account h2 span { color: #2563eb; font-size: 13px; font-weight: 700; text-transform: uppercase; }.admin-account h3 { margin: 18px 0 8px; font-size: 14px; }.admin-account p { color: #64748b; }

.marketing-page { min-height: 100vh; background: #f8fafc; color: #172033; }
.marketing-nav { height: 72px; display: flex; align-items: center; justify-content: space-between; max-width: 1180px; margin: auto; padding: 0 28px; }
.marketing-logo { color: #172033; font-size: 20px; font-weight: 800; text-decoration: none; }
.marketing-nav nav { display: flex; align-items: center; gap: 22px; }.marketing-nav nav a { color: #475569; font-weight: 600; text-decoration: none; }.marketing-nav .nav-cta { padding: 10px 15px; border-radius: 8px; background: #1d4ed8; color: white; }
.hero { max-width: 850px; margin: 72px auto 55px; padding: 36px 28px; text-align: center; }.eyebrow { color: #2563eb; font-size: 12px; font-weight: 800; letter-spacing: .12em; }.hero h1, .about-main h1 { margin: 12px 0 18px; font-size: clamp(38px, 6vw, 66px); line-height: 1.04; letter-spacing: -.045em; }.hero-copy { max-width: 680px; margin: auto; color: #526176; font-size: 19px; line-height: 1.6; }.hero-actions { display: flex; justify-content: center; align-items: center; gap: 24px; margin-top: 30px; }.primary-cta { padding: 13px 19px; border-radius: 9px; background: #2563eb; color: white; font-weight: 700; text-decoration: none; }.text-cta { color: #1d4ed8; font-weight: 700; text-decoration: none; }
.benefit-grid, .source-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; max-width: 1080px; margin: auto; padding: 0 28px; }.benefit-grid article, .source-list article, .notice-card { padding: 24px; border: 1px solid #e2e8f0; border-radius: 14px; background: white; }.benefit-grid h2, .source-list h3 { margin: 0 0 8px; font-size: 18px; }.benefit-grid p, .source-list p { margin: 0; color: #64748b; line-height: 1.5; }.notice-card { display: flex; flex-direction: column; gap: 5px; max-width: 1024px; margin: 42px auto; color: #526176; }.notice-card strong { color: #172033; }.about-main { max-width: 840px; margin: 60px auto; padding: 20px 28px 60px; }.about-main > p { color: #526176; font-size: 17px; line-height: 1.7; }.about-main h2 { margin-top: 42px; }.source-list { grid-template-columns: repeat(2, 1fr); padding: 0; }.source-list a { display: inline-block; margin-top: 14px; color: #1d4ed8; font-weight: 700; }
.coverage-section { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; align-items: center; max-width: 1080px; margin: 64px auto 0; padding: 38px 28px; border-top: 1px solid #e2e8f0; }.coverage-section h2 { margin: 8px 0 12px; font-size: 30px; letter-spacing: -.02em; }.coverage-section p, .coverage-section li { color: #526176; line-height: 1.55; }.coverage-section h3 { margin: 22px 0 6px; }.coverage-section ul { padding-left: 20px; }.coverage-note { font-size: 14px; }.coverage-section #coverageMap { min-height: 330px; border: 1px solid #cbd5e1; border-radius: 14px; overflow: hidden; background: #eaf2fb; }
@media (max-width: 700px) { .marketing-nav { padding: 0 18px; }.hero { margin-top: 25px; }.benefit-grid, .source-list, .coverage-section { grid-template-columns: 1fr; }.coverage-section { margin-top: 36px; gap: 18px; }.hero-actions { flex-direction: column; gap: 16px; } }
