/* ==========================================================================
   FamSync DSS - theme (electric blue + navy, light) · Bootstrap 5 overrides
   Mobile-first: base styles target phones; media queries scale up.
   ========================================================================== */

/* Palette sampled from the reference image (Theme_color.jpg):
   navy  #0C1635 / #0A0928 / #142444 · blue #449CEC / #2075B6 / #2C6CAC / #1C598D
   cyan  #52D3FD / #6CF4FC / #99E0FC · neutrals #FFFFFF / #F3F5F7 / #ECF4F4 / #E6EAED / #B3B9BD */
:root {
  --navy: #0C1635;
  --navy-deep: #0A0928;
  --navy-2: #142444;
  --blue-bright: #449CEC;
  --blue: #2075B6;
  --blue-mid: #2C6CAC;
  --blue-deep: #1C598D;
  --cyan: #52D3FD;
  --cyan-glow: #6CF4FC;
  --cyan-soft: #99E0FC;

  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --surface-alt: #ECF4F4;
  --ink: #0C1635;
  --muted: #55607A;
  --line: #E6EAED;
  --line-strong: #B3B9BD;
  --pine: #2075B6;
  --pine-ink: #1C598D;
  --pine-soft: rgba(68, 156, 236, 0.14);
  --clay: #52D3FD;
  --amber: #F2A93B;
  --sage: #2FB6A3;
  --danger: #E2504F;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(12, 22, 53, .07), 0 6px 20px rgba(12, 22, 53, .08);
  --sidebar-w: 272px;
  --btn-gap: .75rem;

  /* Bootstrap variable mapping */
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-body-font-family: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-border-color: var(--line);
  --bs-primary: #2075B6;
  --bs-primary-rgb: 32, 117, 182;
  --bs-link-color: #2075B6;
  --bs-link-hover-color: #1C598D;
  --bs-link-color-rgb: 32, 117, 182;
  --bs-border-radius: 9px;
  --bs-secondary-color: #55607A;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--bs-body-font-family); min-height: 100vh; }
h1, h2, h3, h4, .page-title, .hero-title, .section-title { font-family: "Fraunces", Georgia, serif; letter-spacing: -.01em; color: var(--ink); }
a { color: var(--pine); }
a:hover { color: var(--pine-ink); }
.text-muted { color: var(--muted) !important; }
.text-accent { color: var(--pine); }
code { color: var(--pine-ink); background: var(--surface-alt); padding: .1rem .35rem; border-radius: 5px; font-size: .85em; }

/* ---- Buttons / forms ---- */
.btn { font-weight: 600; border-radius: 9px; min-height: 40px; }
.btn-sm { min-height: 32px; }
.btn-lg { min-height: 48px; }
.btn-primary { --bs-btn-bg: #2075B6; --bs-btn-border-color: #2075B6; --bs-btn-hover-bg: #1C598D; --bs-btn-hover-border-color: #1C598D;
  --bs-btn-active-bg: #1C598D; --bs-btn-active-border-color: #1C598D; --bs-btn-disabled-bg: #2075B6; --bs-btn-disabled-border-color: #2075B6; --bs-btn-focus-shadow-rgb: 32, 117, 182; }
.btn-outline-primary { --bs-btn-color: #2075B6; --bs-btn-border-color: #2075B6; --bs-btn-hover-bg: #2075B6; --bs-btn-hover-border-color: #2075B6;
  --bs-btn-active-bg: #1C598D; --bs-btn-active-border-color: #1C598D; --bs-btn-focus-shadow-rgb: 32, 117, 182; }
.btn-light { --bs-btn-bg: var(--surface-alt); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: #E6EEFB; --bs-btn-hover-border-color: var(--line); --bs-btn-color: var(--ink); }
.btn-icon { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 1.15rem; color: var(--ink); }
.btn-icon:hover { background: var(--surface-alt); }
.btn-success-soft { background: rgba(47, 182, 163, .14); color: #1d8a7a; border: 1px solid transparent; }
.btn-success-soft:hover { background: #2FB6A3; color: #fff; }
.btn-danger-soft { background: rgba(226, 80, 79, .1); color: var(--danger); border: 1px solid transparent; }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }
.btn-warning-soft { background: rgba(242, 169, 59, .16); color: #a56a0c; border: 1px solid transparent; }
.btn-warning-soft:hover { background: var(--amber); color: #fff; }
.form-control, .form-select { min-height: 42px; border-color: var(--line-strong); background-color: var(--surface-alt); color: var(--ink); font-size: 16px; }
.form-control:focus, .form-select:focus { border-color: var(--pine); box-shadow: 0 0 0 .2rem rgba(32, 117, 182, .22); background-color: #fff; }
.form-label { font-weight: 600; font-size: .86rem; color: var(--ink); margin-bottom: .35rem; }
.form-label.small { font-size: .78rem; color: var(--muted); }
.input-group-text { background: var(--surface-alt); border-color: var(--line-strong); color: var(--muted); }
.form-check-input:checked { background-color: var(--pine); border-color: var(--pine); }
textarea.form-control { min-height: 90px; }
.needs-validation .form-control:invalid:not(:placeholder-shown):focus { box-shadow: 0 0 0 .2rem rgba(226, 80, 79, .18); }
.alert { border-radius: 12px; border: 1px solid transparent; }
.alert-danger { background: rgba(226, 80, 79, .1); border-color: rgba(226, 80, 79, .3); color: #8c2323; }
.alert-success { background: rgba(47, 182, 163, .12); border-color: rgba(47, 182, 163, .35); color: #17695c; }
.alert-warning { background: rgba(242, 169, 59, .14); border-color: rgba(242, 169, 59, .4); color: #7a5208; }
.alert-info { background: var(--pine-soft); border-color: rgba(32, 117, 182, .3); color: var(--pine-ink); }
.alert-priority { display: flex; gap: .75rem; align-items: center; background: rgba(226, 80, 79, .09); border: 1px solid rgba(226, 80, 79, .3); border-radius: 12px; padding: .75rem 1rem; margin-bottom: 1rem; }
.alert-priority > i { color: var(--danger); font-size: 1.1rem; }
.dropdown-menu { border-color: var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.dropdown-item { padding: .55rem 1rem; }
.pagination { --bs-pagination-active-bg: var(--pine); --bs-pagination-active-border-color: var(--pine); --bs-pagination-color: var(--pine); --bs-pagination-hover-color: var(--pine-ink); --bs-pagination-border-color: var(--line); }
.modal-content { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---- Badges ---- */
.badge-soft { font-weight: 600; padding: .38em .65em; border-radius: 20px; font-size: .72rem; }
.badge-primary { background: var(--pine-soft); color: var(--pine-ink); }
.badge-success { background: rgba(47, 182, 163, .16); color: #17695c; }
.badge-warning { background: rgba(242, 169, 59, .2); color: #8a5a07; }
.badge-danger { background: rgba(226, 80, 79, .14); color: #a52f2e; }
.badge-secondary { background: rgba(87, 100, 125, .14); color: var(--muted); }
.badge-info { background: rgba(82, 211, 253, .2); color: #1C598D; }

/* ---- Avatar ---- */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-block; }
.avatar-initials { background: var(--pine); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app-shell { min-height: 100vh; }
.app-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.sidebar { --bs-offcanvas-width: 288px; --bs-offcanvas-bg: var(--surface); }
.sidebar-inner { display: flex; flex-direction: column; height: 100%; padding: 1.1rem 1rem; gap: 1rem; overflow-y: auto; width: 100%; }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; }
.brand-link { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand-logo { border-radius: 10px; display: block; }
.brand-name { font-family: "Fraunces", Georgia, serif; font-size: 1.35rem; font-weight: 600; color: var(--ink); }
.household-chip { display: flex; align-items: center; gap: .5rem; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .75rem; font-size: .85rem; color: var(--muted); }
.household-chip i { color: var(--pine); }
.sidebar-nav { display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.nav-section { font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 1rem .75rem .3rem; }
.nav-link-app { display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; min-height: 44px; }
.nav-link-app i { font-size: 1.1rem; color: var(--muted); }
.nav-link-app:hover { background: var(--surface-alt); color: var(--ink); }
.nav-link-app.active { background: var(--pine-soft); color: var(--pine-ink); font-weight: 600; }
.nav-link-app.active i { color: var(--pine); }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: .9rem; }
.user-card { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--ink); padding: .4rem; border-radius: 10px; }
.user-card:hover { background: var(--surface-alt); color: var(--ink); }
.user-card-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-card-text strong { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-text small { color: var(--muted); }

.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; padding: .65rem 1rem; padding-top: calc(.65rem + env(safe-area-inset-top, 0px));
  background: rgba(243, 245, 247, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-title { font-size: 1.15rem; font-weight: 600; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.bell-badge { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.bell-menu { width: min(360px, calc(100vw - 1.5rem)); overflow: hidden; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.bell-list { max-height: 320px; overflow-y: auto; padding: .6rem 1rem; }
.bell-foot { padding: .6rem 1rem; border-top: 1px solid var(--line); background: var(--surface-alt); }

.content { flex: 1; padding: 1rem; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); width: 100%; max-width: 1500px; margin: 0 auto; }
.app-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem; padding: 1rem; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); }

@media (min-width: 992px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--line); z-index: 1030; visibility: visible; transform: none; }
  .app-main { margin-left: var(--sidebar-w); }
  .topbar { padding: .8rem 2rem; }
  .content { padding: 1.6rem 2rem 2rem; }
  .app-footer { padding: 1rem 2rem; }
}

/* ---- Page header / cards ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.page-title { font-size: 1.5rem; font-weight: 600; margin: 0 0 .15rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.card-app { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
@media (min-width: 768px) { .card-app { padding: 1.25rem; } .page-title { font-size: 1.75rem; } }
.card-app.p-0 { padding: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.card-head h3, .card-title-sm { font-family: "Work Sans", sans-serif; font-size: 1rem; font-weight: 700; margin: 0 0 .5rem; }
.card-head h3 { margin: 0; }
.filter-card { padding: 1rem; }

/* ---- Statistic cards ---- */
.stat-card { display: flex; align-items: center; gap: .85rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; box-shadow: var(--shadow); height: 100%; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.bg-primary-soft { background: var(--pine-soft); color: var(--pine); }
.bg-info-soft { background: rgba(82, 211, 253, .2); color: #1C8CD4; }
.bg-success-soft { background: rgba(47, 182, 163, .16); color: #1d8a7a; }
.bg-warning-soft { background: rgba(242, 169, 59, .2); color: #b87708; }
.stat-label { font-size: .76rem; color: var(--muted); font-weight: 600; }
.stat-value { font-family: "Fraunces", Georgia, serif; font-size: 1.7rem; font-weight: 600; line-height: 1.1; }
.stat-sub { font-size: .74rem; color: var(--muted); }
.pri { border-radius: 12px; padding: .8rem .4rem; border: 1px solid var(--line); }
.pri span { display: block; font-family: "Fraunces", Georgia, serif; font-size: 1.8rem; font-weight: 600; line-height: 1.1; }
.pri small { color: var(--muted); font-size: .72rem; display: block; }
.pri-high { background: rgba(226, 80, 79, .08); } .pri-high span { color: var(--danger); }
.pri-med { background: rgba(242, 169, 59, .1); } .pri-med span { color: #b87708; }
.pri-low { background: rgba(47, 182, 163, .1); } .pri-low span { color: #1d8a7a; }
.chart-box { position: relative; }

/* ---- Feeds / status ---- */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.feed li { display: flex; gap: .65rem; align-items: flex-start; }
.icon-dot { width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .95rem; }
.dot-primary { background: var(--pine-soft); color: var(--pine); } .dot-info { background: rgba(82, 211, 253, .2); color: #1C8CD4; }
.dot-success { background: rgba(47, 182, 163, .16); color: #1d8a7a; } .dot-warning { background: rgba(242, 169, 59, .2); color: #b87708; }
.dot-danger { background: rgba(226, 80, 79, .12); color: var(--danger); } .dot-secondary { background: rgba(87, 100, 125, .14); color: var(--muted); }
.feed-body { min-width: 0; }
.feed-title { font-weight: 600; font-size: .86rem; overflow-wrap: anywhere; }
.feed-meta { font-size: .74rem; color: var(--muted); }
.status-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; font-size: .84rem; }
.status-list li { display: flex; align-items: center; gap: .5rem; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-dot.ok { background: var(--sage); } .status-dot.warn { background: var(--amber); }
.status-name { color: var(--muted); }
.status-val { margin-left: auto; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.2rem; color: var(--pine); opacity: .7; display: block; margin-bottom: .4rem; }
.empty-state.small { padding: 1rem 0; }
.empty-state.small i { display: inline; font-size: 1rem; }

/* ---- Tables (responsive: cards on phones) ---- */
.table-app { --bs-table-bg: transparent; margin: 0; }
.table-app thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-alt); border-bottom: 1px solid var(--line); padding: .75rem 1rem; white-space: nowrap; }
.table-app tbody td { padding: .8rem 1rem; border-color: var(--line); vertical-align: middle; }
.table-app tbody tr:hover { background: rgba(68, 156, 236, .05); }
.row-done .fw-semibold { text-decoration: line-through; color: var(--muted); }
.table-foot { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: .85rem 1rem; border-top: 1px solid var(--line); }
@media (min-width: 576px) { .table-foot { flex-direction: row; justify-content: space-between; } }
.cat-chip { --c: #2075B6; display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 600; padding: .25rem .6rem; border-radius: 20px; color: var(--c); background: var(--pine-soft); background: color-mix(in srgb, var(--c) 13%, white); white-space: nowrap; }
.quick-filters { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.chip { display: inline-block; font-size: .78rem; font-weight: 600; padding: .3rem .75rem; border-radius: 20px; background: var(--surface-alt); border: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.chip:hover { color: var(--pine); border-color: var(--pine); }
.chip.active { background: var(--pine); border-color: var(--pine); color: #fff; }
.actions { white-space: nowrap; }
.actions .btn { margin-left: .15rem; }

@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { display: grid; grid-template-columns: 34% 1fr; column-gap: .75rem; padding: .3rem 0; border: 0; text-align: left; align-items: start; }
  .table-stack td::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 6; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: .15rem; }
  .table-stack td > * { grid-column: 2; }
  .table-stack td:first-child { display: block; }
  .table-stack td:first-child::before { display: none; }
  .table-stack td.actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: .4rem; padding-top: .6rem; }
  .table-stack td.actions::before { display: none; }
  .table-stack .empty-row td { display: block; }
  .table-stack .empty-row td::before { display: none; }
  .table-stack td.text-end { text-align: left !important; }
}

/* ---- Notes ---- */
.note-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem; box-shadow: var(--shadow); }
.note-body { overflow-wrap: anywhere; }
.cat-list { display: flex; flex-direction: column; gap: .5rem; }
.cat-row { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-alt); }

/* ---- Reports ---- */
.preview-bar { display: none; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; background: var(--ink); color: #fff; border-radius: 12px; padding: .6rem 1rem; margin-bottom: .75rem; }
.report-paper { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.report-head { display: flex; align-items: center; gap: 1rem; padding-bottom: 1rem; border-bottom: 3px solid var(--pine); margin-bottom: 1rem; }
.report-logo { border-radius: 12px; }
.report-org h2 { font-size: 1.35rem; margin: 0; }
.report-org div { font-size: .85rem; color: var(--muted); }
.report-title h3 { font-size: 1.2rem; margin-bottom: .4rem; }
.report-meta { display: grid; grid-template-columns: 1fr; gap: .15rem; font-size: .85rem; margin-bottom: 1rem; }
@media (min-width: 768px) { .report-meta { grid-template-columns: 1fr 1fr; } .report-paper { padding: 2rem; } }
.report-section { font-family: "Work Sans", sans-serif; font-size: 1rem; font-weight: 700; margin: 1.25rem 0 .5rem; color: var(--pine-ink); }
.report-table { font-size: .82rem; margin-bottom: .25rem; }
.report-table thead th { background: var(--pine-soft); color: var(--pine-ink); border-bottom: 2px solid var(--pine); white-space: nowrap; }
.report-table td, .report-table th { padding: .45rem .6rem; border-color: var(--line); }
.report-count { text-align: right; font-size: .78rem; color: var(--muted); }
.report-foot { display: flex; justify-content: space-around; gap: 2rem; margin-top: 3rem; text-align: center; }
.report-foot > div { flex: 1; max-width: 260px; }
.sig-line { display: block; border-top: 1px solid var(--ink); margin-bottom: .25rem; }
body.print-preview .sidebar, body.print-preview .topbar, body.print-preview .page-head, body.print-preview #reportForm, body.print-preview .app-footer { display: none !important; }
body.print-preview .app-main { margin-left: 0; }
body.print-preview .preview-bar { display: flex; position: sticky; top: .5rem; z-index: 1000; }
body.print-preview .report-paper { max-width: 900px; margin: 0 auto; }

@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .app-footer, .preview-bar, .page-head, #reportForm, .alert, .modal { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  .report-paper { border: 0; box-shadow: none; padding: 0; }
  .report-table thead { display: table-header-group; }
  .report-table tr { page-break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* ==========================================================================
   Auth pages
   ========================================================================== */
.auth-body { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; }
.auth-aside { flex: 1 1 46%; background: linear-gradient(155deg, #0C1635 0%, #14307A 60%, #1C598D 100%); color: #fff; align-items: center; justify-content: center; padding: 3rem; }
.auth-aside-inner { max-width: 440px; }
.auth-aside h2 { color: #fff; font-size: 2.2rem; margin-bottom: 1rem; }
.auth-aside p { color: rgba(255, 255, 255, .8); font-size: 1.05rem; }
.auth-points { list-style: none; padding: 0; margin: 1.75rem 0 0; display: flex; flex-direction: column; gap: .75rem; }
.auth-points i { color: #52D3FD; margin-right: .6rem; }
.auth-main { flex: 1 1 54%; display: flex; align-items: center; justify-content: center; padding: 1.25rem; padding-top: calc(1.25rem + env(safe-area-inset-top, 0px)); }
.auth-card { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.5rem; box-shadow: var(--shadow); }
@media (min-width: 576px) { .auth-card { padding: 2.25rem; } }
.auth-card h1 { font-size: 1.7rem; margin-bottom: .25rem; }
.auth-brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); font-family: "Fraunces", Georgia, serif; font-size: 1.2rem; font-weight: 600; margin-bottom: 1.25rem; }
.auth-brand img { border-radius: 10px; }
.captcha-q { color: var(--pine-ink); background: var(--pine-soft); padding: .1rem .5rem; border-radius: 6px; white-space: nowrap; }

/* ==========================================================================
   Landing page
   ========================================================================== */
.landing-nav { padding: .75rem 0; padding-top: calc(.75rem + env(safe-area-inset-top, 0px)); background: rgba(243, 245, 247, .9); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 1020; border-bottom: 1px solid var(--line); }
.hero { padding: 2.5rem 0 3rem; }
.hero-title { font-size: 2.1rem; font-weight: 700; line-height: 1.12; margin-bottom: 1rem; }
@media (min-width: 768px) { .hero { padding: 4.5rem 0 5rem; } .hero-title { font-size: 3rem; } }
.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.1rem; box-shadow: 0 18px 50px rgba(32, 117, 182, .22); }
.hero-row { display: flex; align-items: center; gap: .8rem; padding: .85rem .6rem; border-bottom: 1px solid var(--line); }
.hero-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hero-row small { color: var(--muted); }
.pri-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pri-dot.high { background: var(--danger); } .pri-dot.med { background: var(--amber); } .pri-dot.low { background: var(--sage); }
.hero-foot { padding: .85rem .6rem .2rem; color: var(--muted); font-size: .85rem; }
.hero-foot i { color: var(--pine); }
.section { padding: 3rem 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-title { font-size: 1.7rem; font-weight: 600; }
@media (min-width: 768px) { .section { padding: 4.5rem 0; } .section-title { font-size: 2.2rem; } }
.feature-card, .step-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; height: 100%; box-shadow: var(--shadow); }
.section-alt .step-card { background: var(--surface-alt); box-shadow: none; }
.feature-card h3, .step-card h3 { font-family: "Work Sans", sans-serif; font-size: 1.05rem; font-weight: 700; margin: .9rem 0 .35rem; }
.feature-card p, .step-card p { color: var(--muted); margin: 0; font-size: .92rem; }
.step-no { width: 38px; height: 38px; border-radius: 50%; background: var(--pine); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.landing-foot { padding: 1.5rem 0; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); font-size: .85rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  [data-aos] { opacity: 1 !important; transform: none !important; }
}

/* ==========================================================================
   v2 additions: fluid sizing · filter grid · reCAPTCHA · password meter
   ========================================================================== */

/* ---- Fluid root size: everything in rem scales smoothly phone -> tablet -> desktop ---- */
html { font-size: clamp(15px, 14.2px + .22vw, 17px); }
body { font-size: 1rem; line-height: 1.5; }
.page-title   { font-size: clamp(1.4rem, 1.05rem + 1.1vw, 1.95rem); }
.topbar-title { font-size: clamp(1.02rem, .95rem + .35vw, 1.25rem); }
.stat-value   { font-size: clamp(1.45rem, 1.1rem + 1.1vw, 2rem); }
.pri span     { font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.1rem); }
.hero-title   { font-size: clamp(1.95rem, 1.2rem + 3.2vw, 3.3rem); }
.section-title{ font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2.3rem); }
.auth-card h1 { font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem); }
.auth-aside h2{ font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.4rem); }
.brand-name   { font-size: clamp(1.2rem, 1.1rem + .3vw, 1.4rem); }
.card-head h3, .card-title-sm { font-size: clamp(.95rem, .9rem + .2vw, 1.08rem); }
.lead { font-size: clamp(1rem, .95rem + .35vw, 1.2rem); }

/* ---- Cards & spacing ---- */
.card-app { padding: clamp(.9rem, .6rem + 1vw, 1.4rem); border-radius: clamp(12px, 1vw + 8px, 18px); }
.stat-card { padding: clamp(.8rem, .6rem + .7vw, 1.15rem); gap: clamp(.65rem, .5rem + .6vw, 1rem); }
.content { padding-inline: clamp(.85rem, .5rem + 1.8vw, 2rem); }
.page-head { margin-bottom: clamp(.9rem, .7rem + .8vw, 1.5rem); }

/* ---- Buttons (fluid size, comfortable touch targets) ---- */
.btn { font-size: clamp(.86rem, .82rem + .2vw, .96rem); padding: .5rem clamp(.85rem, .6rem + .8vw, 1.25rem); min-height: clamp(40px, 2.4rem + .25vw, 44px); line-height: 1.25; }
.btn-sm { font-size: clamp(.78rem, .75rem + .15vw, .86rem); padding: .3rem clamp(.6rem, .45rem + .5vw, .85rem); min-height: clamp(34px, 2rem + .3vw, 38px); }
.btn-lg { font-size: clamp(.95rem, .9rem + .25vw, 1.08rem); min-height: clamp(46px, 2.7rem + .3vw, 52px); }
.btn-icon { width: clamp(40px, 2.4rem + .3vw, 44px); height: clamp(40px, 2.4rem + .3vw, 44px); font-size: clamp(1.05rem, 1rem + .25vw, 1.25rem); }
.btn i, .nav-link-app i { line-height: 1; }
.actions .btn-sm { min-width: 36px; }
@media (pointer: coarse) { .btn-sm { min-height: 40px; min-width: 40px; } .nav-link-app { min-height: 48px; } }

/* ---- Icons ---- */
.stat-icon { width: clamp(40px, 2.3rem + .9vw, 54px); height: clamp(40px, 2.3rem + .9vw, 54px); font-size: clamp(1.1rem, 1rem + .5vw, 1.45rem); border-radius: clamp(10px, .6rem + .3vw, 14px); }
.icon-dot { width: clamp(30px, 1.8rem + .3vw, 36px); height: clamp(30px, 1.8rem + .3vw, 36px); }
.nav-link-app i { font-size: clamp(1.05rem, 1rem + .2vw, 1.2rem); width: 1.4em; text-align: center; }
.empty-state i { font-size: clamp(2rem, 1.6rem + 1.2vw, 3rem); }
.avatar-initials { font-weight: 700; }

/* ---- Forms ---- */
.form-control, .form-select { min-width: 0; max-width: 100%; min-height: clamp(42px, 2.5rem + .3vw, 46px); }
input[type="date"].form-control { min-width: 0; width: 100%; }
.form-label { font-size: clamp(.8rem, .78rem + .15vw, .9rem); }
.form-text, .small, small { font-size: clamp(.74rem, .72rem + .15vw, .84rem); }

/* ---- Tables ---- */
.table-app { font-size: clamp(.82rem, .79rem + .2vw, .94rem); }
.table-app thead th { font-size: clamp(.68rem, .66rem + .15vw, .76rem); }
.table-app tbody td, .table-app thead th { padding-inline: clamp(.65rem, .45rem + .7vw, 1rem); }

/* ---- Charts ---- */
.chart-box { height: clamp(220px, 40vw, 300px); }
.chart-box-sm { height: clamp(210px, 38vw, 270px); }

/* ---- Sidebar fluid width ---- */
:root { --sidebar-w: clamp(240px, 19vw, 290px); }

/* ---- Filter grid (never overflows) ---- */
.filter-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.5rem), 1fr)); align-items: end; }
.filter-grid .fg { min-width: 0; }
.filter-grid .fg-wide { grid-column: 1 / -1; }
@media (min-width: 576px) { .filter-grid .fg-wide { grid-column: span 2; } }
.filter-grid .fg-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
@media (max-width: 479.98px) { .filter-grid .fg-actions .btn { flex: 1 1 calc(50% - .25rem); } }
.report-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 575.98px) { .report-actions .btn { flex: 1 1 100%; } }
.filter-card { overflow: hidden; }
.card-app .input-group { flex-wrap: nowrap; }
.card-app .input-group > .form-control { min-width: 0; }

/* ---- reCAPTCHA ("I'm not a robot") - centered and scaled on any width ---- */
.captcha-box { display: flex; justify-content: center; width: 100%; overflow: visible; min-height: 78px; }
.captcha-inner { flex: 0 0 auto; width: 304px; height: 78px; transform-origin: center top; }
.captcha-inner .g-recaptcha { width: 304px; height: 78px; }
.captcha-error { margin-top: .5rem; text-align: center; color: var(--danger); font-size: .86rem; font-weight: 600; }
.captcha-error[hidden] { display: none; }
.captcha-box.is-invalid .captcha-inner { outline: 2px solid rgba(226, 80, 79, .55); outline-offset: 2px; border-radius: 6px; }

/* ---- Password strength meter ---- */
.pw-meter { margin-top: .5rem; }
.pw-bars { display: flex; gap: 5px; }
.pw-bars span { flex: 1; height: 6px; border-radius: 4px; background: var(--line); transition: background-color .25s ease; }
.pw-info { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-top: .35rem; font-size: clamp(.74rem, .72rem + .15vw, .84rem); }
.pw-label { font-weight: 700; }
.pw-tip { color: var(--muted); text-align: right; }
.pw-meter[data-level="weak"] .pw-bars span:nth-child(-n+1) { background: var(--danger); }
.pw-meter[data-level="good"] .pw-bars span:nth-child(-n+2) { background: var(--amber); }
.pw-meter[data-level="strong"] .pw-bars span:nth-child(-n+3) { background: var(--pine); }
.pw-meter[data-level="very strong"] .pw-bars span { background: var(--sage); }
.pw-meter[data-level="weak"] .pw-label { color: var(--danger); }
.pw-meter[data-level="good"] .pw-label { color: #b87708; }
.pw-meter[data-level="strong"] .pw-label { color: var(--pine-ink); }
.pw-meter[data-level="very strong"] .pw-label { color: #1d8a7a; }
/* textbox outline follows the level */
.input-group[data-pw-level="weak"] .form-control, .input-group[data-pw-level="weak"] .btn, .form-control[data-pw-level="weak"] { border-color: var(--danger); }
.input-group[data-pw-level="good"] .form-control, .input-group[data-pw-level="good"] .btn, .form-control[data-pw-level="good"] { border-color: var(--amber); }
.input-group[data-pw-level="strong"] .form-control, .input-group[data-pw-level="strong"] .btn, .form-control[data-pw-level="strong"] { border-color: var(--pine); }
.input-group[data-pw-level="very strong"] .form-control, .input-group[data-pw-level="very strong"] .btn, .form-control[data-pw-level="very strong"] { border-color: var(--sage); }
.input-group[data-pw-level="weak"] { box-shadow: 0 0 0 .2rem rgba(226, 80, 79, .14); border-radius: 9px; }
.input-group[data-pw-level="good"] { box-shadow: 0 0 0 .2rem rgba(242, 169, 59, .2); border-radius: 9px; }
.input-group[data-pw-level="strong"] { box-shadow: 0 0 0 .2rem rgba(32, 117, 182, .2); border-radius: 9px; }
.input-group[data-pw-level="very strong"] { box-shadow: 0 0 0 .2rem rgba(47, 182, 163, .2); border-radius: 9px; }
.form-control[data-pw-level="weak"] { box-shadow: 0 0 0 .2rem rgba(226, 80, 79, .14); }
.form-control[data-pw-level="good"] { box-shadow: 0 0 0 .2rem rgba(242, 169, 59, .2); }
.form-control[data-pw-level="strong"] { box-shadow: 0 0 0 .2rem rgba(32, 117, 182, .2); }
.form-control[data-pw-level="very strong"] { box-shadow: 0 0 0 .2rem rgba(47, 182, 163, .2); }
.form-control[data-pw-match="no"] { border-color: var(--danger); box-shadow: 0 0 0 .2rem rgba(226, 80, 79, .14); }
.form-control[data-pw-match="yes"] { border-color: var(--sage); box-shadow: 0 0 0 .2rem rgba(47, 182, 163, .2); }
.pw-match { font-size: clamp(.74rem, .72rem + .15vw, .84rem); font-weight: 600; margin-top: .3rem; }
.pw-match.ok { color: #1d8a7a; } .pw-match.no { color: var(--danger); }

/* ==========================================================================
   v3: reference-image theme (navy + blue + cyan) and clean, centered buttons
   ========================================================================== */

/* ---- Buttons: true centering (icon + label share one flex row, equal side padding) ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-align: center; vertical-align: middle;
  padding-block: .55rem; padding-inline: clamp(1rem, .8rem + .6vw, 1.35rem); line-height: 1.2; }
.btn > i, .btn > .bi { margin: 0 !important; flex: 0 0 auto; line-height: 1; font-size: 1.08em; }
.btn .me-1, .btn .me-2 { margin-right: 0 !important; }
.btn-sm { gap: .4rem; padding-block: .3rem; padding-inline: clamp(.65rem, .5rem + .5vw, .9rem); }
.btn-lg { gap: .6rem; padding-inline: clamp(1.25rem, 1rem + .8vw, 1.75rem); }
.btn-icon { padding: 0; gap: 0; }
.btn-group > .btn, .btn-group > .btn-check + .btn { flex: 1 1 0; }

/* consistent spacing between neighbouring buttons everywhere */
.page-actions, .modal-actions, .fg-actions, .report-actions, .btn-row, .nav-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--btn-gap); }
.gap-2 { gap: var(--btn-gap) !important; }
.btn-row .btn { flex: 0 0 auto; }
@media (max-width: 575.98px) { .btn-row .btn { flex: 1 1 100%; } }

/* ---- Dark navy sidebar (from the reference slides) ---- */
.sidebar { --bs-offcanvas-bg: var(--navy); background: linear-gradient(185deg, #0C1635 0%, #0A0928 100%); color: #fff; border-right: 0; }
@media (min-width: 992px) { .sidebar { border-right: 1px solid rgba(255, 255, 255, .06); } }
.sidebar .brand-link, .sidebar .brand-name { color: #fff; }
.sidebar .household-chip { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .8); }
.sidebar .household-chip i { color: var(--cyan); }
.sidebar .nav-section { color: rgba(255, 255, 255, .45); }
.sidebar .nav-link-app { color: rgba(255, 255, 255, .82); }
.sidebar .nav-link-app i { color: var(--cyan-soft); }
.sidebar .nav-link-app:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar .nav-link-app.active { background: linear-gradient(90deg, rgba(68, 156, 236, .38), rgba(68, 156, 236, .1)); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.sidebar .nav-link-app.active i { color: var(--cyan-glow); }
.sidebar .sidebar-foot { border-top-color: rgba(255, 255, 255, .1); }
.sidebar .user-card { color: #fff; }
.sidebar .user-card:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar .user-card-text small { color: rgba(255, 255, 255, .6); }
.sidebar .btn-close { filter: invert(1) grayscale(1) brightness(200%); opacity: .85; }
.sidebar .avatar-initials { background: var(--blue-bright); }
.sidebar .brand-logo { box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 4px 14px rgba(68, 156, 236, .35); }

/* ---- Landing page: dark hero with glowing waveform ---- */
.landing-nav { background: rgba(10, 9, 40, .92); border-bottom: 1px solid rgba(255, 255, 255, .08); backdrop-filter: blur(10px); }
.landing-nav .brand-name { color: #fff; }
.landing-nav .brand-link { color: #fff; }
.nav-actions { margin-left: auto; flex-wrap: nowrap; }
.nav-actions .btn { min-width: 6.25rem; }
.landing-nav .btn-outline-primary, .hero .btn-outline-primary {
  --bs-btn-color: #fff; --bs-btn-border-color: rgba(255, 255, 255, .55); --bs-btn-hover-bg: #fff; --bs-btn-hover-color: var(--navy);
  --bs-btn-hover-border-color: #fff; --bs-btn-active-bg: #fff; --bs-btn-active-color: var(--navy); --bs-btn-active-border-color: #fff; }
.hero { position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(60% 75% at 80% 35%, rgba(68, 156, 236, .34) 0%, transparent 70%), linear-gradient(165deg, #0A0928 0%, #0C1635 50%, #142444 100%); }
.hero::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 75%; background: url(../img/wave.svg) center bottom / cover no-repeat; opacity: .5; pointer-events: none; }
.hero .container { position: relative; z-index: 1; }
.hero-title { color: #fff; }
.hero .text-accent { color: var(--cyan); }
.hero .lead, .hero .text-muted { color: rgba(255, 255, 255, .78) !important; }
.hero .badge-primary { background: rgba(82, 211, 253, .14); color: var(--cyan-soft); border: 1px solid rgba(82, 211, 253, .32); }
.hero-card { box-shadow: 0 24px 60px rgba(0, 0, 0, .38), 0 0 0 1px rgba(255, 255, 255, .08); }
.section-alt { background: #fff; }
.landing-foot { background: var(--navy-deep); color: rgba(255, 255, 255, .72); }
.landing-foot .text-muted { color: rgba(255, 255, 255, .5) !important; }

/* ---- Auth pages: same navy + waveform panel ---- */
.auth-aside { position: relative; overflow: hidden;
  background: radial-gradient(70% 60% at 70% 25%, rgba(68, 156, 236, .32), transparent 70%), linear-gradient(165deg, #0A0928 0%, #0C1635 55%, #142444 100%); }
.auth-aside::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 60%; background: url(../img/wave.svg) center bottom / cover no-repeat; opacity: .5; pointer-events: none; }
.auth-aside-inner { position: relative; z-index: 1; }
.auth-points i { color: var(--cyan); }
.auth-aside img { box-shadow: 0 0 0 1px rgba(255, 255, 255, .16), 0 10px 30px rgba(68, 156, 236, .4); }

/* ---- Small theme touch-ups ---- */
.topbar { background: rgba(243, 245, 247, .92); }
.report-table thead th { background: var(--pine-soft); }
a:focus-visible, .btn:focus-visible, .nav-link-app:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.hero-card { color: var(--ink); }
.hero-card strong { color: var(--ink); }
.hero-card small { color: var(--muted); }
