/* D&V mobile refinement. Load after the existing style.css. */
:root {
  --paper: #fbf8f0;
  --white: #ffffff;
  --ink: #302c25;
  --sub: #6d665b;
  --honey: #f1ce64;
  --honey2: #fff1bf;
  --stroke: #e7e0d2;
  --danger: #a03c2b;
  --r: 20px;
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

html { scroll-padding-bottom: 112px; }
body { line-height: 1.5; }
button, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
button, a, input, textarea, select { scroll-margin: 20px; }
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 3px solid #896417;
  outline-offset: 3px;
}
button:disabled { opacity: .6; }
a { color: #735819; text-underline-offset: 3px; }
h1, h2, h3, p, b, strong { overflow-wrap: anywhere; }

.rail { background: #fffdf7; }
.brand { color: var(--ink); }
.brand small, .eyebrow, .hero-date, .meta-label, .storydate,
.intro-content .step { color: #786018; }
.navbtn { min-height: 48px; }
.navbtn.active {
  background: #faedbf;
  box-shadow: inset 3px 0 0 #c69b25;
}
.topline { flex-wrap: wrap; row-gap: 8px; }
.pill { background: #fffdf8; color: #625a49; }
.pagehead { align-items: flex-start; }
.pagehead h1 { line-height: 1.12; letter-spacing: -.045em; }
.pagehead p { max-width: 62ch; }
.primary, .secondary, .smallbtn, .status-choice {
  min-height: 44px;
  line-height: 1.35;
}
.primary, .accent {
  min-height: 48px;
  padding: 13px 18px;
  background: var(--honey);
  color: #302715;
  border-radius: 14px;
}
.primary:hover, .accent:hover { background: #e9c14c; }
.secondary, .smallbtn {
  background: #fffefa;
  border-color: #ded4bd;
  color: #4a4231;
}
.ghost { min-height: 44px; min-width: 44px; }
.primary, .secondary, .smallbtn, .chip, .room, .navbtn,
.bottom-nav button, .status-choice {
  transition: background-color 150ms ease, border-color 150ms ease,
    box-shadow 150ms ease;
}

.hero, .pane, .room {
  border-color: var(--stroke);
  box-shadow: 0 3px 18px rgb(91 72 29 / 3%);
}
.hero { border-radius: 24px; }
.hero-copy { background: #fffdf7; }
.hero-copy p { color: #625b50; }
.pane { padding: 20px; border-radius: 20px; }
.pane-head { align-items: flex-start; flex-wrap: wrap; }
.pane-head h3 { margin-bottom: 0; }
.pane-head + .mood-rows { margin-top: 16px; }
.pane h3 { line-height: 1.2; }
.mood-rows { align-items: stretch; gap: 10px; }
.mood-person {
  min-width: 0;
  background: #fff5d8;
  border: 1px solid #f1e4bc;
  padding: 16px 13px;
  border-radius: 16px;
}
.mood-person:nth-child(2) {
  background: #faf9f5;
  border-color: #e9e5dc;
}
.mood-person strong { font-size: 14px; line-height: 1.4; }
.mood-person .big { font-size: 18px; line-height: 1.35; }
.mood-person small { color: #746a55; font-size: 12px; line-height: 1.55; }
.minirow { min-width: 0; padding: 14px 0; }
.minirow > :first-child { min-width: 0; }
.minirow .smallbtn { flex-shrink: 0; }
.room { border-radius: 18px; }
.room .index { color: #8b6a1d; }
.room b { line-height: 1.25; }
.room small { font-size: 13px; }
.chip { min-height: 44px; line-height: 1.3; }
.chip.active {
  background: #faedbf;
  border-color: #c5a74e;
  color: #3d3219;
  font-weight: 700;
}
.toolbar { align-items: stretch; }
.search, .toolbar select { min-height: 48px; font-size: 16px; }
.search { min-width: 0; }
.record { align-items: start; border-radius: 18px; padding: 16px; }
.record-check {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-color: #d6c89c;
  font-size: 20px;
}
.record-check.checked {
  background: #f3d474;
  border-color: #ad8b28;
  color: #3d3219;
}
.record-title { line-height: 1.4; }
.record-summary { font-size: 14px; line-height: 1.55; }
.record-check.checked + .record-main .record-title {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: #9b947f;
  color: #6d665b;
}
.record-photo {
  width: 88px;
  height: 88px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
}
.record-bottom { gap: 6px; }
.status { font-size: 12px; line-height: 1.4; padding: 5px 9px; }
.status.ok { background: #eaf0e2; color: #3f592f; }
.status.warn { background: #fff0c5; color: #735a18; }
.short-link { min-height: 44px; font-size: 14px; max-width: 100%; }
.empty { background: #fffdf7; padding: 32px 20px; line-height: 1.65; }
.empty b { line-height: 1.3; }
.family-intro { background: linear-gradient(110deg, #fff4cd, #fffefb); }
.family-symbol { color: #74581a; background: #faedbf; }
.family-panel .filters { margin-bottom: 0; }

.backdrop { background: rgb(39 34 25 / 48%); }
.modal { background: #fffdf8; border: 1px solid #f4ecdb; }
.modalheader {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fffdf8;
  padding: 18px 20px;
  gap: 12px;
}
.modalheader h2 { font-size: 26px; line-height: 1.2; }
.modalbody { gap: 18px; padding: 20px; }
.modalfooter { flex-wrap: wrap; padding: 16px 20px; }
.modalfooter > button { flex: 1 1 150px; }
.field { min-width: 0; gap: 7px; margin-bottom: 14px; }
.field label { color: #625a4d; font-size: 14px; line-height: 1.45; }
.field input, .field textarea, .field select {
  min-height: 48px;
  font-size: 16px;
  border-color: #dcd3bf;
  border-radius: 12px;
}
.field input[type="range"] { min-height: 44px; padding: 0; accent-color: #a47b1c; }
.field input[type="file"] { padding: 10px; max-width: 100%; }
.field textarea { min-height: 104px; }
.field input::placeholder, .field textarea::placeholder,
.search::placeholder { color: #81796b; opacity: 1; }
.status-choice.chosen {
  background: #faedbf;
  color: #3d3219;
  border-color: #ad8b28;
  box-shadow: inset 0 0 0 1px #ad8b28;
}
.profile-switch { flex-wrap: wrap; }
.profile-switch button { min-height: 44px; }
.subtle, .mapinfo { line-height: 1.6; }
.img-preview { border: 1px solid var(--stroke); }
#toast { line-height: 1.45; box-shadow: 0 8px 30px rgb(39 34 25 / 16%); }

@media (max-width: 850px) {
  .content {
    padding: max(20px, env(safe-area-inset-top)) 16px
      calc(112px + env(safe-area-inset-bottom));
  }
  .bottom-nav {
    background: rgb(255 253 247 / 97%);
    border-color: #e3dbc7;
    gap: 4px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -5px 24px rgb(91 72 29 / 4%);
  }
  .bottom-nav button {
    min-height: 54px;
    min-width: 44px;
    font-size: 11px;
    line-height: 1.25;
    gap: 3px;
    padding: 6px 2px;
    color: #766c59;
    border-radius: 13px;
  }
  .bottom-nav button span { font-size: 22px; line-height: 1; }
  .bottom-nav button.active {
    color: #493817;
    background: #faedbf;
    box-shadow: inset 0 -2px 0 #c39a2d;
  }
  .hero { margin-bottom: 20px; }
  .hero-photo { padding: 0; background: #f0ece2; }
  .hero-photo img { max-height: 320px; object-fit: contain !important; }
  .hero-copy { padding: 24px; gap: 13px; }
  .hero-copy h2 { font-size: clamp(30px, 8vw, 40px); }
  .hero-copy p { font-size: 15px; line-height: 1.65; }
  .dashcols { gap: 16px; }
  .section-title { font-size: 26px; margin-top: 24px; }
  .intro-image { background: #f0ece2; }
  .intro-image img { max-height: 50dvh; }
  .intro-content { padding-bottom: calc(36px + env(safe-area-inset-bottom)); }
  .intro-content p { line-height: 1.7; }
  .intro-content .buttons { align-items: stretch; }
  .intro-content .buttons > button { flex: 1 1 auto; }
  #toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}

@media (max-width: 600px) {
  .pagehead { flex-direction: column; align-items: stretch; gap: 14px; }
  .pagehead h1 { font-size: clamp(29px, 8vw, 35px); }
  .pagehead > .primary { align-self: flex-start; }
  .pagehead > .filters { margin: 0; }
  .pane { padding: 18px; }
  .pane h3 { font-size: 24px; }
  .pane-head { gap: 12px; }
  .pane-head .secondary { padding: 10px 12px; }
  .mood-person { padding: 14px 11px; }
  .mood-person .big { font-size: 17px; }
  .mood-person strong { font-size: 13px; }
  .toolbar { gap: 8px; }
  .toolbar .search { flex-basis: 100%; }
  .toolbar > select, .toolbar > button { flex: 1 1 auto; max-width: 100%; }
  .record { grid-template-columns: 44px minmax(0, 1fr); gap: 10px; padding: 14px; }
  .record-main { grid-column: 2; }
  .record-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    padding-top: 10px;
    border-top: 1px solid var(--stroke);
  }
  .record-actions .smallbtn { font-size: 12px; padding: 10px 12px; }
  .record-photo { width: 88px; height: 88px; }
  .rooms { gap: 10px; }
  .room { padding: 16px 14px; min-height: 145px; }
  .room b { font-size: 17px; }
  .room .index { font-size: 22px; }
  .family-intro { padding: 22px 18px; border-radius: 22px; }
  .family-intro h2 { font-size: 27px; }
  .family-grid { gap: 14px; }
  .backdrop { align-items: flex-end; padding: 8px 8px 0; }
  .modal {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 24px 24px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior: contain;
    scroll-padding-bottom: 24px;
  }
  .modalheader { padding: 18px; }
  .modalheader h2 { font-size: 25px; }
  .modalbody { padding: 18px; }
  .modalfooter { padding: 16px 18px; }
  .formrow { grid-template-columns: minmax(0, 1fr); }
  .maparea { height: 240px; min-height: 240px; }
  .intro-content { padding: 26px 20px calc(32px + env(safe-area-inset-bottom)); }
  .intro-content h1 { font-size: clamp(32px, 9vw, 43px); }
  .intro-content .step { font-size: 11px; letter-spacing: 1.4px; }
}

@media (max-width: 360px) {
  .content { padding-left: 12px; padding-right: 12px; }
  .topline { font-size: 10px; }
  .pill { padding: 6px 9px; }
  .pane { padding: 16px; }
  .mood-rows { gap: 8px; }
  .mood-person { padding: 12px 9px; }
  .mood-person .big { font-size: 16px; }
  .rooms { grid-template-columns: minmax(0, 1fr); }
  .room { min-height: 125px; }
  .minirow { gap: 8px; }
}

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