
  /* Design system v2 (#326): the tokens of sites/shared/css/tidy-core.css, with the same names
     and values (sites/tests hold the two equal). Warm paper, ink, the one suite teal, and a
     marigold accent; Atkinson Hyperlegible to read, Fraunces for headings. */
  :root {
    --bg: #f6f2ea;
    --surface: #fffdf8;
    --surface-subtle: #ece5d8;
    --text-main: #14211f;
    --text-body: #2e3b38;
    --text-muted: #55615c;
    --border: #ddd4c4;
    --border-control: #7a7469;
    --focus-ring: #0f766e;
    --primary: #0f766e;
    --primary-dark: #0b4f4a;
    --primary-light: #e2ede8;
    --on-action: #ffffff;
    --field: #0b4f4a;
    --on-field: #ffffff;
    --on-field-muted: #cfe3dc;
    --accent: #e3a33b;
    --accent-light: #f7e6c4;
    --accent-dark: #8a5210;
    --success: var(--primary);
    --danger: #c4472f;
    --danger-light: #f6dfd8;
    --danger-ink: #a3341f;
    --font-sans: "Atkinson Hyperlegible", system-ui, sans-serif;
    --font-display: "Fraunces", Georgia, serif;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-full: 9999px;
    --on-danger: #ffffff;
    --space-2: 8px;
    --space-4: 16px;
    --touch-min: 48px;
    --touch-kid: 56px;
    --shadow-sm: none;
    --shadow-md: 0 8px 24px -8px rgba(20, 33, 31, 0.18);
    --shadow-lg: 0 16px 40px -12px rgba(20, 33, 31, 0.22);
    --scrim: rgba(20, 33, 31, 0.45);
    /* The type scale (#424): every font size on the page is one of these, as tidy-core.css
       declares them. sites/tests/test_type_scale_tidyfamily.py holds the page to it. */
    --type-caption-size: 13px;
    --type-body-sm-size: 14px;
    --type-body-size: 16px;
    --type-body-lg-size: 18px;
    --type-h3-size: 20px;
    --type-h2-size: 24px;
    --type-h1-size: 32px;
    --type-display-size: 48px;
  }
  /* On a phone, nothing people read is under 16px (#424): caption and body-sm read at body
     size. Badges and pills stay captions, as in the design system's Badge. */
  @media (max-width: 639px) {
    :root { --type-caption-size: var(--type-body-size); --type-body-sm-size: var(--type-body-size); }
    .tidy-badge, .tag, .suitability-pill, .atproto-pill, .atproto-meta-chip,
    .voice-hud-badge, .email-badge { --type-caption-size: 13px; }
  }
  /* Headings in Fraunces (the design system's display face); everything else in Atkinson. */
  h1, h2, .view-title, .settings-title { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
  :focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
/* Tidy icons (#326): line icons that take the text colour. They sit beside a word. */
.tidy-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ti { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex-shrink: 0; }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  /* Navigation (the page's header row went in #1151: the dock's top bar is the header). */
  button, input, select, textarea { font-family: inherit; }

  /* Desktop Nav Dropdown ("More") */
  .nav-dropdown {
    position: relative;
    display: inline-block;
  }
  .nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    user-select: none;
  }
  .nav-dropdown-caret {
    font-size: var(--type-caption-size);
    transition: transform 0.2s ease;
    opacity: 0.7;
  }
  .nav-dropdown.open .nav-dropdown-caret {
    transform: rotate(180deg);
  }
  .nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 2px);
    right: 0;
    min-width: 250px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 1000;
    animation: dropdownFadeIn 0.15s ease-out;
  }
  .nav-dropdown.open .nav-dropdown-menu {
    display: block;
  }
  @keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--text-body);
    text-decoration: none;
    box-sizing: border-box;
  }
  .nav-dropdown-item:hover {
    background: var(--surface-subtle);
    color: var(--primary);
  }
  .nav-dropdown-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
  }
  .nav-dropdown-icon {
    font-size: var(--type-body-lg-size);
    flex-shrink: 0;
    width: 24px;
    text-align: center;
  }
  .nav-dropdown-item-title {
    font-size: var(--type-body-sm-size);
    font-weight: 600;
    line-height: 1.2;
  }
  .nav-dropdown-item-sub {
    font-size: var(--type-caption-size);
    color: var(--text-muted);
    margin-top: 1px;
  }
  .nav-dropdown-divider {
    height: 1px;
    background: var(--surface-subtle);
    margin: 4px 6px;
  }
  .nav-dropdown-item.highlight-item {
    background: var(--primary-light);
    border: 1px solid var(--primary-light);
    margin-top: 4px;
  }
  .nav-dropdown-item.highlight-item:hover {
    background: var(--primary-light);
  }


  /* Main Tab Content Containers */
  .main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
  }
  .tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
  }
  .tab-content.active {
    display: flex;
    flex-direction: column;
  }

  /* Chat Tab Styles */
  #tab-chat {
    padding: 0;
  }
  #quick-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
  }
  /* Chip (#423): the design system's tidy-chip (design-system/components/bundle.css). A chip
     that turns on and off carries aria-pressed; the chosen one is tinted, edged in teal and has
     the bead, so its state never rests on colour alone. On a phone it is a full tap target. */
  .chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--touch-min);
    padding: 0 var(--space-4);
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border-control);
    background: transparent;
    color: var(--text-body);
    font-family: var(--font-sans);
    font-size: var(--type-body-size);
    line-height: 20px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
  }
  .chip:hover { background: var(--surface-subtle); }
  .chip[aria-pressed="true"], .chip.active { background: var(--primary-light); color: var(--text-main); border-color: var(--primary); }
  .chip[aria-pressed="true"]::before, .chip.active::before { content: ""; flex-shrink: 0; width: 10px; height: 10px; border-radius: var(--radius-full); background: var(--primary); }
  #log {
    flex: 1;
    overflow-y: auto;
    padding: 1.2rem;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
  }
  .msg { margin: 0.8rem 0; }
  .msg.user { text-align: right; }
  .bubble {
    display: inline-block;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    text-align: left;
    max-width: 85%;
    white-space: pre-wrap;
    line-height: 1.45;
  }
  .msg.user .bubble {
    background: var(--primary);
    color: var(--on-action);
    border: none;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: 4px;
  }
  .bubble.rich {
    background: transparent;
    border: none;
    padding: 0;
    max-width: 100%;
    white-space: normal;
    box-shadow: none;
  }
  #chat-form {
    display: flex;
    gap: 0.6rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
  }
  #chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: var(--type-body-size);
    outline: none;
  }
  #chat-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
  /* Button (#423): the design system's tidy-btn (design-system/components/bundle.css). The old
     names are aliases for now: .btn is tidy-btn--primary, .btn-secondary tidy-btn--quiet (edged
     in --border-control) and .btn-danger tidy-btn--danger. Every one is a pill at least 48px
     tall (touch-min); .btn-sm is only narrower, its label stays 16px. */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--touch-min);
    min-width: var(--touch-min);
    padding: 0 22px;
    border-radius: var(--radius-full);
    border: 1.5px solid transparent;
    background: var(--primary);
    color: var(--on-action);
    font-family: var(--font-sans);
    font-size: var(--type-body-size);
    line-height: 20px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
  }
  .btn:hover { background: var(--primary-dark); }
  .btn-secondary { background: transparent; color: var(--text-main); border-color: var(--border-control); }
  .btn-secondary:hover { background: var(--surface-subtle); }
  /* #560: the payout method picked on a "Pay (kid) $12" card */
  .btn-secondary[data-kb-method][aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
  .btn-success { background: var(--success); }
  .btn-success:hover { background: var(--primary-dark); }
  .btn-danger { background: var(--danger-ink); color: var(--on-danger); }
  .btn-danger:hover { background: var(--danger-ink); }
  .btn-sm { padding: 0 var(--space-4); font-size: var(--type-body-size); }

  /* A2UI Component Styles */
  .a2card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    background: var(--surface);
    max-width: 100%;
  }
  .a2card + .a2card, .a2col > .a2card { margin-top: 0.6rem; }
  .a2col { display: flex; flex-direction: column; gap: 0.4rem; }
  .a2row { display: flex; flex-direction: row; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
  .a2row.between { justify-content: space-between; }
  .a2text { margin: 0; line-height: 1.45; }
  .a2text.a2-h1 { font-size: var(--type-h2-size); font-weight: 700; color: var(--primary); }
  .a2text.a2-h2 { font-size: var(--type-h3-size); font-weight: 700; }
  .a2text.a2-h3 { font-size: var(--type-body-size); font-weight: 600; }
  .a2text.a2-h4 { font-size: var(--type-body-size); font-weight: 600; }
  .a2text.a2-caption { font-size: var(--type-body-sm-size); color: var(--text-muted); }
  .a2divider { border: none; border-top: 1px solid var(--border); margin: 0.5rem 0; width: 100%; }
  .a2img { max-width: 100%; border-radius: 8px; display: block; }
  .material-symbols-outlined { font-size: var(--type-h3-size); vertical-align: middle; }

  /* Admin & Grid Panels */
  .view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    gap: 0.8rem;
  }
  .view-title { font-size: var(--type-h3-size); font-weight: 700; margin: 0; }
  .view-desc { font-size: var(--type-body-sm-size); color: var(--text-muted); margin: 0.2rem 0 0 0; }
  .card-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    margin-bottom: 1.5rem;
  }
  .card-box h3 { margin-top: 0; font-size: var(--type-body-lg-size); border-bottom: 1px solid var(--border); padding-bottom: 0.6rem; }

  /* Tables */
  .table-responsive { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: var(--type-body-sm-size); }
  th, td { padding: 0.75rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); }
  th { background: var(--bg); font-weight: 600; color: var(--text-muted); }
  tr:hover { background: var(--bg); }

  /* Badges & Tags */
  .tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 12px;
    font-size: var(--type-caption-size);
    font-weight: 600;
  }
  .tag-room { background: var(--primary-light); color: var(--primary); }
  .tag-freq { background: var(--accent-light); color: var(--accent-dark); }
  .tag-points { background: var(--primary-light); color: var(--primary); font-weight: 700; }
  .tag-complexity { background: var(--danger-light); color: var(--danger-ink); }
  .tag-pending { background: var(--accent-light); color: var(--accent-dark); }
  .tag-completed { background: var(--primary-light); color: var(--primary); }
  .tag-kid { background: var(--surface-subtle); color: var(--text-main); font-weight: 600; }

  /* Kids Profile Cards */
  .kids-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.2rem;
  }
  .kid-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
  }
  .kid-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.8rem;
  }
  .kid-avatar {
    width: 52px;
    height: 52px;
    overflow: hidden;
  }
  /* A person's initials in a round badge, where an avatar used to sit (#326). It stands beside
     the name, so screen readers skip it (aria-hidden). A kid's allowed Google photo sits inside. */
  .tidy-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: var(--type-body-size);
    letter-spacing: 0.02em;
    line-height: 1;
  }
  .chef-btn.active .tidy-initials {
    background: var(--surface);
  }
  .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.6rem;
  }
  .form-group label {
    font-size: var(--type-caption-size);
    font-weight: 600;
    color: var(--text-muted);
  }
  .form-control {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: var(--type-body-sm-size);
    background: var(--surface);
  }
  /* When a chore is due (#445): a toggle per weekday. */
  .day-pick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.35rem; }
  .day-pick button {
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-main);
    font: inherit;
    font-size: var(--type-caption-size);
    font-weight: 600;
    cursor: pointer;
  }
  .day-pick button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
  .day-pick button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
  /* Who shares a chore (#445): a toggle per person. */
  .people-pick { display: flex; flex-wrap: wrap; gap: 0.35rem; }
  .people-pick button {
    min-height: 44px;
    padding: 0 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-main);
    font: inherit;
    font-size: var(--type-body-sm-size);
    font-weight: 600;
    cursor: pointer;
  }
  .people-pick button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-action); }
  .people-pick button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
  .chore-parts { font-size: var(--type-caption-size); color: var(--text-muted); margin-top: 0.25rem; }
  .form-hint { font-size: var(--type-caption-size); color: var(--text-muted); margin-top: 0.35rem; }
  .together-pick { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.5rem; font-size: var(--type-body-sm-size); }
  .together-pick label { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: normal; }
  .form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
  .form-group[hidden] { display: none; }
  #chores-table td:first-child { min-width: 14rem; }
  /* Edit and Delete stay on screen when the catalog is wider than a laptop: the
     Actions column sticks to the right edge while the rest scrolls (#996). */
  #chores-table th:last-child, #chores-table td:last-child:not([colspan]) {
    position: sticky; right: 0; z-index: 1;
    background: var(--surface); border-left: 1px solid var(--border);
  }
  #chores-table th:last-child { background: var(--bg); }
  #chores-table tr:hover td:last-child { background: var(--bg); }
  .chore-when { font-size: var(--type-caption-size); color: var(--text-muted); margin-top: 0.3rem; min-width: 8rem; }
  /* A long description: two lines, and a button to read the rest (#445). */
  .chore-desc { font-size: var(--type-caption-size); color: var(--text-muted); white-space: pre-line; overflow-wrap: anywhere; }
  .chore-desc.clamped { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .chore-desc-toggle { border: none; background: none; padding: 0; color: var(--primary); font: inherit;
                       font-size: var(--type-caption-size); font-weight: 600; cursor: pointer; }
  .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--type-body-sm-size);
    cursor: pointer;
    padding: 0.25rem 0;
  }

  /* Chore Swap Board */
  .board-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.2rem;
  }
  .board-col {
    background: var(--bg);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
  }
  .board-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--border);
  }
  .chore-item-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.1s, box-shadow 0.1s;
  }

  /* Dialogs: the design system's Dialog (#654), on TidyFamily's own class names. Centred
     from 640px; below 640px every one is a bottom sheet. Focus, Escape and the page behind
     are handled for all of them by the dialog script at the end of the page. */
  .modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--scrim);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  .modal-backdrop.show { display: flex; }
  .modal-box {
    background: var(--surface);
    color: var(--text-body);
    border-radius: var(--radius-lg);
    max-width: 540px;
    width: 100%;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
    --modal-pad-bottom: 24px;
    padding-bottom: var(--modal-pad-bottom);
  }
  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  /* A long dialog's Save and Cancel stay in reach on a short laptop screen or a phone:
     the bar sticks to the bottom of the dialog while the form scrolls under it (#996). It
     covers the dialog's bottom padding too, so nothing shows scrolling past below it (#1286). */
  .modal-actions {
    position: sticky;
    bottom: calc(-1 * var(--modal-pad-bottom, 24px));
    z-index: 1;
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin: 1rem -24px calc(-1 * var(--modal-pad-bottom, 24px));
    padding: 12px 24px calc(12px + var(--modal-pad-bottom, 24px));
    background: var(--surface);
    border-top: 1px solid var(--border);
  }
  .modal-title { font-size: var(--type-h3-size); line-height: 26px; font-weight: 700; margin: 0; color: var(--text-main); }
  /* Every dialog's close button: the Tidy close icon, named "Close" for screen readers, 48px to tap. */
  .close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    margin: -11px -12px -11px 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    font-size: var(--type-body-lg-size);
    cursor: pointer;
    color: var(--text-muted);
    transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1), color 150ms cubic-bezier(0.4, 0, 0.2, 1);
  }
  .close-btn:hover { background: var(--surface-subtle); color: var(--text-main); }
  @keyframes tidy-sheet-in { from { transform: translateY(32px); opacity: 0; } to { transform: none; opacity: 1; } }
  @media (max-width: 639px) {
    .modal-backdrop { align-items: flex-end; padding: 0; }
    /* !important: many dialogs still carry an inline max-width (#427), and a phone's sheet is full width. */
    .modal-box {
      max-width: none !important;
      max-height: 92vh !important;
      margin: 0 !important;
      --modal-pad-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
      padding: 20px 20px var(--modal-pad-bottom);
      border-radius: var(--radius-lg) var(--radius-lg) 0 0;
      box-shadow: var(--shadow-md);
      animation: tidy-sheet-in 250ms cubic-bezier(0.4, 0, 0.2, 1);
    }
    .modal-actions { margin: 1rem -20px calc(-1 * var(--modal-pad-bottom)); padding: 12px 20px calc(12px + var(--modal-pad-bottom)); }
  }
  @media (prefers-reduced-motion: reduce) {
    .modal-box { animation: none; }
    .close-btn { transition: none; }
  }

  /* Alert / Toast Notification */
  #toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--field);
    color: var(--on-action);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: var(--type-body-sm-size);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2000;
  }
  /* Calendar View Styles */
  .calendar-kids-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.2rem;
  }
  .kid-gmail-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    flex: 1;
    min-width: 220px;
  }
  .kid-gmail-chip .avatar {
    width: 44px;
    height: 44px;
    font-size: var(--type-body-size);
  }
  .kid-gmail-chip .info {
    flex: 1;
    line-height: 1.3;
  }
  .kid-gmail-chip .email-badge {
    font-size: var(--type-caption-size);
    color: var(--primary);
    font-weight: 600;
  }
  .calendar-week-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(180px, 1fr));
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 1rem;
  }
  .cal-day-col {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    min-height: 520px;
  }
  .cal-day-header {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 700;
    font-size: var(--type-body-size);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    border-radius: 10px 10px 0 0;
  }
  .cal-slot-section {
    padding: 0.6rem;
    border-bottom: 1px dashed var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
  }
  .cal-slot-section:last-child {
    border-bottom: none;
  }
  .cal-slot-label {
    font-size: var(--type-caption-size);
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
  }
  .cal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem;
    font-size: var(--type-caption-size);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: transform 0.1s, box-shadow 0.1s;
  }
  .cal-card-title {
    font-weight: 700;
    font-size: var(--type-body-sm-size);
    color: var(--text-main);
  }
  .cal-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--type-caption-size);
    color: var(--text-muted);
  }
  .notify-btn {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    font-size: var(--type-caption-size);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.15s;
    width: 100%;
    justify-content: center;
    margin-top: 0.25rem;
  }
  .notify-btn:hover {
    background: var(--primary);
    color: var(--on-action);
  }
  .cal-event-card {
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    font-size: var(--type-caption-size);
    color: var(--text-main);
  }

  /* Cooking & Recipe Hub Styles */
  .chef-selector-bar {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
  }
  .chef-btn {
    flex: 1;
    min-width: 220px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.2s ease;
  }
  .chef-btn:hover {
    border-color: var(--primary);
  }
  .chef-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(15,118,110,0.25);
  }
  .recipe-filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
    align-items: center;
  }
  .recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.2rem;
  }
  .recipe-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    cursor: pointer;
  }
  .recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
  }
  .recipe-title {
    font-size: var(--type-body-size);
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
  }
  .suitability-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 20px;
    font-size: var(--type-caption-size);
    font-weight: 700;
    margin-bottom: 0.8rem;
  }
  .suitability-pill.perfect {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-light);
  }
  .suitability-pill.supervision {
    background: var(--accent-light);
    color: var(--accent-dark);
    border: 1px solid var(--accent-light);
  }
  .suitability-pill.locked {
    background: var(--danger-light);
    color: var(--danger-ink);
    border: 1px solid var(--danger-light);
  }
  .recipe-meta-row {
    display: flex;
    gap: 0.8rem;
    font-size: var(--type-caption-size);
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
  }
  .ingredient-checklist {
    background: var(--bg);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    margin: 0.8rem 0;
  }
  .ingredient-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
    font-size: var(--type-body-sm-size);
  }
  .ingredient-item:last-child {
    border-bottom: none;
  }

  /* Weekly Menu & Shopping List Styles */
  .menu-week-nav { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0 0 0.8rem; }
  .menu-week-nav[hidden], .menu-week-alerts[hidden], .menu-week-note[hidden], .menu-grid[hidden], .menu-week-nav [hidden] { display: none; }
  .menu-week-label { flex: 1 1 10rem; text-align: center; font-weight: 700; color: var(--text-main); }
  .menu-week-alerts { list-style: none; margin: 0 0 0.8rem; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
  .menu-week-alert { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.5rem 0.7rem; border-radius: 6px; background: var(--accent-light); color: var(--accent-dark); font-size: var(--type-body-sm-size); }
  .menu-week-alert-day { font-weight: 700; }
  .menu-week-note { margin: 0 0 0.8rem; color: var(--text-muted); font-size: var(--type-body-sm-size); }
  .menu-day-alert { margin-top: 6px; padding: 4px 6px; border-radius: 6px; background: var(--accent-light); color: var(--accent-dark); font-size: var(--type-caption-size); }
  .menu-day-date { font-size: var(--type-caption-size); color: var(--text-muted); }
  .menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.8rem;
  }
  .menu-day-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  /* #1283: the day on a line of its own, then its date and servings, so they never collide. */
  .menu-day-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 6px;
    row-gap: 2px;
    margin-bottom: 0.5rem;
  }
  .menu-day-name {
    flex: 1 0 100%;
    font-weight: 700;
    font-size: var(--type-body-sm-size);
    color: var(--text-main);
  }
  .menu-day-servings { font-size: var(--type-caption-size); color: var(--text-muted); }
  .menu-day-date + .menu-day-servings::before { content: "\00B7"; margin-right: 6px; }
  .menu-day-icon {
    font-size: var(--type-h2-size);
    text-align: center;
    margin: 0.4rem 0;
  }
  .menu-day-title {
    font-weight: 600;
    font-size: var(--type-body-sm-size);
    color: var(--text-main);
    line-height: 1.25;
    margin-bottom: 0.4rem;
    min-height: 2.5em;
  }
  .menu-day-chef {
    font-size: var(--type-caption-size);
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    background: var(--surface-subtle);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
  }
  .shopping-dept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
  }
  .shopping-dept-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
  }
  .shopping-dept-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.6rem;
    margin-bottom: 0.8rem;
  }
  .shopping-dept-title {
    font-size: var(--type-body-size);
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }
  .shopping-item-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .shopping-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    background: var(--bg);
    transition: background 0.15s;
  }
  .shopping-item-row:hover {
    background: var(--surface-subtle);
  }
  .shopping-item-row.checked {
    background: var(--primary-light);
    opacity: 0.75;
  }
  .shopping-item-row.checked .shopping-item-name {
    text-decoration: line-through;
    color: var(--text-muted);
  }
  .shopping-item-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
  }
  .shopping-item-left input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--primary);
  }
  .shopping-item-name {
    font-size: var(--type-body-sm-size);
    font-weight: 600;
    color: var(--text-main);
  }
  .shopping-item-amt {
    font-size: var(--type-caption-size);
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
    margin-left: 0.4rem;
  }
  .shopping-item-recipes {
    font-size: var(--type-caption-size);
    color: var(--text-muted);
    display: block;
    margin-top: 0.15rem;
  }
  .shopping-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: var(--type-body-sm-size);
    transition: color 0.15s;
  }
  .shopping-delete-btn:hover {
    color: var(--danger-ink);
    background: var(--danger-light);
  }

  /* The kid editor (#312): one section per kind of setting. */
  .kid-editor-section {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 0 0 0.8rem 0;
    padding: 0.8rem 0 0 0;
    min-width: 0;
  }
  .kid-editor-section legend {
    padding: 0 0.4rem 0 0;
    font-size: var(--type-body-sm-size);
    font-weight: 700;
    color: var(--text-main);
  }
  .kid-editor-subhead {
    margin: 0.4rem 0 0.2rem 0;
    font-size: var(--type-caption-size);
    font-weight: 700;
    color: var(--text-body);
  }
  .kid-editor-checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 2px 10px; }
  .kid-editor-note {
    display: block;
    margin: 3px 0 0 0;
    font-size: var(--type-caption-size);
    color: var(--text-muted);
  }
  .kid-editor-note[hidden] { display: none; }
  #kid-pin-remove[hidden] { display: none; }  /* .btn's inline-flex would show it */
  #modal-meal-queue-btn[hidden] { display: none; }  /* a later week's night has no queue (#919) */
  #menu-day-modal .modal-actions [hidden] { display: none; }  /* .btn's inline-flex would show Start cooking on a night with no recipe (#1560) */
  /* WP-36c: the consent a parent gives to Tidy keeping someone's allergies */
  .allergy-consent {
    margin-top: 0.5rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: var(--accent-light);
  }
  .allergy-consent-note {
    margin: 0 0 0.35rem 0;
    font-size: var(--type-caption-size);
    color: var(--text-body);
    line-height: 1.35;
  }
  .allergy-consent .checkbox-label {
    align-items: flex-start;
    font-size: var(--type-caption-size);
    color: var(--text-main);
    line-height: 1.35;
  }
  .health-score-ring {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) var(--health-pct, 80%), var(--border) 0);
    position: relative;
  }
  .health-score-inner {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--type-caption-size);
    font-weight: 800;
    color: var(--text-main);
  }

  /* Gemini Verbal Interface Styles */
  .gemini-voice-hud {
    background: var(--field);
    border: 1.5px solid rgba(15,118,110, 0.5);
    border-radius: 14px;
    padding: 14px 18px;
  }
  .gemini-orb-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
  }
  .gemini-voice-orb {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--type-h3-size);
    cursor: pointer;
    animation: dtOrbGlow 2.5s infinite ease-in-out;
    transition: all 0.25s ease;
  }
  .gemini-voice-orb.speaking {
    animation: dtOrbSpeak 0.8s infinite alternate;
    background: var(--primary);
  }
  .gemini-voice-orb.muted {
    background: var(--text-body);
    box-shadow: none;
    animation: none;
    opacity: 0.6;
  }
  @keyframes dtOrbGlow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
  }
  @keyframes dtOrbSpeak {
    0% { transform: scale(0.96); }
    100% { transform: scale(1.1); }
  }
  .gemini-waveform {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 14px;
    margin-top: 4px;
    justify-content: center;
  }
  .sound-bar {
    width: 3px;
    background: var(--primary);
    border-radius: 2px;
    height: 4px;
    transition: height 0.15s ease;
  }
  .gemini-waveform.active .bar-1 { animation: dtWave 0.6s infinite ease-in-out alternate; }
  .gemini-waveform.active .bar-2 { animation: dtWave 0.5s infinite ease-in-out 0.15s alternate; }
  .gemini-waveform.active .bar-3 { animation: dtWave 0.7s infinite ease-in-out 0.3s alternate; }
  .gemini-waveform.active .bar-4 { animation: dtWave 0.55s infinite ease-in-out 0.45s alternate; }
  @keyframes dtWave {
    0% { height: 3px; background: var(--primary); }
    100% { height: 14px; background: var(--primary); }
  }
  .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-block;
  }
  .live-dot.pulse {
    animation: dtDotPulse 1.5s infinite;
  }
  @keyframes dtDotPulse {
    0% { transform: scale(0.95); }
    70% { transform: scale(1); }
    100% { transform: scale(0.95); }
  }
  .live-dot.paused {
    background: var(--accent);
    animation: none;
  }
  .voice-ctrl-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: var(--type-caption-size);
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s;
  }
  .voice-ctrl-btn:hover { background: rgba(255, 255, 255, 0.2); }
  .voice-ctrl-btn.active {
    background: rgba(15,118,110, 0.35);
    border-color: var(--primary);
    color: var(--primary);
  }
  .voice-chips-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    align-items: center;
    padding-bottom: 2px;
  }
  .voice-chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 4px 11px;
    font-size: var(--type-caption-size);
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s ease;
  }
  .voice-chip:hover {
    background: rgba(15,118,110, 0.35);
    border-color: var(--primary);
    color: var(--on-action);
  }

  /* =============================================================
     MOBILE RESPONSIVE SYSTEM & BOTTOM NAVIGATION (<= 768px)
     ============================================================= */

  @media (max-width: 768px) {
    body {
      height: 100vh;
      height: 100dvh;
      overflow: hidden;
    }

    .desktop-only-badge {
      display: none !important;
    }
    .hide-mobile-text {
      display: none !important;
    }



    /* Tab Content (the dock's place bar keeps its own room on <body>) */
    .tab-content {
      padding: 0.85rem 0.75rem 1rem 0.75rem !important;
    }
    #tab-chat.tab-content {
      padding: 0 !important;
    }

    /* Chat Tab on Mobile */
    #quick-actions {
      padding: 0.45rem 0.75rem !important;
      gap: 0.4rem !important;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
    }
    #quick-actions::-webkit-scrollbar {
      display: none;
    }
    #log {
      padding: 0.75rem 0.75rem 10px 0.75rem !important;
    }
    .bubble {
      max-width: 90% !important;
      font-size: var(--type-body-sm-size) !important;
      padding: 0.65rem 0.85rem !important;
    }
    #chat-form {
      padding: 8px 10px !important;
      background: var(--surface);
      border-top: 1px solid var(--border);
      gap: 6px !important;
    }
    #chat-input {
      font-size: var(--type-body-sm-size) !important;
      padding: 0.55rem 0.75rem !important;
      border-radius: 20px !important;
    }

    /* Admin Management Tab on Mobile */
    .view-header {
      flex-direction: column !important;
      align-items: flex-start !important;
      gap: 0.6rem !important;
    }
    .view-header > div:last-child:not(:first-child) {
      width: 100%;
      display: flex;
      gap: 0.5rem;
    }
    .view-header > div:last-child:not(:first-child) .btn {
      flex: 1;
      text-align: center;
      justify-content: center;
    }
    .settings-dials {
      grid-template-columns: 1fr !important;
    }
    .dial-card {
      padding: 1rem !important;
    }
    .dial-option-item {
      padding: 10px 12px !important;
      min-height: 46px !important;
    }

    /* Chore Board on Mobile */
    .board-columns {
      grid-template-columns: 1fr !important;
      gap: 0.9rem !important;
    }
    .board-col {
      padding: 0.85rem !important;
    }

    /* Weekly Menu on Mobile */
    .menu-grid, .menu-calendar-grid, #menu-days-grid, #weekly-days-grid {
      grid-template-columns: 1fr !important;
      gap: 0.8rem !important;
    }
    /* The menu's days (#909): one row that scrolls sideways, a day to a swipe. */
    .menu-grid.menu-days {
      grid-template-columns: none !important;
      grid-auto-flow: column;
      grid-auto-columns: minmax(14rem, 82%);
      overflow-x: auto;
      scroll-snap-type: x mandatory;
      overscroll-behavior-x: contain;
      padding-bottom: 0.4rem;
    }
    .menu-grid.menu-days > * { scroll-snap-align: start; }
    #cultural-passport-banner > div:last-child {
      grid-template-columns: 1fr !important;
      gap: 0.8rem !important;
    }





    /* Dismissible Compact Mobile Pill */
  }

