:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7f4;
  color: #17211b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: #1f6f4a;
  color: #ffffff;
  padding: 11px 14px;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  border: 1px solid #cbd4cc;
  background: #ffffff;
  color: #1f6f4a;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd4cc;
  border-radius: 8px;
  background: #fbfcfb;
  color: #17211b;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 31px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 16px;
  font-size: 30px;
  line-height: 1.15;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
}

a {
  color: #1f6f4a;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(230px, 292px) minmax(300px, 340px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 20px;
  background: #ffffff;
  border-right: 1px solid #d9e0d8;
}

.brand {
  padding: 0 8px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #66746b;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-menu {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  background: transparent;
  color: #344239;
  padding: 10px 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #e8f1ec;
  color: #123b2a;
}

.nav-item span {
  font-weight: 800;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 0 8px;
}

.sidebar-help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid #cbd4cc;
  border-radius: 8px;
  background: #ffffff;
  color: #1f6f4a;
  font-weight: 850;
  text-decoration: none;
}

.mobile-help-link {
  display: none;
}

.status,
.health,
.muted {
  margin-bottom: 0;
  color: #66746b;
  font-size: 14px;
  line-height: 1.45;
}

.context-help {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 800;
}

.context-help a {
  color: #1f6f4a;
}

.help-icon-link {
  display: inline-grid;
  width: 24px;
  height: 24px;
  margin-left: 6px;
  place-items: center;
  border: 1px solid #cbd4cc;
  border-radius: 50%;
  background: #ffffff;
  color: #1f6f4a;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  vertical-align: middle;
}

.help-icon-link.small {
  width: 20px;
  height: 20px;
  font-size: 12px;
}

.help-icon-link:hover,
.help-icon-link:focus-visible {
  border-color: #1f6f4a;
  background: #e8f1ec;
  outline: 3px solid #8fc6a7;
  outline-offset: 2px;
}

.workspace {
  min-width: 0;
  padding: 32px;
  overflow: auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.hero h2 {
  margin-bottom: 0;
  font-size: 42px;
}

.family-board-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 28px 18px;
  overflow-y: auto;
  background: #fdfefd;
  border-right: 1px solid #d9e0d8;
}

.family-board-header {
  display: grid;
  gap: 8px;
}

.family-board-panel .section-heading {
  align-items: flex-start;
}

.family-board-panel h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.2;
}

.family-board-panel .section-heading button {
  padding: 8px 10px;
  font-size: 13px;
}

.family-board-panel .button-row {
  display: grid;
  grid-template-columns: 1fr;
}

.board-list {
  display: grid;
  gap: 12px;
}

.board-entry {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
}


.board-avatar {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #dceee3;
  color: #123b2a;
  font-size: 13px;
  font-weight: 900;
}

.related-line {
  display: block;
  margin-bottom: 4px;
  color: #3f5548 !important;
  font-weight: 800;
}

.retry-state {
  display: grid;
  gap: 8px;
  align-items: start;
}

.retry-state button {
  width: fit-content;
  padding: 8px 10px;
  font-size: 13px;
}

.created-actions {
  display: grid;
  gap: 6px;
  border-radius: 8px;
  background: #f5f7f4;
  padding: 12px;
}

.created-actions strong {
  margin-bottom: 0;
  font-size: 14px;
}

.created-actions ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}

.created-actions li {
  color: #344239;
  font-size: 14px;
  line-height: 1.35;
}

.board-entry h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

.board-entry p {
  margin-bottom: 6px;
  line-height: 1.45;
}

.board-entry span:not(.board-marker) {
  color: #66746b;
  font-size: 13px;
}

.board-form {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #d9e0d8;
}


.quick-add-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border: 1px solid #b9d6c5;
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
}

.quick-add-panel h3 {
  margin-bottom: 6px;
  font-size: 22px;
}

.family-snapshot {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}

.list-card {
  align-items: flex-start;
  min-height: 220px;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mini-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  background: #f5f7f4;
  padding: 10px;
}

.mini-item strong {
  display: block;
  margin-bottom: 3px;
  color: #17211b;
  font-size: 14px;
  line-height: 1.3;
}

.mini-item span {
  color: #66746b;
  font-size: 12px;
}

