/* Round 4: finish the remaining screens with the existing graphite/lime system. */
.ui-skip-link { position: fixed; top: 8px; left: 12px; z-index: 250; padding: 12px 18px; background: var(--ep); color: white; border-radius: 8px; transform: translateY(-160%); }
.ui-skip-link:focus { transform: none; }
#za-main:focus { outline: none; }
.ep-header button,
.ep-mobile-tabs button,
.auth-header button { min-height: var(--ui-control-height); }
.ep-sidebar button[aria-current="page"] { color: var(--mint); }
.ep-sidebar .story-side-entry { background: var(--ep-light) !important; }
.ep-sidebar .story-side-entry.active { background: var(--mint) !important; }
.ep-main button:focus-visible,
.auth-layout button:focus-visible,
.modal button:focus-visible,
.modal summary:focus-visible { outline: 2px solid var(--ep); outline-offset: 3px; }
.ep-sidebar button:focus-visible { outline: 2px solid var(--mint); outline-offset: -3px; }
.ep-main button:disabled { cursor: not-allowed; opacity: .55; }
.modal-body { overscroll-behavior: contain; }
.modal-body > p,
.modal-body .id-intro,
.modal-body .id-record,
.modal-body .flow-item { overflow-wrap: anywhere; }
.modal-footer,
.modal-footer .right { flex-wrap: wrap; }
.modal-footer > .button { min-width: 0; }
.modal .flow-item { min-height: 60px; font-size: 15px; gap: 12px; }
.modal .flow-item > span { min-width: 0; }
.modal .flow-item strong,
.modal .flow-item small { overflow-wrap: anywhere; }
.modal .id-record { padding: 20px; border-color: var(--line); background: var(--ep-cream); }
.modal .id-record h3 { font-size: 18px; line-height: 1.6; }
.modal .id-record p { font-size: 14px; line-height: 1.8; color: var(--muted); }
.modal .id-record .button { margin-top: 8px; }
.modal .id-picker-saved { margin-top: 28px; }

