/* Approved navy/teal visual foundation. Screen-only: preserve print output. */
@media screen {
  :root {
    --bg: #f4f7f8;
    --surface: #ffffff;
    --surface-soft: #edf3f5;
    --text: #20364b;
    --muted: #586b78;
    --line: #dce5ea;
    --navy: #20364b;
    --teal: #17666c;
    --brand: #17666c;
    --brand-dark: #12545a;
    --success-bg: #e8f3f3;
    --success-text: #17666c;
    --warning-bg: #fff3d6;
    --warning-text: #78521c;
    --shadow: 0 8px 24px rgba(32, 54, 75, .08);
    --shadow-soft: 0 2px 8px rgba(32, 54, 75, .04);
  }

  body, button, input, select, textarea {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }

  h1, h2, h3, h4 {
    font-family: 'Manrope', 'Inter', sans-serif;
  }

  .app .button {
    border-radius: 10px;
    box-shadow: none;
  }

  /* Older screen-specific rules set primary actions to navy. Keep all ordinary
     primary actions teal without changing secondary or destructive semantics. */
  .app .button:not(.secondary):not(.danger) {
    background: var(--brand) !important;
    color: #ffffff !important;
  }

  .app .button:not(.secondary):not(.danger):hover:not(:disabled) {
    background: var(--brand-dark) !important;
  }

  .app .button.secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
  }

  .app .button.secondary:hover:not(:disabled) {
    background: var(--surface-soft);
  }

  .app .tab.active {
    color: var(--brand) !important;
  }

  .app .tab.active::after {
    background: var(--brand) !important;
  }

  .app .panel, .app .empty-state {
    border-radius: 14px;
    box-shadow: none;
  }

  .app .field input:not([type='checkbox']):not([type='radio']),
  .app .field select, .app .field textarea {
    border-color: var(--line);
    border-radius: 10px;
  }

  .app :is(button, input, select, textarea, a, summary, [tabindex]):focus-visible,
  dialog :is(button, input, select, textarea, a, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
  }

  .cost-stat strong, .camp-cost, .cost-amount {
    font-variant-numeric: tabular-nums;
  }
  html[data-mobile-shell="true"] .mobile-coverage-tabs {
    border-color: var(--line);
    background: var(--success-bg);
  }

  html[data-mobile-shell="true"] .mobile-coverage-tabs button {
    color: var(--brand);
  }

  html[data-mobile-shell="true"] .mobile-coverage-tabs button.active {
    background: var(--brand);
    color: #ffffff;
    box-shadow: none;
  }
}

@media screen {
  .plan-view-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-self: start;
    margin: 0 0 16px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
  }
  .plan-view-switcher button {
    min-height: 44px;
    padding: 8px 18px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
  }
  .plan-view-switcher button[aria-pressed="true"] {
    background: var(--success-bg);
    color: var(--brand);
  }
  html[data-mobile-shell="true"] #planViewSwitcher { display: none; }
}
@media print { #planViewSwitcher { display: none; } }

@media screen {
  #scheduleView .plan-grid-scroll { max-width: 100%; overflow-x: auto; }
  #scheduleView .plan-summer-grid { width: 100%; border-spacing: 8px; table-layout: auto; }
  #scheduleView .plan-summer-grid th { color: var(--text); text-align: left; font-size: .88rem; font-weight: 600; }
  #scheduleView .plan-summer-grid thead th { padding: 0 12px 8px; }
  #scheduleView .plan-summer-grid tbody th { min-width: 110px; padding: 12px 4px; vertical-align: top; }
  #scheduleView .plan-summer-grid td { min-width: 180px; vertical-align: top; padding: 0; }
  #scheduleView .plan-camp-cell {
    width: 100%; min-height: 112px; display: flex; flex-direction: column;
    justify-content: space-between; gap: 16px; padding: 14px;
    border: 1px solid var(--line); border-radius: 12px;
    background: var(--surface); color: var(--text); text-align: left; cursor: pointer;
  }
  #scheduleView .plan-camp-cell strong { font-size: .9rem; line-height: 1.4; font-weight: 600; }
  #scheduleView .plan-cell-status { display: grid; gap: 4px; color: var(--muted); font-size: .76rem; line-height: 1.4; }
  #scheduleView .plan-camp-cell.is-empty { background: transparent; border-style: dashed; color: var(--muted); }
  #scheduleView .plan-camp-cell:hover:not(:disabled) { border-color: var(--brand); background: var(--success-bg); }
  #scheduleView .plan-camp-cell:disabled { cursor: default; }
  #scheduleView .plan-outside-break { color: var(--muted); padding: 16px 14px; font-size: .8rem; }
}