.icon-action {
  min-width: 36px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #cbd4cc;
  background: #ffffff;
  color: #1f6f4a;
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.summary-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  min-height: 132px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.summary-card > span {
  font-size: 26px;
  line-height: 1;
}

.summary-card p {
  margin-bottom: 0;
  color: #66746b;
  font-size: 13px;
  line-height: 1.4;
}


.task-card-heading,
.family-tasks-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-card-heading {
  margin-bottom: 8px;
}

.task-card-heading h3 {
  margin: 0;
}

.task-card-heading button {
  flex: 0 0 auto;
}
.content-section {
  display: grid;
  gap: 14px;
  max-width: 980px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #ffffff;
  padding: 20px;
}

.content-section.narrow {
  max-width: 640px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h3 {
  margin-bottom: 0;
  font-size: 20px;
}


.add-anything-panel,
.inbox-section {
  max-width: 900px;
}

.add-anything-panel {
  display: grid;
  gap: 12px;
  border: 1px solid #b9d6c5;
  border-radius: 8px;
  background: #fdfefd;
  padding: 16px;
}

.add-anything-tip {
  margin: -4px 0 0;
  color: #54645a;
  font-size: 13px;
  line-height: 1.4;
}

.add-anything-tip a {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.inbox-actions button {
  min-height: 44px;
}

.inbox-actions [hidden] {
  display: none;
}

#playAddAnythingQuestion {
  justify-self: start;
}

.hidden-input {
  display: none;
}

.inbox-list {
  display: grid;
  gap: 12px;
}

.processed-inbox {
  display: grid;
  gap: 12px;
  border-top: 1px solid #d9e0d8;
  padding-top: 14px;
}

.processed-inbox summary {
  cursor: pointer;
  color: #344239;
  font-weight: 900;
}


.inbox-item {
  display: grid;
  gap: 12px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.inbox-item header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.inbox-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

.inbox-item span {
  color: #66746b;
  font-size: 13px;
}

.inbox-item p {
  margin-bottom: 0;
  line-height: 1.45;
}

.inbox-pill {
  white-space: nowrap;
  border-radius: 8px;
  background: #e8f1ec;
  color: #1f6f4a !important;
  padding: 5px 8px;
  font-weight: 800;
}

.follow-up-form {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  background: #f5f7f4;
  padding: 12px;
}

.follow-up-form label {
  color: #17211b;
  font-weight: 800;
}

.memory-browser {
  max-width: 860px;
}

.memory-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid #d9e0d8;
}

.memory-list {
  display: grid;
  gap: 10px;
}

.memory-item {
  display: grid;
  gap: 6px;
  border-radius: 8px;
  background: #f5f7f4;
  padding: 12px;
}

.memory-item p {
  margin-bottom: 0;
  line-height: 1.45;
}

.memory-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.memory-item textarea {
  min-height: 92px;
}

.memory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.memory-actions button {
  padding: 8px 10px;
  font-size: 13px;
}

.memory-actions .danger {
  border: 1px solid #d7b7b7;
  background: #fff7f7;
  color: #9b2525;
}

.browser-list .memory-item {
  background: #ffffff;
  border: 1px solid #d9e0d8;
}

.memory-item span,
.empty-state {
  margin-bottom: 0;
  color: #66746b;
  font-size: 13px;
}


.directory-list {
  display: grid;
  gap: 10px;
}

.directory-item {
  display: grid;
  gap: 4px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

.directory-item strong {
  color: #17211b;
  font-size: 15px;
}

.directory-item span {
  color: #66746b;
  font-size: 13px;
  line-height: 1.4;
}

.invite-page {
  background: #f5f7f4;
}

.invite-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.invite-accept-card h1 {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.15;
}

#acceptEmail[readonly] {
  background: #eef2ef;
  color: #48564d;
}

.field,
.panel {
  display: grid;
  gap: 10px;
}

.field span {
  color: #48564d;
  font-size: 14px;
  font-weight: 700;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.account-reset-panel,
.account-reset-fields {
  display: grid;
  gap: 10px;
}

.account-reset-panel {
  border-top: 1px solid #d9e0d8;
  padding-top: 14px;
}

.compact-heading {
  align-items: center;
  gap: 10px;
  margin: 0;
}

.compact-heading h3 {
  margin: 0;
}

.chat {
  display: grid;
  grid-template-rows: minmax(420px, calc(100vh - 170px)) auto;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #ffffff;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  overflow-y: auto;
}

.message {
  max-width: 780px;
  border-radius: 8px;
  padding: 14px 16px;
  line-height: 1.5;
}

.message span {
  display: block;
  margin-bottom: 6px;
  color: #536058;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.message p {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: #dceee3;
}

.message.assistant {
  align-self: flex-start;
  background: #f5f7f4;
  border: 1px solid #d9e0d8;
}

.play-reply-button {
  margin-top: 10px;
  padding: 7px 10px;
  border: 1px solid #b9c9bf;
  border-radius: 7px;
  background: #ffffff;
  color: #2f5f45;
  font-size: 13px;
  font-weight: 700;
}

.play-reply-button:hover,
.play-reply-button:focus-visible {
  border-color: #2f6f4e;
  background: #eef6f0;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 18px;
  background: #ffffff;
  border-top: 1px solid #d9e0d8;
}

.composer textarea,
.composer .chat-input {
  min-height: 52px;
  max-height: 160px;
}

.composer .chat-input {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  overflow-y: auto;
  border: 1px solid #cfd9d2;
  border-radius: 8px;
  background: #ffffff;
  color: #17231b;
  font: inherit;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}

.composer .chat-input:focus {
  border-color: #2f6f4e;
  box-shadow: 0 0 0 3px rgba(47, 111, 78, 0.12);
}

.composer .chat-input:empty::before {
  content: attr(data-placeholder);
  color: #7a877f;
  pointer-events: none;
}

.chat-composer-support {
  display: grid;
  gap: 8px;
  padding: 0 18px 18px;
  background: #ffffff;
}

.composer-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.chat-icon-button,
.send-chat-button {
  inline-size: 46px;
  min-width: 46px;
  min-height: 46px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0;
  flex: 0 0 auto;
}

.chat-icon-button {
  border-color: #d9e0d8;
  background: #f7fbf8;
  color: #254c38;
}

.chat-icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.chat-icon-button.recording {
  border-color: #b34242;
  background: #fff2f2;
  color: #a12d2d;
}

.send-chat-button {
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.send-chat-button span {
  transform: translateY(-1px);
}

.chat-suggestions {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
}

.chat-suggestions[hidden] {
  display: none;
}

.chat-suggestion {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #f7fbf8;
  color: #17231b;
  text-align: left;
}

.chat-suggestion:hover,
.chat-suggestion:focus-visible {
  border-color: #2f6f4e;
  background: #eef6f0;
}

.chat-suggestion-text {
  min-width: 0;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.learning-candidates-list {
  display: grid;
  gap: 10px;
}

.learning-candidate {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #ffffff;
}

.learning-candidate header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.learning-candidate h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.learning-candidate header span {
  color: #536058;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.learning-candidate-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.learning-candidate-metrics dt {
  color: #66746b;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.learning-candidate-metrics dd {
  margin: 3px 0 0;
  color: #17231b;
  font-weight: 700;
}

.learning-candidate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.microphone-button {
  min-width: 108px;
}

.microphone-button.chat-icon-button {
  min-width: 46px;
}

.voice-options {
  grid-column: 1 / -1;
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #536058;
  font-size: 14px;
}

.voice-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

#voiceStatus.error {
  color: #a12d2d;
}

.voice-debug {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding-top: 8px;
  border-top: 1px dashed #d9e0d8;
  color: #66736b;
  font-size: 12px;
}

.voice-debug strong {
  color: #35433a;
}

.add-anything-voice-draft {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #b9d6c5;
  border-radius: 10px;
  background: #f7fbf8;
}

.add-anything-voice-draft[hidden] {
  display: none;
}

.add-anything-voice-draft p,
.add-anything-voice-draft h3 {
  margin: 0;
}

.chat.locked .composer {
  display: none;
}

.chat.locked .chat-composer-support {
  display: none;
}

.chat.locked .messages {
  align-items: center;
  justify-content: center;
}

.chat.locked .message {
  max-width: 520px;
}

@media (max-width: 1120px) {
  
.quick-add-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border: 1px solid #b9d6c5;
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
}

.quick-add-panel h3 {
  margin-bottom: 6px;
  font-size: 22px;
}

.family-snapshot {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}

.list-card {
  align-items: flex-start;
  min-height: 220px;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mini-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  background: #f5f7f4;
  padding: 10px;
}

.mini-item strong {
  display: block;
  margin-bottom: 3px;
  color: #17211b;
  font-size: 14px;
  line-height: 1.3;
}

.mini-item span {
  color: #66746b;
  font-size: 12px;
}

.icon-action {
  min-width: 36px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #cbd4cc;
  background: #ffffff;
  color: #1f6f4a;
  font-size: 12px;
}

.dashboard-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid #d9e0d8;
  }

  .family-board-panel {
    border-right: 0;
    border-bottom: 1px solid #d9e0d8;
    padding: 22px;
    overflow: visible;
  }

  .nav-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 22px;
  }

  .hero h2 {
    font-size: 34px;
  }

  
.quick-add-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border: 1px solid #b9d6c5;
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
}

.quick-add-panel h3 {
  margin-bottom: 6px;
  font-size: 22px;
}

.family-snapshot {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}

.list-card {
  align-items: flex-start;
  min-height: 220px;
}

.mini-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mini-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  background: #f5f7f4;
  padding: 10px;
}

.mini-item strong {
  display: block;
  margin-bottom: 3px;
  color: #17211b;
  font-size: 14px;
  line-height: 1.3;
}

.mini-item span {
  color: #66746b;
  font-size: 12px;
}

.icon-action {
  min-width: 36px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #cbd4cc;
  background: #ffffff;
  color: #1f6f4a;
  font-size: 12px;
}

.dashboard-grid {
    grid-template-columns: 1fr;
  }

  .composer,
  .quick-add-panel {
    grid-template-columns: 1fr;
  }

  .quick-add-panel {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  .memory-tools {
    grid-template-columns: 1fr;
  }

  .memory-item header,
  .inbox-item header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .nav-menu {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .button-row {
    align-items: stretch;
    flex-direction: column;
  }
}



.daily-briefing-card {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  border: 1px solid #b9d6c5;
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
}

.daily-briefing-card h3 {
  margin-bottom: 6px;
  font-size: 22px;
}

.briefing-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.briefing-list span {
  border-radius: 8px;
  background: #e8f1ec;
  color: #344239;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.35;
}

.event-group-title {
  margin: 8px 0 0;
  color: #344239;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-summary {
  margin: 0 0 5px;
  color: #344239 !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
}

.summary-card .mini-actions {
  align-items: flex-start;
}

/* Dashboard readability and details polish */
.family-snapshot {
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  align-items: start;
}

.summary-card {
  min-width: 0;
}

.summary-card > div,
.mini-item > div,
.board-entry > div {
  min-width: 0;
}

.mini-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.mini-item strong,
.mini-item span,
.board-entry p,
.board-entry h4 {
  overflow-wrap: anywhere;
  word-break: normal;
}

.mini-item span {
  display: block;
  line-height: 1.35;
}

.task-mini-item strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-mini-item.task-overdue {
  border-left: 4px solid #dc2626;
  background: #fef2f2;
}

.task-mini-item.task-overdue span {
  color: #991b1b;
}

.task-overdue-nonfinance {
  border-color: #b91c1c;
  border-left-color: #b91c1c;
  background: #fee2e2;
}

.task-overdue-nonfinance strong,
.task-overdue-nonfinance .mini-summary,
.task-overdue-nonfinance span {
  color: #991b1b;
}

.grocery-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
  padding: 0;
  list-style: none;
}

.grocery-chip-list li {
  max-width: 100%;
  border: 1px solid #d7e4d2;
  border-radius: 999px;
  background: #fffef9;
  padding: 4px 8px;
  color: #24352a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.grocery-card-items {
  max-height: 86px;
  overflow: auto;
}

.grocery-detail-list {
  display: grid;
  gap: 7px;
  margin: 0;
}

