/* Warm Welcome: shared portal presentation. Existing task and permission logic is unchanged. */
:root {
  --wine: #750c32;
  --ink: #24232c;
  --muted: #65636c;
  --line: #e5ddd9;
  --tint: #f3e8e8;
  --white: #fffcf8;
  --surface: #f8f4ee;
  --field: #fff;
  --border: #d7ceca;
  --accent: #750c32;
}
body { background: var(--white); line-height: 1.6; }
body > header { height: 108px; padding: 24px 32px; border-bottom: 0; }
.brand h1 { color: var(--wine); font-size: 29px; letter-spacing: 4px; margin-bottom: 6px; }
.brand small { border: 0; padding: 0; color: var(--muted); letter-spacing: 4px; }
.header-controls { gap: 20px; }
.account { flex-wrap: wrap; justify-content: flex-end; }
.banner { border: 0; padding: 0 40px 10px 320px; text-align: right; font-size: 12px; }
.shell { grid-template-columns: 280px minmax(0,1fr); min-height: calc(100vh - 138px); }
#nav { border-right: 0; padding: 18px 20px; background: var(--surface); }
#nav button { min-height: 48px; padding: 12px 14px; gap: 14px; border-radius: 0 8px 8px 0; margin-bottom: 10px; font-size: 15px; }
#nav button[data-tab=Reports] { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 26px; border-top-left-radius: 0; }
#nav button.active { border-left: 4px solid var(--wine); }
main { padding: 22px 40px 48px; max-width: 1600px; }
h2 { font-size: 38px; letter-spacing: -.6px; }
h3 { font-size: 25px; }
button { border-radius: 8px; padding: 11px 18px; transition: background-color .15s, border-color .15s; }
button:hover { filter: none; }
button:not(.secondary):not(.text-button):hover { background-color: #5b0827; }
.secondary { background: transparent; color: var(--wine); border-color: var(--border); }
.secondary:hover, .text-button:hover { background: var(--tint); }
button:disabled { opacity: .65; }
input, select, textarea { background: var(--field); border-color: #bdb4b0; border-radius: 8px; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--wine); }
:focus-visible { outline: 3px solid #3267b5; outline-offset: 3px; }
.guided-toolbar { gap: 10px; margin: 12px 0 24px; }
.guided-toolbar button { border-color: transparent; color: var(--muted); font-weight: 500; }
.guided-toolbar [aria-pressed=true] { background: var(--tint); color: var(--wine); }
.page-subtitle { max-width: 72ch; line-height: 1.65; }
.section-tabs { gap: 8px; border-color: var(--line); padding-bottom: 10px; }
.section-tabs [role=tab] { border-color: transparent; border-radius: 8px; color: var(--muted); background: transparent; padding: 10px 17px; }
.section-tabs [aria-selected=true] { background: var(--tint); color: var(--wine); border-color: transparent; }
.section-tabs [role=tab]:hover { background: var(--tint); }
.record { padding: 24px 0; }
.record h3 { font: 600 21px/1.4 Arial,Helvetica,sans-serif; }
.record p { max-width: 72ch; overflow-wrap: anywhere; }
.badge { border-radius: 30px; background: var(--tint); color: var(--wine); padding: 4px 12px; }
th { letter-spacing: .5px; font-size: 12px; background: var(--surface); }
th:first-child, td:first-child { padding-left: 12px; }
tbody tr:hover { background: var(--surface); }
form { border-top-color: var(--line); }
form h3 { font: 600 23px/1.4 Arial,Helvetica,sans-serif; }
.filter-form, .local-filters { padding: 18px 0; gap: 16px; }
.guided-details { margin-top: 24px; padding: 8px 0; }
.guided-details > summary { font: 600 17px/1.5 Arial,Helvetica,sans-serif; padding: 16px 0; }
summary:hover { color: var(--ink); }
.guided-dialog, .resident-detail { border-radius: 16px; box-shadow: 0 20px 70px #23151b24; }
.guided-dialog h2 { font-size: 30px; }
.technical-help { margin: 0 0 0 280px; max-width: none; padding: 24px 40px; color: var(--muted); border-top: 1px solid var(--line); font-size: 13px; }
.technical-help p { max-width: 90ch; }
.menu-toggle { display: none; }

/* Home mirrors the selected option: welcome photo, attention rows, then common actions. */
.welcome-home { position: relative; padding-top: 12px; }
.welcome-home > #page-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.welcome-home > .guided-toolbar { justify-content: flex-end; margin: 0 0 12px; }
.welcome-intro h2 { font: 400 clamp(36px,4.4vw,64px)/1.08 Georgia,'Times New Roman',serif; color: var(--wine); letter-spacing: -1.5px; margin: 0 0 10px; }
.welcome-intro p { font-size: 21px; color: var(--muted); margin: 0 0 26px; }
.welcome-photo { display: block; width: 100%; height: clamp(180px,20vw,290px); object-fit: cover; object-position: center 55%; border-radius: 14px; margin-bottom: 26px; }
.guided-start .attention-heading { font: 500 28px/1.35 Arial,Helvetica,sans-serif; margin: 0 0 6px; }
.attention-list { display: block; }
.attention-list .attention-row { display: flex; flex-direction: row; align-items: center; width: 100%; gap: 20px; padding: 19px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: transparent; }
.attention-list .attention-row:hover { background: var(--surface); }
.task-icon { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; flex: 0 0 56px; border-radius: 50%; background: var(--tint); }
.task-icon img { width: 26px; height: 26px; }
.attention-list .task-copy { display: flex; flex-direction: column; gap: 3px; }
.attention-list strong { font-size: 18px; line-height: 1.4; }
.attention-list .task-copy > span { color: var(--muted); font-size: 15px; }
.attention-list .task-open { margin-left: auto; white-space: nowrap; color: var(--wine); font-size: 14px; }
.attention-empty { padding: 20px 0; border-bottom: 1px solid var(--line); }
.attention-empty strong, .attention-empty span { display: block; }
.attention-empty span { color: var(--muted); margin-top: 5px; }
.guided-start .common-heading { font: 500 23px/1.4 Arial,Helvetica,sans-serif; margin: 24px 0 14px; }
.guided-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 0 0 24px; }
.guided-actions button { border-radius: 9px; padding: 13px 17px; gap: 5px; }
.guided-actions .action-title { display: flex; align-items: center; gap: 12px; }
.guided-actions img { width: 22px; height: 22px; flex-shrink: 0; }
.guided-actions strong { font-size: 16px; }
.guided-actions button > span:last-child { font-size: 13px; }
.guided-actions .primary-task img { filter: invert(1); }
.guided-actions .secondary { border-color: var(--line); color: var(--ink); }
.guided-actions .secondary > span:last-child { color: var(--muted); }
.login { max-width: 480px; margin: 25px auto 30px; }
body:has(.login) main { width: 100%; max-width: none; }
body:has(.login) .banner { padding-left: 32px; }
body:has(#nav:empty) .technical-help { margin-left: 0; }
body:has(#nav:empty) .shell { display: block; }
#nav:empty { display: none; }
.login::before { content: ''; display: block; height: 150px; border-radius: 12px; margin-bottom: 26px; background: url('/assets/welcome-porch.webp') center 55% / cover; }

/* Existing preferences remain available; only first-visit default changes to light. */
:root[data-theme=dark] { --white: #1c191d; --surface: #242024; --field: #282329; --ink: #f3e9ee; --muted: #c4b7bf; --line: #4a3c44; --tint: #3d2831; --wine: #f0aec7; --border: #77616c; --accent: #a64a70; }
:root[data-theme=dark] .attention-list .attention-row { background: transparent; color: var(--ink); }
:root[data-theme=dark] .attention-list .attention-row:hover { background: var(--surface); }
:root[data-theme=dark] .section-tabs [role=tab] { background: transparent; color: var(--muted); border-color: transparent; }
:root[data-theme=dark] .section-tabs [aria-selected=true] { background: var(--tint); color: var(--wine); }
:root[data-theme=dark] .guided-toolbar [aria-pressed=true] { background: var(--tint); color: var(--wine); border-color: var(--border); }
:root[data-theme=dark] .task-icon img, :root[data-theme=dark] .guided-actions img { filter: invert(1); }
:root[data-theme=dark] #nav button[data-tab=Reports] { border-top-color: var(--line)!important; }
.large-text .attention-list .task-copy > span, .large-text .guided-actions button > span:last-child { font-size: 18px; }
.large-text #nav button { font-size: 18px; }

@media(min-width:1101px) {
  body > header { background: linear-gradient(to right,var(--surface) 280px,var(--white) 280px); }
  /* Help remains in reading order beside the heading, without covering controls. */
}
@media(max-width:1100px) and (min-width:761px) {
  .shell { grid-template-columns: 230px minmax(0,1fr); }
  #nav { padding: 18px 12px; }
  main { padding: 20px 26px 40px; }
  .technical-help { margin-left: 230px; padding: 24px 26px; }
  .banner { padding-left: 256px; }
  .guided-actions { grid-template-columns: 1fr; }
}
@media(max-width:760px) {
  body > header { height: auto; min-height: 82px; padding: 16px; flex-wrap: wrap; gap: 12px; align-items: center; }
  .brand h1 { font-size: 22px; letter-spacing: 3px; }
  .brand small { font-size: 9px; letter-spacing: 3px; }
  .header-controls { flex-direction: row; flex-wrap: wrap; gap: 8px; width: 100%; justify-content: space-between; }
  .theme-toggle { padding: 8px 12px; min-height: 44px; }
  .account { font-size: 12px; flex-direction: row; gap: 8px; align-items: center; }
  .account button { min-height: 44px; padding: 8px 12px; }
  .menu-toggle { display: block; margin-left: auto; min-height: 44px; }
  body:has(#nav:empty) .menu-toggle { display: none; }
  .banner { padding: 0 16px 10px; text-align: left; }
  .shell { display: block; min-height: 0; }
  #nav { display: none; border-bottom: 1px solid var(--line); padding: 12px; }
  #nav.menu-open { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; }
  #nav button { margin: 0; width: 100%; min-width: 0; padding: 12px 10px; border: 0; border-radius: 8px; font-size: 14px; }
  #nav button[data-tab=Reports] { border: 0; margin: 0; padding: 12px 10px; }
  #nav button.active { box-shadow: inset 3px 0 var(--wine); border: 0; }
  main { padding: 22px 18px 36px; }
  .welcome-home { padding-top: 12px; }
  .welcome-home > .guided-toolbar { justify-content: flex-start; margin-bottom: 18px; }
  .welcome-intro h2 { font-size: 40px; letter-spacing: -1px; }
  .welcome-intro p { font-size: 17px; margin-bottom: 20px; }
  .welcome-photo { height: 160px; border-radius: 10px; margin-bottom: 24px; }
  .guided-start .attention-heading { font-size: 24px; }
  .attention-list .attention-row { padding: 17px 0; gap: 12px; }
  .task-icon { width: 42px; height: 42px; flex-basis: 42px; }
  .task-icon img { width: 22px; height: 22px; }
  .attention-list strong { font-size: 16px; }
  .attention-list .task-copy > span { font-size: 14px; }
  .attention-list .task-open { display: none; }
  .guided-actions { grid-template-columns: 1fr; }
  .guided-actions button { padding: 13px 15px; }
  .technical-help { margin-left: 0; padding: 22px 18px; }
  .section-tabs { flex-wrap: wrap; overflow: visible; gap: 4px; }
  .section-tabs [role=tab] { white-space: normal; padding: 10px 12px; }
  .guided-toolbar { gap: 4px; }
  .guided-toolbar button { padding: 9px 10px; }
  .local-filters, .filter-form { grid-template-columns: 1fr; }
  .large-text .welcome-intro h2 { font-size: 42px; }
}
@media(prefers-reduced-motion:reduce) { button { transition: none; } }
@media print {
  .welcome-photo, .welcome-intro, .guided-toolbar, .technical-help { display: none!important; }
  .technical-help, main { margin: 0; }
  :root { --white:#fff; --surface:#fff; --ink:#000; --muted:#444; --line:#ccc; }
}