@media screen {
  .plan-today { display: grid; gap: 16px; }
  .plan-today > h3 { margin: 0; font-size: 1.15rem; }
  .plan-today-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; }
  .plan-today-card { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; overflow-wrap: anywhere; }
  .plan-today-child { color: var(--brand); font-weight: 600; font-size: .9rem; }
  .plan-today-card h4 { margin: 10px 0; font-size: 1.2rem; }
  .plan-today-card p { color: var(--muted); line-height: 1.5; margin: 8px 0; }
  .plan-today-card section { margin-top: 18px; }
  .plan-today-card section > strong { font-size: .82rem; }
  .plan-today-card section > a { display: block; margin-top: 8px; }
  .plan-today-notes { white-space: pre-wrap; }
  .plan-today-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
  html[data-mobile-shell="true"] .mobile-coverage-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media screen {
  #campAssignmentDialog { width: min(500px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 18px 64px rgba(32, 54, 75, .2); }
  #campAssignmentDialog::backdrop { background: rgba(32, 54, 75, .3); }
  #campAssignmentDialog h3 { margin: 0 0 8px; }
  #assignmentCampName { margin: 0 0 20px; font-weight: 600; }
  #campAssignmentDialog .field { margin-bottom: 16px; }
  #campAssignmentDialog select { width: 100%; min-height: 44px; font-size: 16px; }
  #campAssignmentDialog .form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
  #campAssignmentDialog .button { border-radius: 10px; }
  #campAssignmentDialog .button:not(.secondary) { background: var(--brand); color: #fff; }
  #campsView .camp-directory-actions { flex-wrap: nowrap; }
}

@media screen {
  #campDialog[data-directory-compact="true"] { width: min(540px, calc(100vw - 32px)) !important; }
  #campDialog #campMoreDetailsButton { justify-self: start; min-height: 44px; margin: 0 0 8px; }
}

/* Match the specificity of legacy form layout overrides: hidden must stay hidden. */
@media screen {
  #campDialog .form-section[hidden],
  #campDialog .form-section-body .field[hidden],
  #campDialog .dialog-grid > [hidden] {
    display: none !important;
  }
}

@media screen {
  #costsView .budget-estimate-note { margin: 0 0 20px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
  #costsView .cost-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: none; gap: 16px; }
  #costsView .cost-card-amount { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
  #costsView .cost-amount { font-variant-numeric: tabular-nums; }
  #costsView .budget-review-button { min-height: 44px; }
  #costsView .cost-group-title { margin: 20px 0 12px; }
  #costsView .cost-dashboard-actions { margin-top: 20px; }
  @media (max-width: 720px) {
    #costsView .cost-card-amount { justify-content: flex-start; }
  }
}

@media screen {
  #sharingView .share-access-preview { margin-top: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--success-bg); color: var(--text); }
  #sharingView .share-access-preview h4 { margin: 0 0 10px; font-size: 1rem; }
  #sharingView .share-access-preview p { margin: 8px 0; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
  #sharingView .share-access-preview .share-preview-note { color: var(--muted); font-size: .8rem; }
}