.grocery-detail-list li {
  border-radius: 8px;
  padding: 7px 9px;
}

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.compact-action {
  min-height: 36px;
  padding: 7px 9px;
  font-size: 12px;
}

.board-entry {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
}

.board-close {
  align-self: start;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(23, 33, 27, 0.35);
  padding: 18px;
}

.details-modal {
  display: grid;
  gap: 14px;
  width: min(560px, 100%);
  max-height: min(720px, 90vh);
  overflow: auto;
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(23, 33, 27, 0.18);
}

.details-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.details-modal h3 {
  margin: 0;
  font-size: 20px;
}

.details-modal dl {
  display: grid;
  grid-template-columns: minmax(120px, 0.4fr) minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
}

.details-modal dt {
  color: #66746b;
  font-size: 13px;
  font-weight: 800;
}

.details-modal dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #17211b;
  line-height: 1.4;
}


.family-tasks-modal {
  width: min(720px, 100%);
}

.family-tasks-manager-list {
  display: grid;
  gap: 10px;
}

.family-task-manager-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  padding: 12px;
}

.family-task-manager-item > div:first-child {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.family-task-manager-item strong,
.family-task-manager-item span {
  overflow-wrap: anywhere;
}

.family-task-manager-item span {
  color: #66746b;
  font-size: 13px;
}

.family-task-manager-item .danger {
  border: 1px solid #d7b7b7;
  background: #fff7f7;
  color: #9b2525;
}
@media (max-width: 720px) {
  .family-snapshot {
    grid-template-columns: 1fr;
  }

  .details-modal dl {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }

  .task-card-heading,
  .family-task-manager-item {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .task-card-heading {
    display: grid;
  }

  .task-card-heading button {
    width: 100%;
  }

  .family-task-manager-item .mini-actions {
    justify-content: flex-start;
  }
}


/* Warm family dashboard polish */
.daily-briefing-card {
  border-color: #c8dccd;
  background: #fbfdf9;
  box-shadow: 0 10px 28px rgba(47, 87, 63, 0.08);
}

.daily-briefing-card h3 {
  font-size: 24px;
}

.briefing-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.briefing-list span {
  min-height: 58px;
  background: #eef6f0;
  color: #21362a;
  font-weight: 750;
}

.family-snapshot {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.mini-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  background: #f8faf6;
  border: 1px solid #edf1ea;
}

.family-avatar,
.board-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #dfeee4;
  color: #21452f;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  flex: 0 0 auto;
  overflow: hidden;
}

.family-avatar img,
.board-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
}

.family-avatar.has-photo,
.board-avatar.has-photo {
  color: transparent;
  text-shadow: none;
}