/* Contacts, sharing and account information use the same readable dialog rhythm. */
.ui-list-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin: 24px 0 16px; }
.ui-list-heading h3 { margin: 0; font-size: 17px; line-height: 1.7; }
.ui-list-heading h3 span { margin-left: 8px; color: var(--muted); font-size: 13px; font-weight: 400; }
.ui-contact-list { border-top: 1px solid var(--line); }
.ui-contact-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.ui-contact-avatar { display: grid; place-items: center; width: 40px; height: 44px; border-radius: 10px; background: var(--ep-light); color: var(--ep); font-size: 17px; }
.ui-contact-copy { min-width: 0; }
.ui-contact-copy h3 { font-size: 17px; line-height: 1.6; margin: 0 0 4px; font-weight: 600; overflow-wrap: anywhere; }
.ui-contact-copy p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.ui-contact-copy small { display: block; color: var(--muted); font-size: 13px; line-height: 1.7; margin-top: 4px; }
.ui-empty-state { padding: 28px 20px; margin: 12px 0 20px; background: var(--ep-cream); border: 1px dashed var(--line); border-radius: 12px; }
.ui-empty-state h3 { margin: 0 0 8px; font-size: 18px; }
.ui-empty-state p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.8; }
.ui-service-panel { border: 1px solid var(--line); background: var(--ep-cream); border-radius: 12px; padding: 22px; margin: 20px 0; }
.ui-service-panel h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 18px; line-height: 1.6; margin: 0 0 12px; }
.ui-service-panel p { margin: 0 0 16px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.ui-service-panel p:last-child { margin-bottom: 0; }
.ui-service-pending { background: transparent; }
.ui-status-label { border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 12px; font-weight: 400; padding: 2px 8px; }
.ui-account-fields { margin: 8px 0 24px; }
.ui-account-fields > div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.ui-account-fields dt { color: var(--muted); font-size: 14px; line-height: 1.8; }
.ui-account-fields dd { margin: 0; font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }

/* Keep each subject's layout, align its surfaces and secondary text. */
.ux-area-symbol { background: var(--ep-light); color: var(--ep); }
.ux-area-tile,
.ux-finance-lane,
.ux-digital-lanes > section,
.ux-legal-columns > section,
.ux-catalogue-group,
.ux-area-drafts,
.ux-digital-accounts { background: var(--ep-cream); border-color: var(--line); color: var(--ink); }
.ux-tile-copy small,
.ux-tile-status,
.ux-area-heading > div > p:last-child,
.ux-area-foot { color: var(--muted); }
.ux-area-heading > div,
.ux-person-card > div,
.ux-digital-key > div,
.ux-family-priority > div { min-width: 0; }
.ux-area-tile:hover { background: var(--ep-light); border-color: var(--line); }
.ux-area-note,
.ux-area-empty { background: var(--ep-light); color: var(--muted); border-color: var(--line); }
.ux-area-note { border-left-color: var(--mint); }
.ux-finance-overview { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ux-finance-overview button { background: var(--ep-light); border-color: var(--line); overflow-wrap: anywhere; }
.ux-health-essential { background: var(--ep-light); border-color: var(--line); border-top-color: var(--mint); }
.ux-health-list .ux-area-tile { background: white; }
.ux-family-priority .ux-area-tile,
.ux-digital-key .ux-area-tile { background: var(--ep-cream); }
.ux-person-paths > button { background: var(--ep-cream); color: var(--ink); border-color: var(--line); }
.ux-person-paths strong,
.ux-person-paths small,
.ux-finance-lane p,
.ux-digital-lanes p,
.ux-legal-columns p { overflow-wrap: anywhere; }
.ux-person-paths > button > span { min-width: 0; }
.ux-area summary,
.library-breadcrumb button { min-height: var(--ui-control-height); align-content: center; }
.ux-area button:focus-visible,
.ux-area summary:focus-visible { outline-color: var(--ep); }

/* Stories remain a writing page; unavailable voice input stays secondary. */
.story-heading h1 { font-size: var(--ui-title-size); line-height: 1.45; }
.story-section-heading h2 { font-size: var(--ui-section-size); line-height: 1.5; }
.story-question,
.story-record-card,
.story-empty,
.story-writing-prompt { background: var(--ep-cream); border-color: var(--line); }
.story-heading > div,
.story-draft-strip > div,
.story-record-top > span { min-width: 0; }
.story-heading p,
.story-record-card > p,
.story-privacy-note p,
.story-editor-top,
.story-person-details,
.story-local-copy { color: var(--muted); }
.story-chapters button { min-height: 44px; border-color: var(--line); color: var(--muted); }
.story-chapters button.active { background: var(--ep); color: white; border-color: var(--ep); }
.story-chapters button:focus-visible { outline-offset: -3px; }
.story-back,
.story-writing-bottom button,
.story-question-top button { min-height: 44px; }
.story-field-label { display: block; font-size: 15px; line-height: 1.7; font-weight: 550; }
.story-field-label > span { margin-left: 8px; font-size: 13px; font-weight: 400; color: var(--muted); }
.story-title-input { padding: 12px 0 20px; }
#story-body { color: var(--ink); }
.story-title-input:focus-visible,
#story-body:focus-visible { outline: 2px solid var(--ep); outline-offset: 4px; }
.story-editor-meta { font-size: 14px; color: var(--muted); }
.story-editor-meta select { min-height: 44px; font-size: 15px; border-color: var(--line); color: var(--ink); }
.story-person-details { border: 1px solid var(--line); border-radius: 10px; padding: 0 16px; margin: 16px 0; background: var(--ep-cream); }
.story-person-details summary { padding: 14px 0; min-height: 48px; color: var(--ink); font-size: 15px; }
.story-person-details label { font-size: 14px; color: var(--muted); line-height: 1.7; margin-top: 12px; }
.story-person-details input,
.story-person-details textarea { font: inherit; font-size: 16px; line-height: 1.7; border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; width: 100%; min-height: 48px; box-sizing: border-box; margin: 8px 0 16px; background: white; color: var(--ink); }
.story-person-details textarea { resize: vertical; min-height: 110px; }
.story-person-details input:focus-visible,
.story-person-details textarea:focus-visible { outline: 2px solid var(--ep); outline-offset: 2px; }
.story-service-note { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin: 22px 0 8px; color: var(--muted); }
.story-service-note p { margin: 0; font-size: 13px; line-height: 1.7; }
.story-service-note button { min-height: 44px; padding: 8px 0; border: 0; background: none; font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); }
.story-editor-actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 20px; border-top-color: var(--line); }
.story-editor-actions .button { min-height: 44px; flex: 1 1 180px; }
.story-prose { color: var(--ink); overflow-wrap: anywhere; }
.story-reader h1 { overflow-wrap: anywhere; }
.story-reader .detail-field p { overflow-wrap: anywhere; }
#cloud-story-error { margin: 0 0 24px; }