@media screen {
  #adminView .settings-backup-group { margin-top: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
  #adminView .settings-backup-group h4, #adminView .settings-recovery-details h4 { margin: 18px 0 8px; font-size: 1rem; }
  #adminView .settings-recovery-details { margin-top: 16px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
  #adminView .settings-recovery-details summary { min-height: 44px; display: list-item; padding: 12px 0; font-weight: 600; cursor: pointer; }
  #adminView #adminBackupSection .form-actions { flex-wrap: wrap; gap: 10px; }
  #adminView #adminBackupSection .admin-note { line-height: 1.55; }
  #adminView .subtabs { flex-wrap: wrap; }
}

@media screen and (max-width: 720px) {
  #adminView > .page-intro { display: flex !important; flex-direction: column !important; align-items: stretch !important; }
  #adminView .page-actions { width: 100%; min-width: 0; }
  #adminView .subtabs { max-width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #adminView .subtab { min-width: 0; min-height: 44px; padding: 9px 8px; white-space: normal; }
}

@media screen {
  #formsView .document-card { border-radius: 12px !important; padding: 20px; min-width: 0; }
  #formsView .document-card-head { align-items: center; }
  #formsView .document-card-head > div, #formsView .document-file-row > div { min-width: 0; overflow-wrap: anywhere; }
  #formsView .document-card-head strong { font-size: 1rem; font-weight: 600; }
  #formsView .document-card-head .pill { flex-shrink: 0; }
  #formsView .document-file-list { gap: 0; }
  #formsView .document-file-row { padding: 14px 0; }
  #formsView .document-file-row:last-child { padding-bottom: 0; }
  #formsView .document-file-row a { display: inline-block; padding: 8px 0; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
  #formsView .document-file-row .button { min-height: 44px; }
  #formsView .camp-meta { line-height: 1.5; margin-top: 4px; }
}
@media screen and (max-width: 720px) {
  #formsView > .page-intro { display: flex !important; flex-direction: column !important; align-items: stretch !important; }
  #formsView .page-actions { width: 100%; min-width: 0; flex-wrap: wrap; }
  #formsView .document-card { padding: 16px; }
  #formsView .document-file-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  #formsView .document-file-row .button { justify-self: start; }
}