.member-card {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.member-card-body {
  min-width: 0;
}

.family-profile-card {
  margin-bottom: 0;
}

.member-avatar {
  width: 80px;
  height: 80px;
  font-size: 20px;
}

.member-name,
.member-email,
.member-role {
  min-width: 0;
}

.member-meta {
  display: block;
}

.member-photo-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.member-photo-choice,
.member-photo-button {
  border: 1px solid #cbd4cc;
  border-radius: 8px;
  background: #ffffff;
  color: #1f6f4a;
  cursor: pointer;
  display: inline-grid;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  min-height: 40px;
  overflow: hidden;
  padding: 10px 12px;
  place-items: center;
  position: relative;
  text-align: center;
  max-width: max-content;
  white-space: nowrap;
}

.member-photo-button {
  min-width: 0;
  padding-inline: 11px;
}

.member-photo-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.member-photo-choice input {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  cursor: pointer;
  opacity: 0;
}

.mini-item strong {
  font-size: 14px;
  line-height: 1.25;
}

.mini-summary {
  margin-bottom: 2px !important;
  font-size: 12px !important;
  line-height: 1.3 !important;
}

.mini-item span:not(.family-avatar) {
  color: #6a756d;
  font-size: 12px;
}

.summary-card h3 {
  font-size: 18px;
}

.summary-card > span {
  font-size: 23px;
}

.compact-action,
.icon-action {
  border-radius: 50%;
}

@media (max-width: 760px) {
  .daily-briefing-card {
    padding: 16px;
  }

  .briefing-list {
    grid-template-columns: 1fr;
  }

  .briefing-list span {
    min-height: auto;
  }

  .family-snapshot {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .summary-card {
    padding: 14px;
  }

  .member-card {
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: start;
    gap: 14px;
  }

  .member-avatar {
    width: 88px;
    height: 88px;
    font-size: 22px;
  }

  .member-name,
  .member-email,
  .member-role {
    display: block;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .member-meta {
    line-height: 1.35;
  }

  .member-meta-separator {
    display: none;
  }

  .list-card {
    min-height: 0;
  }

  .mini-list {
    gap: 7px;
  }
}

@media (max-width: 430px) {
  .mini-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .mini-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .family-avatar,
  .board-avatar {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }
}


/* Lifestyle app refresh */
:root {
  background: #f6f8f1;
  color: #223126;
}

body {
  background:
    radial-gradient(circle at top left, rgba(217, 234, 210, 0.72), transparent 34rem),
    linear-gradient(135deg, #f8faf3 0%, #eef5eb 100%);
}

button {
  border-radius: 999px;
  background: #2f6d4f;
  box-shadow: 0 8px 18px rgba(47, 109, 79, 0.13);
}

button.secondary {
  border-color: #d6e3d5;
  background: #fbfdf8;
  color: #315f47;
  box-shadow: none;
}

input,
select,
textarea {
  border-color: #d6e3d5;
  border-radius: 16px;
  background: #fffef9;
  padding: 13px 15px;
}

.app-shell {
  grid-template-columns: minmax(220px, 280px) minmax(280px, 330px) minmax(0, 1fr);
  gap: 0;
}

.sidebar,
.family-board-panel {
  background: rgba(255, 254, 249, 0.82);
  border-color: rgba(199, 216, 197, 0.8);
  backdrop-filter: blur(18px);
}

.sidebar {
  gap: 30px;
  padding: 34px 22px;
}

.brand h1 {
  color: #244331;
  font-size: 34px;
  letter-spacing: 0;
}

.eyebrow {
  color: #6f7d6f;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.nav-menu {
  gap: 10px;
}

.nav-item {
  min-height: 50px;
  border-radius: 18px;
  color: #3d503f;
  padding: 12px 14px;
}

.nav-item:hover,
.nav-item.active {
  background: #e7f2e4;
  color: #1e4f36;
}

.workspace {
  padding: 42px;
}

.hero {
  margin-bottom: 28px;
}

.hero h2 {
  max-width: 760px;
  color: #203629;
  font-size: 46px;
  letter-spacing: 0;
}

.warm-hello .muted {
  font-size: 16px;
}

.daily-briefing-card {
  position: relative;
  gap: 28px;
  margin-bottom: 34px;
  border: 1px solid #cfe2cc;
  border-radius: 30px;
  background: linear-gradient(145deg, #fffdf5 0%, #eef7eb 100%);
  padding: 32px;
  box-shadow: 0 24px 64px rgba(54, 91, 62, 0.14);
}

.daily-briefing-card h3 {
  margin-bottom: 10px;
  color: #203629;
  font-size: 34px;
  line-height: 1.1;
}

.daily-briefing-card .muted {
  color: #536a55;
  font-size: 17px;
}

.briefing-list {
  gap: 12px;
}

.briefing-list span {
  display: grid;
  align-content: center;
  min-height: 76px;
  border: 1px solid rgba(192, 214, 188, 0.8);
  border-radius: 22px;
  background: rgba(255, 254, 249, 0.74);
  color: #283b2d;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 800;
}

.family-snapshot {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px;
}

.summary-card,
.content-section,
.add-anything-panel,
.inbox-item,
.directory-item,
.chat,
.details-modal {
  border-color: #d8e5d5;
  border-radius: 26px;
  background: rgba(255, 254, 249, 0.9);
  box-shadow: 0 14px 34px rgba(66, 91, 67, 0.08);
}

.summary-card {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  min-height: 250px;
  padding: 24px;
}

.summary-card > span {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 18px;
  background: #edf5e9;
  font-size: 25px;
}

.summary-card h3 {
  margin-bottom: 14px;
  color: #24382a;
  font-size: 21px;
}

.mini-list {
  gap: 12px;
  margin-top: 0;
}

.mini-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid #ecf1e7;
  border-radius: 20px;
  background: #fbfdf7;
  padding: 13px;
}

.mini-item strong {
  color: #24382a;
  font-size: 15px;
}

.mini-summary {
  color: #465b49 !important;
  font-size: 13px !important;
}

.mini-item span:not(.family-avatar),
.status,
.health,
.muted,
.empty-state {
  color: #687868;
}

.family-avatar,
.board-avatar {
  width: 38px;
  height: 38px;
  border-radius: 15px;
  color: #254233;
}

.family-board-panel {
  gap: 22px;
  padding: 34px 22px;
}

.family-board-panel h2 {
  color: #24382a;
  font-size: 28px;
}

.board-list {
  gap: 14px;
}

.board-entry {
  border-color: #dfeade;
  border-radius: 24px;
  background: #fffef9;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(66, 91, 67, 0.07);
}

.board-entry h4 {
  color: #24382a;
}

.related-line {
  color: #4b684f !important;
}

.icon-action,
.compact-action {
  border-radius: 999px;
  box-shadow: none;
}

.content-section {
  gap: 20px;
  padding: 26px;
}

.inbox-pill {
  border-radius: 999px;
  background: #e8f2e4;
}

.created-actions,
.follow-up-form,
.memory-item {
  border-radius: 20px;
  background: #f3f7ee;
}

.technical-field {
  display: none;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  }

  .family-board-panel {
    display: none;
  }
}

@media (max-width: 820px) {
  .workspace {
    padding: 24px;
  }

  .sidebar {
    padding: 22px;
  }

  .hero h2 {
    font-size: 36px;
  }

  .daily-briefing-card {
    border-radius: 24px;
    padding: 24px;
  }

  .daily-briefing-card h3 {
    font-size: 29px;
  }

  .family-snapshot {
    grid-template-columns: 1fr;
  }

  .summary-card {
    min-height: 0;
  }
}

@media (max-width: 520px) {
  .workspace {
    padding: 18px;
  }

  .daily-briefing-card,
  .summary-card,
  .content-section {
    border-radius: 20px;
    padding: 18px;
  }

  .mini-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .mini-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}

/* Mobile navigation drawer */
.mobile-app-bar {
  display: contents;
}

.mobile-app-title,
.mobile-menu-button,
.mobile-menu-overlay,
.mobile-menu-close {
  display: none;
}

.sidebar-top {
  display: block;
}

@media (max-width: 767px), (max-height: 480px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .app-shell {
    display: block;
    width: 100%;
    min-width: 0;
    padding-top: calc(64px + env(safe-area-inset-top));
  }

  .mobile-app-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 12px;
    height: calc(64px + env(safe-area-inset-top));
    min-height: calc(64px + env(safe-area-inset-top));
    border-bottom: 1px solid rgba(199, 216, 197, 0.9);
    background: rgba(255, 254, 249, 0.96);
    padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    backdrop-filter: blur(18px);
  }

  .mobile-help-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    margin-left: auto;
    margin-right: 108px;
    border: 1px solid #cbd4cc;
    border-radius: 999px;
    background: #ffffff;
    color: #1f6f4a;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 850;
    text-decoration: none;
    white-space: nowrap;
  }

  .mobile-app-title {
    display: block;
    min-width: 0;
  }

  .mobile-app-bar .eyebrow {
    margin-bottom: 1px;
    font-size: 11px;
  }

  .mobile-app-bar strong {
    display: block;
    color: #203629;
    font-size: 17px;
    line-height: 1.2;
  }

  .mobile-menu-button,
  .mobile-menu-close {
    display: inline-grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    box-shadow: none;
    font-size: 22px;
    line-height: 1;
  }

  .mobile-menu-close {
    border: 1px solid #d6e3d5;
    background: #fbfdf8;
    color: #315f47;
    font-size: 15px;
  }

  .mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: block;
    background: rgba(23, 33, 27, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .mobile-nav-open .mobile-menu-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1200;
    width: min(86vw, 330px);
    max-width: 100%;
    border-right: 1px solid rgba(199, 216, 197, 0.9);
    border-bottom: 0;
    padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 220ms ease;
    box-shadow: 24px 0 60px rgba(23, 33, 27, 0.2);
  }

  .mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .brand {
    min-width: 0;
    padding: 0;
  }

  .brand h1 {
    font-size: 28px;
  }

  .nav-menu {
    grid-template-columns: 1fr;
  }

  .nav-item {
    min-height: 52px;
  }

  .family-board-panel {
    display: none;
  }

  .workspace {
    width: 100%;
    min-width: 0;
    overflow: visible;
    padding: 16px;
  }

  .hero {
    display: none;
  }

  .daily-briefing-card {
    margin-bottom: 14px;
    border-radius: 22px;
    padding: 18px;
  }

  .daily-briefing-card h3 {
    font-size: 25px;
  }

  .briefing-list {
    grid-template-columns: 1fr;
  }

  .briefing-list span {
    min-height: auto;
  }

  .family-snapshot,
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .family-snapshot .summary-card:nth-child(3) {
    order: 2;
  }

  .family-snapshot .summary-card:nth-child(2) {
    order: 3;
  }

  .family-snapshot .summary-card:nth-child(4) {
    order: 4;
  }

  .family-snapshot .summary-card:nth-child(5) {
    order: 5;
  }

  .summary-card,
  .content-section,
  .add-anything-panel,
  .inbox-item,
  .directory-item,
  .chat {
    width: 100%;
    min-width: 0;
    border-radius: 20px;
  }

  .summary-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
    padding: 16px;
  }

  .summary-card > span {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    font-size: 22px;
  }

  .mini-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .mini-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .section-heading,
  .button-row,
  .inbox-item header,
  .memory-item header {
    align-items: stretch;
    flex-direction: column;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .chat {
    grid-template-rows: minmax(360px, calc(100dvh - 210px)) auto;
  }
}

/* Strict phone layout: no desktop columns under 768px */
html,
body,
#root {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 768px), (max-height: 480px) {
  html,
  body,
  #root {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-top: calc(64px + env(safe-area-inset-top));
    overflow-x: hidden;
  }

  .sidebar,
  .family-board-panel {
    display: none;
  }

  .mobile-app-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 10px;
    height: calc(64px + env(safe-area-inset-top));
    min-height: calc(64px + env(safe-area-inset-top));
    width: 100%;
    max-width: 100%;
    border-bottom: 1px solid rgba(199, 216, 197, 0.9);
    background: rgba(255, 254, 249, 0.98);
    padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    overflow: hidden;
    backdrop-filter: blur(18px);
  }

  .mobile-app-title {
    display: block;
    min-width: 0;
  }

  .mobile-app-bar strong {
    display: block;
    min-width: 0;
    color: #203629;
    font-size: 18px;
    line-height: 1.2;
  }

  .mobile-menu-button,
  .mobile-menu-close {
    display: inline-grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    padding: 0;
    border-radius: 50%;
    box-shadow: none;
    font-size: 22px;
    line-height: 1;
  }

  .mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 3500;
    display: block;
    width: 100vw;
    height: 100dvh;
    background: rgba(23, 33, 27, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .mobile-nav-open .mobile-menu-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-nav-open .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 4000;
    display: flex;
    width: min(100vw, 360px);
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-right: 1px solid rgba(199, 216, 197, 0.9);
    border-bottom: 0;
    padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
    overflow-y: auto;
    transform: none;
    box-shadow: 24px 0 60px rgba(23, 33, 27, 0.2);
  }

  .main-content,
  .workspace {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }

  .view,
  .view.active,
  #dashboardView {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .hero {
    display: none;
  }

  .daily-briefing-card,
  .dashboard-grid,
  .family-snapshot,
  .summary-card,
  .content-section,
  .add-anything-panel,
  .inbox-item,
  .directory-item,
  .chat {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .dashboard-grid,
  .family-snapshot,
  .briefing-list,
  .composer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .summary-card {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 0;
  }

  .family-snapshot .summary-card:nth-child(3) {
    order: 2;
  }

  .family-snapshot .summary-card:nth-child(2) {
    order: 3;
  }

  .family-snapshot .summary-card:nth-child(4) {
    order: 4;
  }

  .family-snapshot .summary-card:nth-child(5) {
    order: 5;
  }

  .mini-item,
  .board-entry {
    max-width: 100%;
  }
}