/* Launch scope (Founding 100): calendar/email features aren't offered yet, so their tabs,
   drawer items and shortcuts are hidden. switchTab() also refuses these tabs. The kid budget
   (#84) shows only to a parent whose household's plan has it (html.kid-budget-on, set by
   probeKidBudget once the server says so). The kitchen (cooking, weekly menu, shopping list,
   recipe book) and the kids' profiles are part of TidyFamily and TidyKid, so they show. */
[data-tab="tab-calendar"], html:not(.kid-budget-on) [data-tab="tab-budget"],
.launch-hidden { display: none !important; }
/* Sample-data affordances (they use the demo kids and sample photos) show on the demo household only. */
html:not(.demo-household) .demo-only { display: none !important; }
/* The app waits for the dock (TidyAuth): signed in, or in the demo a visitor asked for.
   Until then (and signed out) only the dock and its sign-in screen (#tidy-gate) show. */
html:not([data-tidy-auth="signed_in"]):not([data-tidy-auth="demo"]) body > :not(#tidy-verse-dock):not(#tidy-verse-footer):not(#tidy-gate):not(#dock-toast):not(.dock-modal-backdrop):not(.tdbg):not(script):not(style) { display: none !important; }

/* Weekly menu and shopping list: open nights, who picked, and allergy flags */
.menu-day-card.open-night { background: var(--bg); border-style: dashed; }
.menu-day-card.open-night .menu-day-title { color: var(--text-muted); font-weight: 600; }
.menu-day-picked { font-size: var(--type-caption-size); color: var(--text-muted); margin-bottom: 0.4rem; }
.menu-day-actions { display: flex; justify-content: space-between; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 0.5rem; padding-top: 0.4rem; border-top: 1px solid var(--border); }
.menu-day-actions .btn { padding: 0 var(--space-4); }
/* #1283: a planned night is one tap target. Its dish is a button whose ::after covers the
   card, so the whole card opens the night's sheet; the cook-night choice and the meal
   requests sit above it and keep their own clicks. */
.menu-day-open { display: block; width: 100%; padding: 0; margin: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.menu-day-open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.menu-day-open .menu-day-icon { text-align: left; font-size: var(--type-h3-size); margin: 0 0 0.3rem; }
.menu-day-open > span { display: block; }
.menu-day-open .menu-day-title { min-height: 0; }
.recipe-card.is-picked { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 2px; }
.menu-day-card.is-planned:hover { border-color: var(--border-control); }
@supports selector(:has(*)) {
  .menu-day-open:focus-visible { outline: none; }
  .menu-day-card:has(.menu-day-open:focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
}
.menu-day-card .menu-day-cook-mode, .menu-day-card .menu-day-queue, .menu-day-card .menu-day-actions { position: relative; z-index: 1; }
.menu-day-actions .btn-sm { padding: 0 var(--space-4); }
/* The night's sheet (#1283): what's planned, its recipe, and Start cooking, Change and Clear. */
.menu-day-sheet-dish { font-size: var(--type-body-lg-size); font-weight: 700; color: var(--text-main); margin: 0 0 0.25rem; }
.menu-day-sheet-meta { font-size: var(--type-body-sm-size); color: var(--text-muted); margin: 0 0 1rem; }
.menu-day-sheet h4 { font-size: var(--type-body-size); font-weight: 700; color: var(--text-main); margin: 1rem 0 0.5rem; }
.menu-day-sheet ol { margin: 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; font-size: var(--type-body-sm-size); color: var(--text-body); }
.menu-day-sheet-none { font-size: var(--type-body-sm-size); color: var(--text-muted); }
.menu-day-sheet .modal-actions { flex-wrap: wrap; }
/* The shopping header (#1283): every button on a laptop, a little smaller; on a phone,
   Generate and Add custom item, with the rest under More. */
.shop-actions { position: relative; align-items: center; }
.shop-more { display: contents; }
.shop-more-toggle { display: none; }
@media (min-width: 640px) {
  .shop-actions .btn { padding: 0 var(--space-4); }
}
@media (max-width: 639px) {
  #tab-shopping .view-header > div.shop-actions { flex-wrap: wrap; }
  #tab-shopping .view-header > div.shop-actions > .btn:first-child { flex: 1 1 100%; }
  #tab-shopping .view-header > div.shop-actions > .btn { padding: 0 var(--space-4); }
  #tab-shopping .view-header > div.shop-actions > .shop-more-toggle { flex: 0 0 auto; min-width: 6.5rem; }
  .menu-day-sheet .modal-actions .btn { padding: 0 var(--space-4); }
  .shop-more-toggle:not([hidden]) { display: inline-flex; }
  /* This week on a phone: no More and no Refresh; the week reloads each time it's opened. */
  #tab-shopping[data-section="week"] .shop-more-toggle { display: none; }
  .shop-more { display: none; }
  .shop-more.open {
    display: flex; flex-direction: column; gap: 4px;
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
    min-width: 15rem; padding: 6px;
    background: var(--surface); border: 1px solid var(--border-control); border-radius: var(--radius-sm);
  }
  #tab-shopping .view-header > div.shop-actions .shop-more .btn { flex: none; width: 100%; justify-content: flex-start; border-color: transparent; }
  .shop-more .list-email:not([hidden]) { display: flex; }
}
.list-email-choices { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.list-email-choices label { display: flex; align-items: center; gap: 10px; min-height: var(--touch-min); padding: 0 8px; border-radius: var(--radius-sm); font-size: var(--type-body-size); color: var(--text-body); cursor: pointer; }
.list-email-choices label:hover { background: var(--surface-subtle); }
.list-email-choices input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.shopping-item-meta { font-size: var(--type-caption-size); color: var(--text-muted); display: block; margin-top: 0.15rem; }
.shopping-item-allergy { font-size: var(--type-caption-size); color: var(--danger-ink); background: var(--danger-light); border: 1px solid var(--danger-light); border-radius: 6px; padding: 1px 6px; display: inline-block; margin-top: 0.2rem; font-weight: 700; }
.meal-idea-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.3rem; }
.meal-tidychef { margin: -0.3rem 0 1rem; font-size: var(--type-body-size); color: var(--text-body); }
.meal-tidychef[hidden] { display: none; }
.meal-tidychef a, .cockpit-stream__body a { color: var(--primary); font-weight: 700; }
.meal-idea { text-align: left; background: var(--primary-light); border: 1px solid var(--primary-light); border-radius: var(--radius-sm); padding: 0.45rem 0.6rem; cursor: pointer; font-size: var(--type-caption-size); color: var(--text-main); }
.meal-idea:hover, .meal-idea.selected { border-color: var(--primary); }
.meal-idea-reasons { font-size: var(--type-caption-size); color: var(--text-muted); margin-top: 2px; }

/* Floating Voice Orb & HUD Styles */
#tidy-voice-orb {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  color: var(--on-action);
  font-size: var(--type-h2-size);
  border: 3px solid rgba(255, 255, 255, 0.9);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.3s ease;
  user-select: none;
}
#tidy-voice-orb:hover {
  transform: scale(1.08);
}
#tidy-voice-orb:active {
  transform: scale(0.95);
}
#tidy-voice-orb.listening {
  background: var(--danger);
  animation: orbPulse 1.4s infinite;
}
#tidy-voice-orb.processing {
  background: var(--primary);
  animation: orbSpinPulse 1.2s infinite ease-in-out;
}
#tidy-voice-orb.speaking {
  background: var(--primary);
}
@keyframes orbPulse {
  0% { transform: scale(0.98); }
  70% { transform: scale(1.08); }
  100% { transform: scale(0.98); }
}
@keyframes orbSpinPulse {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.05) rotate(180deg); }
  100% { transform: scale(1) rotate(360deg); }
}