/* Complete the approved compact shell and Plan workspace. */
@media screen {
  .app header .header-inner { padding-top: 16px !important; padding-bottom: 16px !important; }
  .app .brand h1 { text-transform: none !important; letter-spacing: -.7px !important; font-weight: 700 !important; }
  .app .brand .logo-mark { width: 48px !important; height: 48px !important; }
  .app .brand p { font-size: .8rem !important; }
  #scheduleView > .page-intro { border: 0 !important; margin-bottom: 20px !important; }
  #scheduleView #scheduleSubtitle { display: block !important; }
  #scheduleView .plan-tools { display: flex; align-items: end; flex-wrap: wrap; gap: 14px; margin: 0 0 24px; }
  #scheduleView .plan-tools label { display: grid; gap: 6px; color: var(--muted); font-size: .8rem; min-width: 160px; }
  #scheduleView .plan-tools select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--surface); color: var(--text); font-size: 16px; }
  #scheduleView .plan-workspace-label { padding: 12px 0; font-size: .9rem; color: var(--muted); }
  #scheduleView .plan-actions { position: relative; margin-left: auto; }
  #scheduleView .plan-actions summary { min-height: 44px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: .9rem; }
  #scheduleView .plan-action-items { position: absolute; right: 0; z-index: 10; min-width: 235px; padding: 6px; margin-top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
  #scheduleView .plan-action-items button { display: block; width: 100%; min-height: 44px; padding: 10px 12px; text-align: left; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
  #scheduleView .plan-action-items button:hover { background: var(--success-bg); }
  #scheduleView .registration-grid { display: grid !important; grid-template-columns: minmax(0, 1fr) 230px !important; gap: 22px !important; align-items: start; }
  #scheduleView .plan-next-up { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
  #scheduleView .plan-next-up h3 { margin: 0 0 12px; font-size: 1rem; }
  #scheduleView .plan-next-up ul { list-style: none; margin: 0; padding: 0; }
  #scheduleView .plan-next-up li { padding: 14px 0; border-top: 1px solid var(--line); font-size: .85rem; }
  #scheduleView .plan-next-up small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.5; }
  #scheduleView .plan-next-up .button { width: 100%; margin-top: 12px; }
  #scheduleView .plan-summer-grid { border-spacing: 8px; }
  #scheduleView .plan-summer-grid td { min-width: 145px; }
  #scheduleView .plan-summer-grid tbody th { min-width: 90px; }
  #scheduleView .plan-camp-cell { min-height: 104px; gap: 12px; }
  #scheduleView .plan-gap-empty { color: var(--muted); padding: 16px; }
  dialog:not(#campDialog):not(#kidDialog) { border: 1px solid var(--line); border-radius: 16px; padding: 24px; color: var(--text); background: var(--surface); max-width: calc(100vw - 32px); box-shadow: 0 18px 64px rgba(32,54,75,.2); }
  dialog::backdrop { background: rgba(32,54,75,.3); }
  dialog .button { border-radius: 10px; min-height: 44px; }
  #campDialog details.form-section { display: block !important; padding: 0 !important; }
  #campDialog details.form-section > summary { padding: 16px !important; min-height: 52px; cursor: pointer; display: list-item !important; list-style-position: inside; }
  #campDialog details.form-section > .form-section-hint { padding: 0 16px; }
  #campDialog details.form-section > .form-section-body { padding: 0 16px 16px; }
  #campDialog .form-section-hint { font-size: .8rem !important; line-height: 1.5 !important; }
}
@media screen and (max-width: 1000px) {
  #scheduleView .registration-grid { grid-template-columns: minmax(0, 1fr) !important; }
  #scheduleView .plan-next-up { order: -1; }
}
@media screen and (max-width: 720px) {
  #scheduleView .plan-tools { gap: 10px; }
  #scheduleView .plan-tools label { min-width: 0; flex: 1; }
  #scheduleView .plan-actions { flex-basis: 100%; margin-left: 0; }
  #scheduleView .plan-actions summary { width: max-content; margin-left: auto; }
  #scheduleView .plan-next-up { display: none; }
}

@media screen {
  #campDialog .dialog-grid { background: var(--bg) !important; }
  #campDialog .form-section { border-radius: 12px !important; }
  #campDialog .form-section-title { font-weight: 600 !important; font-size: 1rem !important; }
  #campDialog details:not([open]) > :not(summary) { display: none !important; }
  #campDialog #campPlanTypeField[hidden] { display: none !important; }
  #campDialog #campPlanTypeField { padding: 0; }
  #campDialog #campPlanType { min-height: 44px; font-size: 16px; }
  #campDialog #campDialogTitle { padding-bottom: 18px !important; }
}

@media screen {
  .app .tabs-wrap { background: var(--surface); }
  #scheduleView > .page-intro { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 20px !important; }
  #scheduleView > .page-intro .plan-view-switcher { margin: 0; flex-shrink: 0; }
  html[data-plan-workspace="true"] .header-actions > #kidFilter { display: none !important; }
}
@media screen and (max-width: 720px) {
  #scheduleView > .page-intro { align-items: stretch !important; flex-direction: column !important; }
}

@media screen {
  #campDialog { width: min(640px, calc(100vw - 32px)) !important; }
  #campDialog #campDialogTitle { padding: 20px 24px !important; }
  #campDialog .dialog-grid { padding: 20px 24px !important; gap: 14px !important; }
  #campDialog #campBasicsSection > .form-section-hint { display: none !important; }
  #campDialog #campBasicsSection > .form-section-title { padding: 14px 18px !important; }
  #campDialog #campBasicsSection > .form-section-body { padding: 18px !important; }
}

@media screen and (max-width: 720px) {
  html[data-mobile-shell="true"][data-plan-workspace="true"] .header-inner { display: flex !important; flex-direction: row !important; justify-content: space-between; align-items: center; }
  html[data-mobile-shell="true"][data-plan-workspace="true"] .header-actions { display: flex !important; width: auto !important; }
  html[data-mobile-shell="true"][data-plan-workspace="true"] .header-actions .workspace-switcher { display: none !important; }
  html[data-mobile-shell="true"] #scheduleView > .page-intro { display: flex !important; margin-top: 12px; margin-bottom: 16px !important; }
  html[data-mobile-shell="true"] #scheduleView #mobileSiteSwitch { display: none !important; }
}

@media screen and (max-width: 720px) {
  html[data-mobile-shell="true"] #scheduleView { gap: 12px !important; }
  html[data-mobile-shell="true"] #scheduleView > .page-intro { margin-bottom: 0 !important; }
  html[data-mobile-shell="true"] #scheduleView .plan-tools { margin-bottom: 8px; }
}

/* Keep the three camp actions together instead of wrapping individual buttons. */
@media screen and (min-width: 721px) {
  #campsView .camp-directory-head,
  #campsView .camp-directory-card {
    grid-template-columns: minmax(0, 1.25fr) minmax(90px, .7fr) 100px minmax(110px, .58fr) 250px;
    gap: 14px;
  }
  #campsView .camp-directory-card > div { min-width: 0; overflow-wrap: anywhere; }
  #campsView .camp-directory-actions { align-items: center; gap: 8px; }
  #campsView .camp-directory-actions .button { min-height: 44px; flex: 0 0 auto; white-space: nowrap; }
}
@media screen and (min-width: 721px) and (max-width: 1000px) {
  #campsView .camp-directory-head { display: none; }
  #campsView .camp-directory-card { grid-template-columns: minmax(0, 1.25fr) minmax(90px, .7fr) 100px minmax(110px, .58fr); }
  #campsView .camp-directory-actions { grid-column: 1 / -1; justify-content: flex-end; padding-top: 10px; border-top: 1px solid var(--line); }
}