/* Authoritative phone layout */

@media (max-width: 768px) {

  html,

  body {

    width: 100% !important;

    max-width: 100% !important;

    min-width: 0 !important;

    overflow-x: clip !important;

  }



  body * {

    min-width: 0;

  }



  .app-shell {

    display: block !important;

    width: 100% !important;

    max-width: 100% !important;

    min-width: 0 !important;

    padding-top: 64px !important;

    overflow-x: clip !important;

  }



  .sidebar,

  .family-board-panel {

    display: none !important;

  }



  .mobile-nav-open .sidebar {

    display: flex !important;

    width: min(86vw, 340px) !important;

    max-width: 100% !important;

    min-width: 0 !important;

  }



  .main-content,

  .workspace,

  .view,

  .view.active,

  #dashboardView {

    display: block;

    width: 100% !important;

    max-width: 100% !important;

    min-width: 0 !important;

    margin: 0 !important;

    overflow-x: clip !important;

  }



  .main-content,

  .workspace {

    padding: 16px 16px calc(32px + env(safe-area-inset-bottom)) !important;

  }



  .dashboard-grid,

  .content-grid,

  .card-row,

  .family-snapshot {

    display: flex !important;

    flex-direction: column !important;

    align-items: stretch !important;

    gap: 14px !important;

    width: 100% !important;

    max-width: 100% !important;

    min-width: 0 !important;

  }



  .daily-briefing-card,

  .dashboard-card,

  .item-card,

  .section-card,

  .summary-card,

  .content-section,

  .add-anything-panel,

  .inbox-item,

  .directory-item,

  .chat {

    width: 100% !important;

    max-width: 100% !important;

    min-width: 0 !important;

    flex: 0 0 auto !important;

  }



  .daily-briefing-card,

  .summary-card {

    padding: 18px !important;

  }



  .summary-card {

    display: flex !important;

    flex-direction: column !important;

    align-items: stretch !important;

    min-height: 0 !important;

  }



  .summary-card > span {

    flex: 0 0 auto !important;

  }



  .summary-card > div,

  .mini-list,

  .mini-item,

  .mini-item > div,

  .briefing-list,

  .briefing-list span {

    width: 100% !important;

    max-width: 100% !important;

    min-width: 0 !important;

  }



  .mini-item {

    display: flex !important;

    flex-direction: column !important;

    align-items: stretch !important;

  }



  .mini-actions {

    display: flex !important;

    flex-direction: row !important;

    flex-wrap: wrap !important;

    grid-column: auto !important;

    justify-content: flex-start !important;

  }



  .daily-briefing-card *,

  .dashboard-card *,

  .item-card *,

  .section-card *,

  .summary-card *,

  .mini-item * {

    word-break: normal !important;

    overflow-wrap: break-word !important;

    white-space: normal !important;

  }



  .family-snapshot .summary-card:nth-child(n) {

    order: initial !important;

  }



  .section-heading,

  .button-row,

  .inbox-item header,

  .memory-item header,

  .composer {

    display: flex !important;

    flex-direction: column !important;

    align-items: stretch !important;

    width: 100% !important;

    max-width: 100% !important;

    min-width: 0 !important;

  }



  img,

  video,

  canvas,

  svg,

  input,

  select,

  textarea,

  button {

    max-width: 100% !important;

  }

}


/* PWA install prompt and final iPhone layout guard */
.install-prompt {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 2800;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  width: min(520px, calc(100vw - 36px));
  border: 1px solid rgba(187, 211, 184, 0.95);
  border-radius: 24px;
  background: rgba(255, 254, 249, 0.98);
  color: #203629;
  padding: 16px;
  box-shadow: 0 22px 60px rgba(23, 33, 27, 0.18);
  backdrop-filter: blur(18px);
}

.install-prompt[hidden] {
  display: none !important;
}

.install-prompt strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

.install-prompt p {
  margin: 0;
  color: #536a55;
  font-size: 14px;
  line-height: 1.4;
}

.install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ios-install-note {
  grid-column: 1 / -1;
  display: none;
}

.install-prompt.ios-install .ios-install-note {
  display: block;
}

@media (display-mode: standalone) {
  .install-prompt {
    display: none !important;
  }
}

@media (max-width: 768px) {
  body {
    background-color: #f8fbf7;
    overscroll-behavior-x: none;
  }

  .install-prompt {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    grid-template-columns: 1fr;
    width: auto;
    max-width: none;
    border-radius: 22px;
  }

  .install-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .install-actions button {
    width: 100%;
    min-height: 48px;
  }

  .mobile-app-bar {
    padding-top: env(safe-area-inset-top);
  }

  .app-shell {
    min-height: 100dvh !important;
    background: #f8fbf7;
  }

  .main-content,
  .workspace {
    padding-right: max(16px, env(safe-area-inset-right)) !important;
    padding-left: max(16px, env(safe-area-inset-left)) !important;
  }

  .chat {
    grid-template-rows: minmax(360px, calc(100dvh - 190px)) auto !important;
  }

  .messages {
    padding: 16px;
  }

  .message {
    max-width: 100%;
  }
}

@media (max-width: 430px) {
  .daily-briefing-card,
  .summary-card,
  .content-section,
  .add-anything-panel,
  .inbox-item,
  .directory-item {
    border-radius: 18px !important;
    padding: 16px !important;
  }

  .chat {
    border-radius: 18px !important;
  }

  .daily-briefing-card h3 {
    font-size: 24px !important;
  }

  .summary-card h3 {
    font-size: 19px !important;
  }

  .composer {
    padding: 14px !important;
  }

  #ask-family-ai.composer {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: end !important;
    gap: 10px !important;
  }

  #ask-family-ai .eyebrow,
  #ask-family-ai .context-help,
  #ask-family-ai .chat-suggestions {
    grid-column: 1 / -1;
  }

  #ask-family-ai .composer-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: end !important;
    gap: 8px !important;
  }

  .chat-composer-support {
    padding: 0 14px 14px !important;
  }
}


.agenda-group + .agenda-group { margin-top: 0.8rem; }
.agenda-date { margin: 0 0 0.4rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

#ask-family-ai.composer {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: end !important;
}

#ask-family-ai .eyebrow,
#ask-family-ai .context-help,
#ask-family-ai .chat-suggestions {
  grid-column: 1 / -1;
}

#ask-family-ai .composer-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: end !important;
}
.agenda-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.65rem; align-items: center; padding: 0.55rem 0; border-top: 1px solid rgba(92, 72, 52, 0.1); }
.agenda-item:first-of-type { border-top: 0; }
.agenda-item div { min-width: 0; display: grid; gap: 0.15rem; }
.agenda-item strong, .agenda-item span { overflow-wrap: anywhere; }
.agenda-item span { color: var(--muted); font-size: 0.82rem; }
.memory-add-panel { display: grid; gap: 1rem; margin: 1rem 0 1.5rem; padding: 1.1rem; border: 2px solid #9bb9a7; border-radius: 14px; background: #f7fbf8; box-shadow: 0 8px 24px rgba(47, 91, 64, 0.08); }
.memory-add-panel.memory-read-only { opacity: 0.78; }
.memory-add-panel h3 { margin: 0.15rem 0 0.25rem; }
.memory-add-panel .field { display: grid; gap: 0.4rem; margin: 0; }
.memory-add-panel .field > span { font-weight: 800; color: #23372b; }
.memory-content-field textarea { width: 100%; min-height: 130px; }
.memory-save-button { width: fit-content; min-width: 220px; font-weight: 800; }
@media (max-width: 760px) { .memory-add-panel { padding: 0.9rem; } .memory-save-button { width: 100%; } }
.memory-form-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(9rem, 1fr) minmax(9rem, 1fr); gap: 0.7rem; }
@media (max-width: 760px) { .memory-form-grid { grid-template-columns: 1fr; } }

/* Mobile dashboard section carousel */
@media (max-width: 768px) {
  .mobile-section-carousel {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-right: calc(100% - 85vw);
    overflow-x: auto !important;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-section-carousel::-webkit-scrollbar {
    height: 5px;
  }

  .mobile-section-carousel::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #b9cdbd;
  }

  .mobile-section-carousel > .dashboard-card {
    width: 85vw !important;
    max-width: 85vw !important;
    flex: 0 0 85vw !important;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }
}


/* Route and authentication visibility */
[hidden] {
  display: none !important;
}

.auth-pending .app-shell {
  visibility: hidden;
}

.unauthenticated .app-shell {
  display: block;
}

.unauthenticated .workspace {
  max-width: 720px;
  margin: 0 auto;
}

.view {
  display: none !important;
}

.view.active {
  display: block !important;
}

body:not([data-page="today"]) .family-board-panel {
  display: none !important;
}

body:not([data-page="today"]) .app-shell,
.unauthenticated .app-shell {
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
}


/* Family board and notifications */
.mobile-family-board {
  display: none;
}

.notification-button {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 1300;
  min-height: 42px;
  border-radius: 999px;
  padding: 9px 13px;
  box-shadow: 0 8px 24px rgba(36, 67, 49, 0.16);
}

.notification-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  place-items: center;
  border-radius: 999px;
  background: #a33b35;
  color: white;
  padding: 0 5px;
  font-size: 11px;
}

