html, body {
    color: #243b56;
    background:
        radial-gradient(circle at top left, rgba(255, 232, 166, .52), transparent 26rem),
        radial-gradient(circle at top right, rgba(207, 226, 248, .62), transparent 28rem),
        linear-gradient(180deg, #f8fbff 0%, #f4f8fc 48%, #eef4fb 100%);
    font-family: "Segoe UI Variable Text", "Aptos", "Segoe UI", "Trebuchet MS", Arial, sans-serif;
}

:root {
    --app-page-max-width: 1500px;
    --app-page-gutter: 0;
    --app-content-padding-y: 1.25rem;
    --app-content-padding-x: 1.5rem;
    --app-hero-background: linear-gradient(135deg, #fff, #f1f6fd);
    --app-hero-border: 1px solid #dbe7f5;
    --app-hero-shadow: 0 4px 16px rgba(16, 24, 40, .04);
}

a, .btn-link {
    color: #174d88;
}

h1, h2, h3, h4, h5, h6 {
    color: #112f55;
    font-family: "Segoe UI Variable Display", "Aptos Display", "Segoe UI", "Trebuchet MS", Arial, sans-serif;
    letter-spacing: 0;
}

.btn-primary {
    color: #fff;
    background-color: #1d65a8;
    border-color: #174d88;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 .1rem white, 0 0 0 .25rem rgba(23, 77, 136, .28);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #174d88;
    border-color: #123f78;
}

.btn-success {
    color: #fff;
    background-color: #2f80ed;
    border-color: #1d65a8;
}

.btn-success:hover,
.btn-success:focus {
    background-color: #1d65a8;
    border-color: #174d88;
}

.btn-info {
    color: #123f78;
    background-color: #eaf3ff;
    border-color: #cfe1f5;
}

button:not(.btn-danger):not(.delete):not(.danger):focus-visible,
a:focus-visible {
    outline: 3px solid rgba(23, 77, 136, .28);
    outline-offset: 2px;
}

.button-primary,
.actions .save,
.record-actions .save,
.event-buttons .save,
.filters > button,
.toolbar > button {
    color: #fff !important;
    background: linear-gradient(135deg, #1d65a8, #123f78) !important;
    border-color: #174d88 !important;
}

.button-primary:hover,
.actions .save:hover,
.record-actions .save:hover,
.event-buttons .save:hover,
.filters > button:hover,
.toolbar > button:hover {
    background: linear-gradient(135deg, #185995, #0f3464) !important;
    border-color: #123f78 !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #2d73b9;
    box-shadow: 0 0 0 .2rem rgba(23, 77, 136, .15);
}

.card {
    border-color: #dce6f2;
    box-shadow: 0 10px 28px rgba(18, 62, 111, .07);
}

.home-page,
.executive-dashboard,
.household-registration,
.users-page,
.barangay-page,
.maternal-page,
.ehr-page,
.imm-page,
.phc-page,
.eopt-page,
.duplicate-page,
.blotter-page,
.summons-page,
.ordinance-page,
.resolution-page,
.resident-page {
    width: 100% !important;
    max-width: var(--app-page-max-width) !important;
    margin: 0 auto !important;
    padding: 0 !important;
}

.content > .home-page,
.content > .executive-dashboard,
.content > .household-registration,
.content > .users-page,
.content > .barangay-page,
.content > .maternal-page,
.content > .ehr-page,
.content > .imm-page,
.content > .phc-page,
.content > .eopt-page,
.content > .duplicate-page,
.content > .blotter-page,
.content > .summons-page,
.content > .ordinance-page,
.content > .resolution-page,
.content > .resident-page {
    padding: 0 !important;
}

.app-page-shell {
    width: 100%;
    max-width: var(--app-page-max-width);
    margin: 0 auto;
    padding-inline: var(--app-page-gutter);
}

.imm-hero,
.phc-hero,
.maternal-header,
.ehr-page > header,
.dashboard-header,
.barangay-header,
.users-header,
.registration-header,
.report-header,
.blotter-page > header,
.summons-page > header,
.ordinance-page > header,
.resolution-page > header {
    background: var(--app-hero-background) !important;
    border: var(--app-hero-border) !important;
    color: #112f55 !important;
    gap: 1rem !important;
    padding: 1.5rem !important;
    border-radius: 1rem !important;
    box-shadow: var(--app-hero-shadow) !important;
}

.imm-hero > i,
.phc-hero .hero-icon,
.maternal-header .header-icon,
.ehr-page > header > span,
.dashboard-header .header-icon,
.barangay-header .barangay-icon,
.users-header .header-icon,
.registration-header .header-icon,
.report-header .header-icon,
.blotter-page > header > span,
.summons-page > header > span,
.ordinance-page > header > span,
.resolution-page > header > span {
    display: grid !important;
    place-items: center !important;
    flex: 0 0 58px !important;
    width: 58px !important;
    height: 58px !important;
    padding: 0 !important;
    border-radius: .85rem !important;
    color: #fff !important;
    background: linear-gradient(135deg, #1d65a8, #123f78) !important;
    box-shadow: 0 8px 18px rgba(21, 75, 136, .2) !important;
    font-size: 1.35rem !important;
}

.imm-hero small,
.phc-hero small,
.maternal-header .eyebrow,
.ehr-page > header small,
.dashboard-header .eyebrow,
.barangay-header .eyebrow,
.users-header .eyebrow,
.registration-header .eyebrow,
.report-header small,
.blotter-page > header small,
.summons-page > header small,
.ordinance-page > header small,
.resolution-page > header small {
    color: #b78313 !important;
    font-size: .7rem !important;
    font-weight: 800 !important;
    letter-spacing: .12em !important;
    text-transform: uppercase !important;
}

.imm-hero h1,
.phc-hero h1,
.maternal-header h1,
.ehr-page > header h1,
.dashboard-header h1,
.barangay-header h1,
.users-header h1,
.registration-header h1,
.report-header h1,
.blotter-page > header h1,
.summons-page > header h1,
.ordinance-page > header h1,
.resolution-page > header h1 {
    margin: .15rem 0 .2rem !important;
    color: #112f55 !important;
    font-size: 2rem !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
}

.imm-hero p,
.phc-hero p,
.maternal-header p,
.ehr-page > header p,
.dashboard-header p,
.barangay-header p,
.users-header p,
.registration-header p,
.report-header p,
.blotter-page > header p,
.summons-page > header p,
.ordinance-page > header p,
.resolution-page > header p {
    margin: 0 !important;
    color: #667085 !important;
    font-size: .78rem !important;
}

.dashboard-header .primary-action,
.barangay-header .new-household-button,
.users-header .new-user-button,
.report-header .print-button,
.blotter-page > header button,
.summons-page > header button,
.ordinance-page > header button,
.resolution-page > header button {
    min-height: 42px !important;
    padding: .65rem .9rem !important;
    border-radius: .75rem !important;
    box-shadow: 0 10px 20px rgba(69, 93, 55, .14) !important;
    font-size: .72rem !important;
    font-weight: 800 !important;
}

.dashboard-header .primary-action,
.quick-actions a,
.barangay-header .new-household-button,
.users-header .new-user-button,
.report-header .print-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.blotter-page label,
.summons-page label,
.ordinance-page label,
.resolution-page label,
.maternal-page label,
.ehr-page label,
.imm-page label,
.phc-page .top-fields label,
.phc-page .form-field,
.users-page .form-field,
.household-registration .form-field,
.resident-page .profile-content label {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
}

.blotter-page input,
.blotter-page select,
.blotter-page textarea,
.summons-page input,
.summons-page select,
.summons-page textarea,
.ordinance-page input,
.ordinance-page select,
.ordinance-page textarea,
.resolution-page input,
.resolution-page select,
.resolution-page textarea,
.maternal-page input,
.maternal-page select,
.maternal-page textarea,
.ehr-page input,
.ehr-page select,
.ehr-page textarea,
.imm-page input,
.imm-page select,
.imm-page textarea,
.phc-page input,
.phc-page select,
.phc-page textarea,
.resident-page .profile-content .form-control,
.resident-page .profile-content .form-select,
.card .table .form-control.form-control-sm,
.card .table .form-select.form-select-sm,
.users-page .form-control,
.users-page .form-select {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 42px;
    box-sizing: border-box;
}

.card .table .form-control.form-control-sm,
.card .table .form-select.form-select-sm {
    min-width: 110px;
    min-height: 38px;
    font-size: .75rem;
}

input[type="checkbox"],
input[type="radio"],
.form-check-input {
    display: inline-block !important;
    width: 1rem !important;
    min-width: 1rem !important;
    max-width: 1rem !important;
    height: 1rem !important;
    min-height: 1rem !important;
    padding: 0 !important;
    margin: 0 .4rem 0 0 !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
}

label > input[type="checkbox"],
label > input[type="radio"] {
    flex: 0 0 auto !important;
}

.blotter-page textarea,
.summons-page textarea,
.ordinance-page textarea,
.resolution-page textarea,
.maternal-page textarea,
.ehr-page textarea,
.imm-page textarea,
.phc-page textarea,
.resident-page .profile-content textarea.form-control {
    min-height: 90px;
}

/* Sidebar links require global rules because NavLink rendering and visited-link
   styles can otherwise override component-scoped colors. */
.sidebar .nav-entry,
.sidebar .nav-entry:link,
.sidebar .nav-entry:visited,
.sidebar .nav-entry:hover,
.sidebar .nav-entry:focus,
.sidebar .nav-entry:active,
.sidebar .submenu-entry,
.sidebar .submenu-entry:link,
.sidebar .submenu-entry:visited,
.sidebar .submenu-entry:hover,
.sidebar .submenu-entry:focus,
.sidebar .submenu-entry:active {
    color: #fff !important;
    text-decoration: none !important;
}

.sidebar .nav-section-label {
    color: rgba(244, 255, 247, .78) !important;
}

.sidebar .entry-icon {
    color: #fff !important;
    background: rgba(255, 255, 255, .13) !important;
}

.sidebar .submenu-entry > i {
    color: rgba(255, 255, 255, .9) !important;
}

.sidebar .nav-entry:hover,
.sidebar .nav-entry.active,
.sidebar .submenu-entry:hover,
.sidebar .submenu-entry.active {
    background: rgba(255, 255, 255, .14) !important;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC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ZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Unified app palette: keep forms/pages on one consistent blue theme. */
:root {
    --theme-primary: #1d65a8;
    --theme-primary-strong: #174d88;
    --theme-primary-soft: #eaf3ff;
    --theme-ink: #123f78;
    --theme-border: #dce6f2;

    --bs-primary: #1d65a8;
    --bs-primary-rgb: 29, 101, 168;
    --bs-success: #1d65a8;
    --bs-success-rgb: 29, 101, 168;
    --bs-info: #eaf3ff;
    --bs-info-rgb: 234, 243, 255;
    --bs-link-color: #174d88;
    --bs-link-hover-color: #123f78;
}

.btn-success,
.btn-outline-success,
.btn-info,
.btn-outline-info,
.btn-warning,
.btn-outline-warning,
.btn-secondary,
.btn-outline-secondary {
    border-color: var(--theme-primary) !important;
}

.btn-success,
.btn-info,
.btn-warning,
.btn-secondary {
    color: #fff !important;
    background-color: var(--theme-primary) !important;
}

.btn-success:hover,
.btn-success:focus,
.btn-info:hover,
.btn-info:focus,
.btn-warning:hover,
.btn-warning:focus,
.btn-secondary:hover,
.btn-secondary:focus {
    color: #fff !important;
    background-color: var(--theme-primary-strong) !important;
    border-color: var(--theme-primary-strong) !important;
}

.btn-outline-success,
.btn-outline-info,
.btn-outline-warning,
.btn-outline-secondary {
    color: var(--theme-primary) !important;
    background-color: #fff !important;
}

.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-info:hover,
.btn-outline-info:focus,
.btn-outline-warning:hover,
.btn-outline-warning:focus,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    color: #fff !important;
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
}

.form-control,
.form-select,
.input-group-text {
    border-color: var(--theme-border);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--theme-primary) !important;
    box-shadow: 0 0 0 .2rem rgba(29, 101, 168, .15) !important;
}

.card,
.modal-content,
.offcanvas {
    border-color: var(--theme-border) !important;
}

.card-header,
.modal-header,
.table thead th {
    background-color: #f5f9ff;
    color: var(--theme-ink);
}

.badge.bg-success,
.badge.bg-info,
.badge.bg-warning,
.badge.bg-secondary,
.status-badge.badge-normal,
.status-badge.badge-info,
.status-badge.badge-warning,
.status-badge.badge-primary,
.status-badge.badge-neutral {
    color: #fff !important;
    background-color: var(--theme-primary) !important;
}

.eopt-child-page {
    --teal: var(--theme-primary) !important;
    --ink: var(--theme-ink) !important;
    --border: var(--theme-border) !important;
}

.scope-chip,
.count-badge,
.warning-count,
.risk-count,
.info-count,
.neutral-count,
.status-dot,
.heading-icon,
.metric-icon,
.data-icon {
    background: var(--theme-primary) !important;
    color: #fff !important;
}