@media screen {
  #scheduleView .plan-single-weeks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; min-width: 0; }
  #scheduleView .plan-single-weeks .plan-camp-cell { min-height: 176px; justify-content: flex-start; gap: 10px; padding: 18px; overflow-wrap: anywhere; }
  #scheduleView .plan-single-weeks .plan-camp-cell strong { font-size: 1rem; line-height: 1.4; }
  #scheduleView .plan-single-weeks .plan-cell-status { margin-top: auto; }
  #scheduleView .plan-week-date { color: var(--brand); font-size: .82rem; font-weight: 600; }
  #scheduleView .plan-week-time { color: var(--muted); font-size: .8rem; }
  #scheduleView .plan-single-weeks .plan-gap-empty { grid-column: 1 / -1; }
}
@media screen and (max-width: 1100px) {
  #scheduleView .plan-single-weeks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media screen and (max-width: 1000px) {
  #scheduleView .plan-single-layout .plan-next-up { order: 0; }
}
@media screen and (max-width: 600px) {
  #scheduleView .plan-single-weeks { grid-template-columns: minmax(0, 1fr); }
  #scheduleView .plan-single-weeks .plan-camp-cell { min-height: 160px; }
}
@media screen and (max-width: 720px) {
  #scheduleView .plan-single-layout .plan-next-up { display: block; }
}