.notification-panel {
  position: fixed;
  top: 66px;
  right: 18px;
  z-index: 1290;
  width: min(390px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 90px));
  overflow-y: auto;
  border: 1px solid #cfe2cc;
  border-radius: 24px;
  background: #fffef9;
  padding: 18px;
  box-shadow: 0 24px 70px rgba(31, 57, 41, 0.24);
}

.notification-panel header,
.notification-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.notification-panel h2 {
  margin: 0;
  font-size: 22px;
}

.notification-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.notification-item {
  width: 100%;
  border: 1px solid #e2ebe0;
  border-radius: 17px;
  background: #fbfdf7;
  color: #24382a;
  padding: 13px;
  text-align: left;
  box-shadow: none;
}

.notification-item.unread {
  border-color: #93bea0;
  background: #edf7ea;
}

.notification-item strong,
.notification-item span {
  display: block;
}

.notification-item span {
  margin-top: 4px;
  color: #637464;
  font-size: 12px;
}

.notification-permission {
  width: 100%;
  margin-top: 14px;
}

.notification-test-status {
  min-height: 18px;
  margin: 8px 2px 0;
  font-size: 12px;
}

@media (max-width: 768px) {
  .notification-button {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    margin-left: auto;
    min-height: 42px;
    height: 42px;
    padding: 8px 11px;
    box-shadow: 0 6px 18px rgba(36, 67, 49, 0.14);
  }

  .notification-button > span:first-child {
    font-size: 0;
  }

  .notification-button > span:first-child::after {
    content: "Alerts";
    font-size: 13px;
  }

  .notification-panel {
    top: calc(64px + env(safe-area-inset-top) + 8px);
    right: max(8px, env(safe-area-inset-right));
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    max-height: calc(100dvh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  #dashboardView .hero {
    display: block !important;
    margin-bottom: 14px !important;
  }

  #dashboardView .hero .eyebrow,
  #dashboardView .hero .muted {
    display: block !important;
  }

  #dashboardView .hero h2 {
    font-size: 30px !important;
  }

  .mobile-section-carousel {
    flex-direction: column !important;
    overflow: visible !important;
    padding-right: 0 !important;
    scroll-snap-type: none !important;
  }

  .mobile-section-carousel > .dashboard-card,
  .mobile-section-carousel > .mobile-family-board {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
  }

  .mobile-family-board {
    display: block !important;
    order: 2 !important;
    border: 1px solid #cfe2cc;
    border-radius: 22px;
    background: #f6fbf2;
    padding: 18px;
  }

  #dashboardView .family-snapshot .today-dashboard-card { order: 1 !important; }
  #dashboardView .family-snapshot .mobile-family-board { order: 2 !important; }
  #dashboardView .family-snapshot .upcoming-dashboard-card { order: 3 !important; }
  #dashboardView .family-snapshot .attention-dashboard-card { order: 4 !important; }
  #dashboardView .family-snapshot .shopping-dashboard-card { order: 5 !important; }
  #dashboardView .family-snapshot .papers-dashboard-card { order: 6 !important; }
}

.auth-pending .notification-button,
.unauthenticated .notification-button,
.unauthenticated .notification-panel {
  display: none !important;
}

.notification-target {
  outline: 3px solid rgba(55, 126, 82, 0.5);
  outline-offset: 3px;
  transition: outline-color 300ms ease;
}

.reminder-settings-section {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding-top: 1rem;
}

.reminder-settings-section h4 {
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
}

.reminder-preset-list {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 0.75rem;
}

.reminder-preset {
  align-items: center;
  display: flex;
  gap: 0.45rem;
  min-width: 0;
}

.reminder-custom-line {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: minmax(5rem, 8rem) minmax(8rem, 1fr);
  margin-top: 0.75rem;
}


/* Keep notification controls above every mobile app-bar override. */
.notification-button {
  z-index: 10050 !important;
}

.notification-panel {
  z-index: 10040 !important;
}