#tidy-voice-hud {
  position: fixed;
  bottom: 96px;
  right: 28px;
  width: 380px;
  max-width: calc(100vw - 40px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 9998;
  font-size: var(--type-body-sm-size);
  line-height: 1.35;
  animation: hudFadeUp 0.2s ease-out;
}
#tidy-voice-hud.visible {
  display: flex;
}
@keyframes hudFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.voice-hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}
.voice-hud-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  animation: indicatorBlink 1s infinite alternate;
}
@keyframes indicatorBlink {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}
.voice-hud-status {
  font-size: var(--type-caption-size);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--primary);
  flex: 1;
}
.voice-hud-text {
  color: var(--text-main);
  font-weight: 500;
  font-size: var(--type-body-sm-size);
  line-height: 1.4;
  word-break: break-word;
}
.voice-hud-feedback {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: var(--type-caption-size);
}
.voice-hud-feedback-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.voice-hud-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--type-caption-size);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.voice-hud-badge.is-note {
  background: rgba(14, 165, 233, 0.15);
  color: #0284c7;
}
.voice-hud-badge.is-action {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary-dark);
}
.voice-hud-badge.is-query {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}
.voice-hud-view-btn {
  background: var(--primary);
  color: var(--on-action);
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: var(--type-caption-size);
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: opacity 0.15s ease;
}
.voice-hud-view-btn:hover {
  opacity: 0.9;
}
.voice-hud-hint {
  font-size: var(--type-caption-size);
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 2px;
}
.voice-hud-chips {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.voice-hud-chips-label {
  font-size: var(--type-caption-size);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.voice-chips-scroll {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.voice-keyword-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: var(--type-caption-size);
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.voice-keyword-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--surface);
}
@keyframes cockpitPulse {
  0% { box-shadow: 0 0 0 0px rgba(15, 118, 110, 0.6); }
  50% { box-shadow: 0 0 0 10px rgba(15, 118, 110, 0); }
  100% { box-shadow: 0 0 0 0px rgba(15, 118, 110, 0); }
}
.cockpit-highlight-pulse {
  animation: cockpitPulse 1.8s ease-out;
  border-color: var(--primary) !important;
}
.voice-hud-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--type-body-size);
  padding: 2px 4px;
  line-height: 1;
}
.voice-hud-close:hover {
  color: var(--text-body);
}

@media (max-width: 768px) {
  #tidy-voice-orb {
    bottom: 80px;
    right: 18px;
    width: 52px;
    height: 52px;
    font-size: var(--type-h2-size);
  }
  #tidy-voice-hud {
    bottom: 140px;
    right: 16px;
    left: 16px;
    max-width: calc(100% - 32px);
  }
}