/* Login uses the same field sizes and keeps errors visible beside the form. */
.auth-switch > button,
.auth-password-toggle,
.auth-header-help { min-height: 44px; }
.auth-field > label,
.auth-field-heading > label { font-size: 16px; color: var(--ink); }
.auth-field-help,
.auth-demo-note,
.auth-error,
.auth-footer { font-size: 13px; line-height: 1.7; }
.auth-field-help,
.auth-demo-note,
.auth-footer,
.auth-subtitle { color: var(--muted); }
.auth-input-wrap { border-color: var(--line); border-radius: var(--ui-field-radius); }
.auth-input-wrap input::placeholder { color: var(--muted); }
.auth-input-wrap:focus-within { border-color: var(--ep); box-shadow: 0 0 0 3px var(--ep-light); }
.auth-password-toggle { color: var(--muted); min-width: 44px; }
.auth-card #cloud-auth-error { font-size: 14px; margin: 0 0 20px; }

@media (max-width: 800px) {
  .ep-header-right { gap: 12px; }
  .ep-header-right > button { min-width: 44px; }
  .ep-mobile-tabs button { padding-left: 6px; padding-right: 6px; font-size: 14px; line-height: 1.5; }
  .auth-entry { min-width: 0; }
  .auth-header { padding-left: 20px; padding-right: 20px; }
  .auth-layout { padding-left: 20px; padding-right: 20px; }
  .auth-demo-note { margin-top: 24px; }
  .ep-main { padding-bottom: env(safe-area-inset-bottom); }
}
@media (max-width: 760px) {
  .ux-finance-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .modal { max-height: calc(100dvh - 24px); }
  .modal:not(.ux-editor) .modal-head { padding: 22px 20px 18px; }
  .modal:not(.ux-editor) .modal-body { padding-left: 20px; padding-right: 20px; }
  .modal:not(.ux-editor) .modal-footer { padding: 12px 20px max(16px, env(safe-area-inset-bottom)); }
  .modal-footer .right { min-width: 0; }
  .ui-contact-row { grid-template-columns: 36px minmax(0, 1fr); gap: 10px 12px; }
  .ui-contact-avatar { width: 36px; height: 40px; }
  .ui-contact-row > .button { grid-column: 2; justify-self: start; padding: 10px 14px; }
  .ui-account-fields > div { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 16px 0; }
  .ui-service-panel { padding: 18px; }
  .ux-area-tile { flex-wrap: wrap; }
  .ux-tile-copy { flex-basis: 65%; }
  .ux-tile-status { white-space: normal; line-height: 1.7; }
  .ux-area-section-title { flex-wrap: wrap; }
  .ux-person-card { flex-wrap: wrap; }
  .story-heading { flex-wrap: wrap; gap: 16px; }
  .story-heading > div { flex-basis: 100%; }
  .story-draft-strip { flex-wrap: wrap; padding: 18px; }
  .story-question { padding: 22px 18px; }
  .story-question-top { flex-wrap: wrap; gap: 8px; }
  .story-question > small { display: block; margin: 12px 0 0; }
  .story-record-grid { grid-template-columns: minmax(0, 1fr); }
  .story-record-top { flex-wrap: wrap; }
  .story-writing-bottom { flex-wrap: wrap; gap: 6px; }
  .story-title-input { font-size: 24px; }
  .story-title-input::placeholder { font-size: 17px; }
  #story-body { font-size: 17px; min-height: 260px; }
  .story-editor-actions .button { margin: 0; }
  .story-person-details { padding: 0 14px; }
  #toast { max-width: calc(100vw - 32px); box-sizing: border-box; white-space: normal; overflow-wrap: anywhere; bottom: max(20px, env(safe-area-inset-bottom)); }
}
@media (max-width: 390px) {
  .ep-header { padding-left: 12px; padding-right: 12px; }
  .ep-header-right { gap: 4px; }
  .ep-header-right > button > span:not(.ep-user) { display: none; }
  .ep-content { padding-left: 16px; padding-right: 16px; }
  .ux-finance-overview button { padding: 14px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-layout *, .story-shell *, .modal * { scroll-behavior: auto !important; transition: none !important; }
}