/* Dashboard recurrence, details, and attachment viewer */
.repeat-controls { display: grid; grid-template-columns: minmax(140px, 0.5fr) minmax(0, 1.5fr) minmax(170px, 0.7fr); gap: 12px; align-items: end; margin: 12px 0; }
.repeat-weekdays { display: flex; flex-wrap: wrap; gap: 8px 12px; min-width: 0; margin: 0; border: 1px solid #d8e5d5; border-radius: 14px; padding: 9px 12px; }
.repeat-weekdays legend { padding: 0 5px; color: #526458; font-size: 12px; font-weight: 800; }
.repeat-weekdays label { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; }
.briefing-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.briefing-section { min-height: 76px; border: 1px solid rgba(192, 214, 188, 0.8); border-radius: 22px; background: rgba(255, 254, 249, 0.74); padding: 14px 16px; }
.briefing-section strong { color: #283b2d; }
.briefing-section ul { margin: 8px 0 0; padding-left: 18px; color: #435448; }
.briefing-section li + li { margin-top: 5px; }
.agenda-item { grid-template-columns: auto minmax(0, 1fr) auto; }
.payable-card {
  grid-template-columns: minmax(0, 1fr) auto;
  border-left: 4px solid rgba(70, 107, 86, 0.35);
  padding-left: 0.65rem;
}
.payable-due_today {
  border-left-color: #d97706;
  background: #fff7ed;
}
.payable-overdue {
  border-left-color: #dc2626;
  background: #fef2f2;
}
.payable-paid {
  opacity: 0.72;
}
.paid-action {
  white-space: nowrap;
}
.money-payable-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  border-left: 4px solid rgba(70, 107, 86, 0.35);
  padding: 0.35rem 0 0.35rem 0.55rem;
}
.money-payable-line p {
  margin: 0;
}
.modal-open { overflow: hidden; touch-action: none; }
.modal-close, .image-viewer-close { display: grid; width: 44px; height: 44px; min-height: 44px; flex: 0 0 44px; place-items: center; border: 0; border-radius: 999px; background: #1f3528; color: #fff; font-size: 18px; font-weight: 900; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 10px; }
.inbox-edit-form { display: grid; gap: 14px; min-height: 0; }
.inbox-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.form-status { margin: 0; color: #8a3b18; font-size: 13px; font-weight: 700; min-height: 18px; }
.assignee-field { grid-column: 1 / -1; }
.assignee-select {
  min-height: 48px;
  border: 2px solid #1f6f4a;
  background-color: #ffffff;
  background-image: linear-gradient(45deg, transparent 50%, #1f6f4a 50%), linear-gradient(135deg, #1f6f4a 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
  font-weight: 800;
}
.field-hint { margin-top: -4px; color: #66746b; font-size: 12px; line-height: 1.35; }
.review-warnings { border: 1px solid #d9a441; border-radius: 12px; background: #fff8df; padding: 10px 12px; color: #684d13; }
.review-warnings p { margin: 0; font-weight: 700; }
.review-warnings p + p { margin-top: 6px; }
.image-viewer-overlay { position: fixed; inset: 0; z-index: 20000; display: grid; place-items: center; overflow: hidden; background: rgba(8, 13, 10, 0.92); padding: max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.image-viewer-close { position: fixed; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); z-index: 20002; background: #fff; color: #17211b; box-shadow: 0 4px 18px rgba(0,0,0,0.35); }
.image-viewer-scroller { display: grid; width: 100%; height: 100%; place-items: center; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.image-viewer-scroller img { display: block; max-width: min(100%, 1100px); max-height: calc(100dvh - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); width: auto; height: auto; object-fit: contain; border-radius: 8px; }
@media (max-width: 760px) {
  .repeat-controls { grid-template-columns: 1fr; }
  .details-modal { width: 100%; max-height: 85dvh; overflow: auto; overscroll-behavior: contain; border-radius: 20px; padding: 0 14px 14px; }
  .details-modal > header { position: sticky; top: 0; z-index: 2; margin: 0 -14px; padding: 12px 14px 8px; background: #fff; }
  .details-modal dl { padding-top: 4px; }
  .inbox-edit-grid { grid-template-columns: 1fr; }
  .modal-actions { position: sticky; bottom: 0; margin: 0 -14px -14px; padding: 10px 14px max(10px, env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #e3ebe1; }
  .modal-overlay { align-items: end; padding: 12px; }
  .briefing-list { grid-template-columns: 1fr; }
  .image-viewer-overlay { place-items: stretch; }
  .image-viewer-scroller { padding-top: 52px; }
}



.money-analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.money-analytics-list {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.money-analytics-list p {
  margin: 0;
}

.money-summary-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.money-summary-card {
  min-width: 0;
}

.money-chart-card {
  min-width: 0;
}

.money-chart-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.money-metric.compact {
  font-size: 1rem;
  white-space: nowrap;
}

.money-empty-state {
  grid-column: 1 / -1;
}

.money-pie-wrap {
  display: grid;
  grid-template-columns: minmax(132px, 180px) minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  min-height: 180px;
}

.money-pie {
  display: block;
  width: min(180px, 48vw);
  aspect-ratio: 1;
  border-radius: 50%;
}

.money-pie-slice {
  cursor: pointer;
  stroke: #fff;
  stroke-width: 2;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform-origin: center;
}

.money-pie-slice:hover,
.money-pie-slice:focus {
  opacity: 0.86;
  outline: none;
  transform: scale(1.015);
}

.money-pie-center {
  fill: #fff;
  stroke: rgba(49, 63, 58, 0.08);
  stroke-width: 1;
}

.money-chart-legend {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.money-chart-legend p,
.money-legend-button {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.money-legend-button {
  width: 100%;
  border: 1px solid rgba(49, 63, 58, 0.12);
  background: rgba(255, 255, 255, 0.74);
  color: inherit;
  justify-content: flex-start;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  text-align: left;
}

.money-legend-button:hover,
.money-legend-button:focus {
  border-color: rgba(47, 111, 78, 0.45);
  background: rgba(47, 111, 78, 0.06);
}

.money-chart-legend span,
.money-legend-button span {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  flex: 0 0 auto;
}

.money-category-single {
  cursor: pointer;
}

.money-category-detail-panel {
  margin-top: 1rem;
  border-top: 1px solid rgba(49, 63, 58, 0.12);
  padding-top: 0.85rem;
  display: grid;
  gap: 0.65rem;
}

.money-category-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.money-category-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  border: 1px solid rgba(49, 63, 58, 0.1);
  border-radius: 8px;
  padding: 0.65rem;
  min-width: 0;
}

.money-category-detail-row > div {
  min-width: 0;
}

.money-category-detail-row strong,
.money-category-detail-row p {
  overflow-wrap: anywhere;
}

.money-svg-chart svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  overflow: visible;
}

.money-axis {
  stroke: rgba(49, 63, 58, 0.22);
  stroke-width: 1.5;
}

.money-line {
  fill: none;
  stroke: #2f6f4e;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.money-dot {
  fill: #fff;
  stroke: #2f6f4e;
  stroke-width: 3;
}

.money-chart-label {
  fill: #5d6862;
  font-size: 10px;
}

.money-bar-chart {
  display: grid;
  gap: 0.7rem;
}

.money-bar-row {
  display: grid;
  grid-template-columns: minmax(72px, 0.9fr) minmax(80px, 1.3fr) auto;
  gap: 0.65rem;
  align-items: center;
  min-width: 0;
}

.money-bar-row > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.money-bar-row strong {
  font-size: 0.85rem;
  white-space: nowrap;
}

.money-bar-track {
  height: 0.75rem;
  border-radius: 999px;
  background: rgba(47, 111, 78, 0.12);
  overflow: hidden;
}

.money-bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #4f8cc9;
}

.money-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.money-tab {
  border: 1px solid var(--border, #d9e2d9);
  background: #fff;
  color: inherit;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
}

.money-tab.active {
  background: #2f6f4e;
  color: #fff;
  border-color: #2f6f4e;
}

.money-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.money-fields {
  display: grid;
  gap: 0.75rem;
}

.money-fields label {
  display: grid;
  gap: 0.35rem;
  font-weight: 650;
}

.money-fields input,
.money-fields select,
.money-fields textarea {
  width: 100%;
}

.money-record,
.analytics-block {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.money-month-folder {
  border: 1px solid rgba(47, 111, 78, 0.18);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 0.75rem;
}

.money-month-folder summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
}

.money-month-folder summary span {
  color: #66746b;
  font-size: 0.9rem;
  white-space: nowrap;
}

.money-month-records {
  border-top: 1px solid rgba(47, 111, 78, 0.12);
  padding: 0.75rem;
}

.money-month-records .money-record:last-child {
  margin-bottom: 0;
}

.analytics-block {
  display: block;
}

.analytics-block pre {
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.85rem;
  background: rgba(47, 111, 78, 0.06);
  padding: 0.75rem;
  border-radius: 8px;
}

.money-metric {
  font-size: 1.2rem;
  font-weight: 750;
  margin: 0;
}

.compact-heading {
  margin-bottom: 0.75rem;
}

@media (max-width: 820px) {
  .money-layout,
  .money-analytics-grid,
  .money-summary-row {
    grid-template-columns: 1fr;
  }

  .money-chart-head {
    display: grid;
  }

  .money-pie-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .money-pie-legend {
    width: 100%;
  }

  .money-category-detail-head,
  .money-category-detail-row {
    display: grid;
  }

  .money-bar-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.35rem;
  }

  .money-bar-row > span:first-child {
    white-space: normal;
  }
}

.smart-shopping-section {
  max-width: 1120px;
}

.smart-shopping-panel {
  display: grid;
  gap: 12px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #fdfefd;
  padding: 16px;
}

.shopping-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.shopping-summary-card {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.shopping-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #ffffff;
}

.shopping-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 14px;
}

.shopping-table th,
.shopping-table td {
  border-bottom: 1px solid #e4ebe4;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.shopping-table th {
  background: #eef5ef;
  color: #24362c;
  font-weight: 800;
}

.shopping-table td {
  overflow-wrap: anywhere;
}


.grocery-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.grocery-compare-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.grocery-compare-card.cheapest {
  border-color: #2d7a4f;
}

.grocery-compare-card img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: #f7faf7;
  border-radius: 6px;
}

.grocery-compare-card-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.grocery-compare-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cheapest-badge {
  border-radius: 999px;
  background: #dff3e7;
  color: #195437;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
}

.grocery-product-name,
.grocery-product-unit,
.grocery-product-meta {
  margin: 0;
  color: #536457;
}

.grocery-product-price {
  margin: 0;
  color: #1f3328;
  font-size: 22px;
  font-weight: 900;
}

.grocery-product-link {
  color: #1c6b46;
  font-weight: 800;
}

.grocery-compare-debug {
  margin-top: 12px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #f7faf7;
  padding: 10px 12px;
}

@media (max-width: 820px) {
  .grocery-compare-grid {
    grid-template-columns: 1fr;
  }

  .grocery-compare-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .grocery-compare-card img {
    width: 72px;
    height: 72px;
  }
}

@media (max-width: 820px) {
  .shopping-summary-grid {
    grid-template-columns: 1fr;
  }

  .smart-shopping-panel .section-heading {
    display: grid;
  }
}


.grocery-review-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  background: var(--surface);
}

.grocery-review-card h4,
.grocery-edit-section h4 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.grocery-review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.grocery-review-meta span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.85rem;
}

.grocery-review-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.grocery-review-table th,
.grocery-review-table td {
  border-top: 1px solid var(--border);
  padding: 6px;
  text-align: left;
  vertical-align: top;
}

.grocery-edit-section {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.grocery-edit-table {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.grocery-edit-row {
  display: grid;
  grid-template-columns: minmax(140px, 2fr) repeat(5, minmax(70px, 1fr)) auto;
  gap: 6px;
  align-items: center;
}

.grocery-edit-row input {
  min-width: 0;
}

@media (max-width: 720px) {
  .grocery-edit-row {
    grid-template-columns: 1fr 1fr;
  }
}

.grocery-suggestion-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  background: var(--surface);
}

.grocery-suggestion-table {
  display: grid;
  gap: 8px;
}

.grocery-suggestion-row {
  display: grid;
  grid-template-columns: minmax(140px, 2fr) minmax(120px, 1.3fr) repeat(3, minmax(70px, 0.8fr)) minmax(110px, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.grocery-suggestion-row input {
  min-width: 0;
}

.grocery-suggestion-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.grocery-suggestion-total {
  margin: 10px 0 0;
}

@media (max-width: 720px) {
  .grocery-suggestion-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* In-app Help Centre */
.help-centre-section {
  max-width: 1180px;
  padding-bottom: calc(44px + env(safe-area-inset-bottom));
}

.help-centre-heading {
  align-items: flex-start;
}

.help-centre-actions,
.help-search-panel,
.help-mobile-actions,
.help-download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.help-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid #cbd4cc;
  border-radius: 8px;
  background: #ffffff;
  color: #1f6f4a;
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
}

.help-mobile-actions {
  margin: 0 0 12px;
}

.help-search-toggle,
.help-toc-toggle {
  display: none;
}

.help-search-panel {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 0 10px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  padding: 12px;
  backdrop-filter: blur(12px);
}

.help-download-links {
  margin: 0 0 18px;
}

.help-search-field {
  display: grid;
  flex: 1 1 260px;
  gap: 6px;
  color: #344239;
  font-size: 13px;
  font-weight: 800;
}

.help-content {
  display: grid;
  gap: 20px;
}

.help-content .toc {
  position: static;
  min-width: 0;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
}

.help-content .toc ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 24px;
  margin: 0;
  padding-left: 22px;
}

.help-content .toc a {
  color: #344239;
  font-weight: 800;
  text-decoration: none;
}

.help-content .toc[hidden] {
  display: none;
}

.help-content .guide-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.help-content .section {
  min-width: 0;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #ffffff;
  padding: clamp(20px, 4vw, 32px);
  scroll-margin-top: 100px;
  overflow-wrap: anywhere;
}

.help-content .section-header {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.help-content .grid {
  display: grid;
  gap: 14px;
}

.help-content .two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.help-content .three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.help-content .mini-card,
.help-content .callout,
.help-content .step,
.help-content .qa-card {
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #fbfcfb;
  padding: 16px;
}

.help-content .callout {
  border-left: 5px solid #1f6f4a;
}

.help-content .callout.warning {
  border-left-color: #b56b16;
  background: #fffaf2;
}

.help-content .callout.accent {
  border-left-color: #9a4a5a;
  background: #fff7f8;
}

.help-content .step-number,
.help-content .avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #1f6f4a;
  color: #ffffff;
  font-weight: 900;
}

.help-content .step-number {
  width: 30px;
  height: 30px;
  margin-bottom: 10px;
}

.help-content .avatar {
  width: 36px;
  height: 36px;
}

.help-content .list {
  margin: 0;
  padding-left: 22px;
}

.help-content .list li {
  margin: 8px 0;
}

.help-content .table-wrap {
  overflow-x: auto;
}

.help-content .role-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.help-content .role-table th,
.help-content .role-table td {
  border: 1px solid #d9e0d8;
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.help-content .role-table th {
  background: #e8f1ec;
  color: #123b2a;
}

.help-figure {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.help-figure img,
.image-fallback {
  width: 100%;
  min-height: 210px;
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #fbfcfb;
}

.help-figure img {
  display: block;
  height: auto;
}

.image-fallback {
  display: grid;
  place-items: center;
  border-style: dashed;
  color: #66746b;
  padding: 22px;
  text-align: center;
}

.help-figure figcaption {
  color: #66746b;
  font-size: 13px;
}

.help-content details {
  border: 1px solid #d9e0d8;
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px 16px;
}

.help-content details + details {
  margin-top: 10px;
}

.help-content summary {
  cursor: pointer;
  color: #123b2a;
  font-weight: 900;
}

.help-content :focus-visible,
.help-search-panel :focus-visible,
.help-mobile-actions :focus-visible,
.help-download-links :focus-visible,
.help-centre-actions :focus-visible {
  outline: 3px solid #8fc6a7;
  outline-offset: 2px;
}

@media (max-width: 920px) {
  .help-content .toc ol,
  .help-content .two-col,
  .help-content .three-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px), (max-height: 480px) {
  body[data-page="help"] .mobile-help-link {
    display: none;
  }

  body[data-page="help"] .notification-button {
    margin-left: auto;
  }

  #helpView .content-section {
    border-radius: 14px;
    padding: 14px;
  }

  .help-centre-section {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .help-centre-heading {
    gap: 12px;
  }

  .help-centre-heading h2 {
    margin-bottom: 8px;
    font-size: 26px;
  }

  .help-centre-actions {
    gap: 10px;
  }

  .help-centre-actions,
  .help-search-panel,
  .help-mobile-actions,
  .help-download-links {
    align-items: stretch;
    flex-direction: column;
  }

  .help-action-link,
  .help-search-panel button,
  .help-mobile-actions button {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
  }

  .help-search-toggle,
  .help-toc-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .help-search-panel {
    position: static;
    display: none;
    margin: 0 0 10px;
    border: 0;
    background: transparent;
    padding: 0;
    backdrop-filter: none;
  }

  .help-search-panel.expanded {
    display: flex;
    align-items: end;
    flex-direction: row;
    gap: 8px;
  }

  .help-search-field {
    flex: 1 1 auto;
    gap: 0;
    min-width: 0;
  }

  .help-search-field span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .help-search-field input {
    min-height: 44px;
    padding: 10px 12px;
  }

  .help-search-panel button {
    width: auto;
    flex: 0 0 auto;
  }

  #helpSearchStatus {
    margin: 0 0 10px;
    min-height: 0;
  }

  .help-download-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .help-download-links .help-action-link {
    min-height: 44px;
    padding: 10px 8px;
    text-align: center;
  }

  .help-content {
    gap: 12px;
  }

  .help-content .toc {
    position: static;
    margin: 0;
    padding: 14px;
  }

  .help-content .toc h2 {
    margin-bottom: 10px;
    font-size: 20px;
  }

  .help-content .toc ol {
    gap: 6px;
    padding-left: 20px;
  }

  .help-content .section {
    padding: 16px;
    scroll-margin-top: calc(76px + env(safe-area-inset-top));
  }

  .help-content .section-header {
    margin-bottom: 12px;
  }

  .help-content .mini-card,
  .help-content .callout,
  .help-content .step,
  .help-content .qa-card {
    padding: 12px;
  }

  .help-figure {
    margin: 12px 0;
  }

  .help-figure img,
  .image-fallback {
    min-height: 150px;
  }
}

@media print {
  @page {
    margin: 16mm;
  }

  body {
    background: #ffffff !important;
  }

  .mobile-app-bar,
  .sidebar,
  .family-board-panel,
  .notification-panel,
  .notification-button,
  .help-search-panel,
  .help-mobile-actions,
  .help-download-links,
  .help-centre-actions,
  .context-help,
  .install-prompt {
    display: none !important;
  }

  .app-shell {
    display: block !important;
    min-height: 0 !important;
  }

  .workspace {
    display: block !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .view {
    display: none !important;
  }

  #helpView {
    display: block !important;
  }

  .help-centre-section {
    max-width: none !important;
    padding: 0 !important;
  }

  .help-content .toc,
  .help-content .section {
    break-inside: avoid;
    box-shadow: none !important;
  }

  .help-figure {
    break-inside: avoid;
  }

  .help-figure img,
  .image-fallback {
    max-height: 130mm;
    object-fit: contain;
  }

  .help-content .role-table {
    font-size: 11px;
    table-layout: fixed;
  }
}