/* Budget: one compact list with aligned amounts and restrained status colors. */
@media screen {
  html:has(#costsView:not([hidden])) { scrollbar-gutter: stable; }
  #costsView { width: 100%; max-width: 1040px; min-width: 0; box-sizing: border-box; margin-left: auto; margin-right: auto; }
  #costsView .cost-summary { gap: 12px !important; border: 0 !important; background: transparent !important; }
  #costsView .cost-stat, #costsView .cost-stat + .cost-stat { padding: 18px 20px !important; border: 1px solid var(--line) !important; border-radius: 12px; background: var(--surface); }
  #costsView .cost-summary .cost-stat { border: 1px solid var(--line) !important; }
  #costsView .cost-stat span { color: var(--muted); font-size: .8rem !important; font-weight: 500 !important; }
  #costsView .cost-stat strong { font-size: 1.7rem !important; font-weight: 600; color: var(--text); }
  #costsView .cost-dashboard { display: grid; gap: 16px !important; }
  #costsView .budget-estimate-note { margin: 0; font-size: .8rem; line-height: 1.5; max-width: 780px; }
  #costsView .budget-filters { display: flex; flex-wrap: wrap; gap: 6px; }
  #costsView .budget-filters button { min-height: 44px; padding: 9px 14px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 500; cursor: pointer; }
  #costsView .budget-filters button[aria-pressed="true"] { background: var(--success-bg); border-color: var(--line); color: var(--brand); }
  #costsView .budget-list-panel { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
  #costsView .budget-column-head, #costsView .cost-card { display: grid !important; grid-template-columns: minmax(0, 1fr) 170px 100px 125px 58px !important; gap: 16px !important; align-items: center !important; padding: 14px 20px !important; }
  #costsView .budget-column-head { background: var(--surface-soft); color: var(--muted); font-size: .75rem; font-weight: 500; }
  #costsView .budget-column-head > span:nth-child(3) { text-align: right; }
  #costsView .cost-card { min-height: 80px; margin: 0 !important; border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; background: var(--surface) !important; }
  #costsView .cost-card:last-child { border-bottom: 0 !important; }
  #costsView .cost-card > * { grid-area: auto !important; min-width: 0; }
  #costsView .cost-card:hover { background: #f9fbfc !important; }
  #costsView .cost-card-main { overflow-wrap: anywhere; }
  #costsView .cost-card-main strong { font-size: .9rem !important; font-weight: 600 !important; line-height: 1.45 !important; }
  #costsView .cost-meta { color: var(--muted); font-size: .78rem; line-height: 1.5; margin-top: 4px; }
  #costsView .budget-week { display: grid; gap: 4px; font-size: .8rem; color: var(--text); }
  #costsView .budget-week small { color: var(--muted); font-size: .75rem; line-height: 1.4; }
  #costsView .budget-week .budget-overdue { color: #9b342b; }
  #costsView .cost-card-amount { display: block !important; min-width: 0 !important; text-align: right !important; }
  #costsView .cost-amount { font-size: .95rem !important; font-weight: 600 !important; color: var(--text) !important; letter-spacing: normal !important; }
  #costsView .cost-card > .pill { justify-self: start; font-size: .72rem !important; font-weight: 500; padding: 5px 9px !important; border-radius: 7px; white-space: nowrap; }
  #costsView .budget-status-paid { background: #e8f3f3 !important; color: #17666c !important; }
  #costsView .budget-status-unpaid { background: #fff3d6 !important; color: #78521c !important; }
  #costsView .budget-status-idea { background: #eef1f4 !important; color: #586b78 !important; }
  #costsView .budget-status-overdue { background: #fbece9 !important; color: #9b342b !important; }
  #costsView .budget-review-button { min-height: 44px; min-width: 0; padding: 8px 10px; font-size: .8rem; font-weight: 500; }
  #costsView .budget-clear-state { padding: 24px 20px; margin: 0; color: var(--muted); font-size: .9rem; }
}
@media screen and (max-width: 800px) {
  #costsView .budget-column-head { display: none !important; }
  #costsView .cost-card { grid-template-columns: minmax(0, 1fr) auto !important; grid-template-areas: "camp amount" "week status" "edit edit" !important; gap: 10px 14px !important; padding: 16px !important; }
  #costsView .cost-card > .cost-card-main { grid-area: camp !important; }
  #costsView .cost-card > .cost-card-amount { grid-area: amount !important; }
  #costsView .cost-card > .budget-week { grid-area: week !important; }
  #costsView .cost-card > .pill { grid-area: status !important; justify-self: end; }
  #costsView .cost-card > .budget-review-button { grid-area: edit !important; justify-self: start; }
}
@media screen and (max-width: 480px) {
  #costsView .cost-summary { gap: 8px !important; }
  #costsView .cost-stat, #costsView .cost-stat + .cost-stat { padding: 12px 10px !important; }
  #costsView .cost-stat span { font-size: .7rem !important; line-height: 1.4; }
  #costsView .cost-stat strong { font-size: 1.3rem !important; }
  #costsView .budget-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #costsView .budget-filters button { padding: 8px 6px; font-size: .76rem; }
}

/* Optional explanations: native hover text plus tap/keyboard popovers. */
@media screen {
  .context-help-heading { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .context-help-heading h3, .context-help-heading > label { margin: 0; }
  #costsView .context-help-heading { align-items: flex-start; gap: 4px; margin-bottom: 8px; }
  #costsView .context-help-heading > span { margin-bottom: 0 !important; }
  .context-help-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; min-width: 24px; min-height: 24px; padding: 2px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; cursor: help; font-size: 1rem; }
  .context-help-button:hover { color: var(--brand); background: var(--success-bg); }
  .context-help-popover { position: fixed; inset: 0; width: min(360px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-sizing: border-box; overflow-y: auto; margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
  .context-help-popover p { margin: 0 0 16px; font-size: .9rem; line-height: 1.6; }
  .context-help-popover .button { min-height: 44px; }
  .context-help-popover::backdrop { background: transparent; }
}

/* The blurred header forms a stacking context; keep its dropdown above page panels. */
@media screen {
  .app > header { position: relative; z-index: 100 !important; }
  .app #moreMenu { background: #fff !important; }
}

@media screen {
  #faqView { width: 100%; max-width: 900px; min-width: 0; margin: 0 auto; }
  #faqView .faq-topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
  #faqView .faq-topics a { padding: 10px 14px; min-height: 44px; box-sizing: border-box; border: 1px solid var(--line); border-radius: 9px; color: var(--brand); background: var(--surface); font-size: .85rem; text-decoration: none; }
  #faqView .faq-section { scroll-margin-top: 110px; margin-bottom: 24px; }
  #faqView .faq-section > h3 { font-size: 1rem; margin: 0 0 12px; }
  #faqView details { border: 1px solid var(--line); background: var(--surface); overflow-wrap: anywhere; }
  #faqView details + details { border-top: 0; }
  #faqView details:first-of-type { border-radius: 12px 12px 0 0; }
  #faqView details:last-of-type { border-radius: 0 0 12px 12px; }
  #faqView summary { min-height: 48px; padding: 15px 18px; box-sizing: border-box; cursor: pointer; font-size: .9rem; font-weight: 600; line-height: 1.5; }
  #faqView summary:hover { color: var(--brand); }
  #faqView details > div { padding: 0 18px 18px; }
  #faqView details p { margin: 0; max-width: 740px; font-size: .88rem; line-height: 1.7; color: var(--muted); }
  #faqView details p + p { margin-top: 12px; }
  #faqView details strong { font-weight: 600; color: var(--text); }
  #faqView .faq-footer { margin: 8px 0 24px; }
  #faqView .faq-footer .button { min-height: 44px; }
}
@media screen and (min-width: 721px) {
  .app #moreMenu { max-height: calc(100dvh - 96px); overflow-y: auto; overscroll-behavior: contain; }
}
@media screen and (max-width: 720px) {
  #faqView > .page-intro { display: flex !important; align-items: flex-start !important; flex-direction: column !important; gap: 12px !important; }
  #faqView summary { padding: 14px; }
  #faqView details > div { padding: 0 14px 16px; }
}
