  :root {
    --bg: #f5f6fa; --card: #fff; --ink: #1d2433; --muted: #6b7385; --line: #e3e6ee;
    --primary: #3949ab; --primary-hover: #303f9f;
    --sleep: #3949ab; --night-sleep: #283593; --nap: #0284c7;
    --breast: #e8789a; --bottle: #f0a53a; --formula: #3bb08f; --danger: #d9534f;
    --diaper: #20b2aa; --awake: #f59e0b; --target: #10b981;
    --growth: #059669; --med: #8b5cf6; --temp: #f97316; --tummy: #06b6d4;
    --summary-bg: #f8fafc;
    --row-hover: rgba(57, 73, 171, 0.04);
    --row-divider: rgba(0, 0, 0, 0.06);
    --chip-feeds-bg: rgba(232, 120, 154, 0.10);
    --chip-feeds-border: rgba(232, 120, 154, 0.28);
    --chip-feeds-accent: #be185d;
    --chip-sleep-bg: rgba(57, 73, 171, 0.08);
    --chip-sleep-border: rgba(57, 73, 171, 0.25);
    --chip-sleep-accent: #3949ab;
    --chip-awake-bg: rgba(245, 158, 11, 0.10);
    --chip-awake-border: rgba(245, 158, 11, 0.28);
    --chip-awake-accent: #d97706;
    --chip-diapers-bg: rgba(32, 178, 170, 0.10);
    --chip-diapers-border: rgba(32, 178, 170, 0.28);
    --chip-diapers-accent: #0d9488;
    --dialog-backdrop: rgba(15, 23, 42, 0.58);
  }
  :root.dark {
    --bg: #11151f; --card: #1b2130; --ink: #e8ebf3; --muted: #8b93a7; --line: #2a3144;
    --primary: #4f46e5; --primary-hover: #4338ca;
    --night-sleep: #3949ab; --sleep: #4f46e5; --nap: #38bdf8;
    --awake: #fbbf24;
    --growth: #34d399; --med: #a78bfa; --temp: #fb923c; --tummy: #22d3ee;
    --summary-bg: #151a26;
    --danger: #f87171;
    --row-hover: rgba(255, 255, 255, 0.04);
    --row-divider: rgba(255, 255, 255, 0.07);
    --chip-feeds-bg: rgba(232, 120, 154, 0.16);
    --chip-feeds-border: rgba(232, 120, 154, 0.35);
    --chip-feeds-accent: #f472b6;
    --chip-sleep-bg: rgba(79, 70, 229, 0.18);
    --chip-sleep-border: rgba(79, 70, 229, 0.38);
    --chip-sleep-accent: #818cf8;
    --chip-awake-bg: rgba(251, 191, 36, 0.16);
    --chip-awake-border: rgba(251, 191, 36, 0.35);
    --chip-awake-accent: #fbbf24;
    --chip-diapers-bg: rgba(32, 178, 170, 0.16);
    --chip-diapers-border: rgba(32, 178, 170, 0.35);
    --chip-diapers-accent: #2dd4bf;
    --dialog-backdrop: rgba(0, 0, 0, 0.75);
  }
  @media (prefers-color-scheme: dark) {
    :root:not(.light) {
      --bg: #11151f; --card: #1b2130; --ink: #e8ebf3; --muted: #8b93a7; --line: #2a3144;
      --primary: #4f46e5; --primary-hover: #4338ca;
      --night-sleep: #3949ab; --sleep: #4f46e5; --nap: #38bdf8;
      --awake: #fbbf24;
      --growth: #34d399; --med: #a78bfa; --temp: #fb923c; --tummy: #22d3ee;
      --summary-bg: #151a26;
      --danger: #f87171;
      --row-hover: rgba(255, 255, 255, 0.04);
      --row-divider: rgba(255, 255, 255, 0.07);
      --chip-feeds-bg: rgba(232, 120, 154, 0.16);
      --chip-feeds-border: rgba(232, 120, 154, 0.35);
      --chip-feeds-accent: #f472b6;
      --chip-sleep-bg: rgba(79, 70, 229, 0.18);
      --chip-sleep-border: rgba(79, 70, 229, 0.38);
      --chip-sleep-accent: #818cf8;
      --chip-awake-bg: rgba(251, 191, 36, 0.16);
      --chip-awake-border: rgba(251, 191, 36, 0.35);
      --chip-awake-accent: #fbbf24;
      --chip-diapers-bg: rgba(32, 178, 170, 0.16);
      --chip-diapers-border: rgba(32, 178, 170, 0.35);
      --chip-diapers-accent: #2dd4bf;
      --dialog-backdrop: rgba(0, 0, 0, 0.75);
    }
  }
  * { box-sizing: border-box; }
  html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.4 system-ui, -apple-system, sans-serif;
    padding-top: 0;
    padding-bottom: 80px;
    min-height: 100vh;
    overflow-x: hidden;
  }
  main { max-width: 640px; margin: 0 auto; padding: 12px 16px; }
  h1 { font-size: 20px; margin: 8px 0 12px; }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  h2 { font-size: 15px; margin: 20px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
  .card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
  .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  button, input, select, textarea, a, [role="button"], summary {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  button {
    font: inherit;
    border: 0;
    border-radius: 14px;
    padding: 14px;
    background: var(--sleep);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.08s cubic-bezier(0.2, 0.9, 0.4, 1), filter 0.15s ease, box-shadow 0.15s ease;
  }
  button:active, [role="button"]:active {
    transform: scale(0.96);
  }
  .grid button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    min-height: 72px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.08s cubic-bezier(0.2, 0.9, 0.4, 1), filter 0.15s ease, box-shadow 0.15s ease;
  }
  .grid button:hover {
    filter: brightness(1.04);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  }
  .grid button:active {
    transform: scale(0.96);
  }
  .btn-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.28);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.20);
    border: 1.5px solid rgba(255, 255, 255, 0.45);
  }
  .btn-icon img {
    width: 128%;
    height: 128%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
  }
  .btn-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    line-height: 1.22;
    min-width: 0;
  }
  .btn-title {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.01em;
    line-height: 1.15;
  }
  .btn-active-details {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
  }
  .btn-timer {
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.01em;
  }
  .btn-stop-badge {
    font-size: 11.5px;
    font-weight: 700;
    background: #ef4444;
    color: #fff;
    padding: 2.5px 8px;
    border-radius: 999px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: transform 0.1s ease, background 0.15s ease;
  }
  .btn-stop-badge:active {
    transform: scale(0.94);
  }
  .sec-chip-active-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
    width: 100%;
  }
  .sec-chip-timer {
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: inherit;
    line-height: 1.1;
  }
  .sec-chip-stop {
    font-size: 10px;
    font-weight: 700;
    background: #ef4444;
    color: #fff;
    padding: 1.5px 6px;
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    line-height: 1.1;
    margin-top: 1px;
    transition: transform 0.1s ease;
  }
  .sec-chip-stop:active {
    transform: scale(0.92);
  }
  .btn-hint {
    display: none;
  }
  #btnManual {
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 14px;
  }
  .secondary-activities-bar {
    grid-column: span 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 4px;
    min-width: 0;
  }
  .sec-more-drawer {
    grid-column: span 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 4px;
    min-width: 0;
    animation: fadeInDrawer 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .sec-more-drawer.hidden {
    display: none !important;
  }
  @keyframes fadeInDrawer {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  .sec-activity-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 4px 8px;
    min-height: 80px;
    min-width: 0;
    box-sizing: border-box;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 14px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  }
  .sec-activity-chip:hover {
    color: var(--ink);
    border-color: var(--muted);
    background: var(--row-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.09);
  }
  .sec-activity-chip:active {
    transform: scale(0.96);
  }
  .sec-activity-chip.active-action {
    background: rgba(8, 145, 178, 0.16) !important;
    border-color: rgba(8, 145, 178, 0.6) !important;
    color: #0891b2 !important;
    font-weight: 700 !important;
    animation: tummy-pulse 1.8s infinite ease-in-out;
  }
  @keyframes tummy-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(8, 145, 178, 0.45); }
    50% { box-shadow: 0 0 0 5px rgba(8, 145, 178, 0.15); }
  }
  .sec-chip-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.14);
    background: #fff;
    border: 1.5px solid rgba(0, 0, 0, 0.06);
  }
  #secBtnGrowth .sec-chip-icon {
    border: 2px solid rgba(5, 150, 105, 0.4);
    box-shadow: 0 3px 8px rgba(5, 150, 105, 0.22);
  }
  #secBtnMed .sec-chip-icon {
    border: 2px solid rgba(139, 92, 246, 0.4);
    box-shadow: 0 3px 8px rgba(139, 92, 246, 0.22);
  }
  #secBtnTemp .sec-chip-icon {
    border: 2px solid rgba(249, 115, 22, 0.4);
    box-shadow: 0 3px 8px rgba(249, 115, 22, 0.22);
  }
  #secBtnTummy .sec-chip-icon {
    border: 2px solid rgba(6, 182, 212, 0.4);
    box-shadow: 0 3px 8px rgba(6, 182, 212, 0.22);
  }
  #secBtnPump .sec-chip-icon {
    border: 2px solid rgba(14, 165, 233, 0.4);
    box-shadow: 0 3px 8px rgba(14, 165, 233, 0.22);
  }
  #secBtnMore .sec-chip-icon {
    border: 2px solid rgba(99, 102, 241, 0.38);
    box-shadow: 0 3px 8px rgba(99, 102, 241, 0.2);
    color: #6366f1;
    background: #f5f3ff;
  }
  :root.dark #secBtnMore .sec-chip-icon,
  :root:not(.light) #secBtnMore .sec-chip-icon {
    background: #232242;
    color: #a5b4fc;
    border-color: rgba(165, 180, 252, 0.45);
  }
  #secBtnMore.on {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.08);
  }
  :root.dark #secBtnMore.on,
  :root:not(.light) #secBtnMore.on {
    border-color: #818cf8;
    background: rgba(129, 140, 248, 0.12);
  }
  :root.dark .sec-chip-icon {
    background: #1e2536;
  }
  .sec-chip-img {
    width: 130%;
    height: 130%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
  }
  .sec-chip-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    line-height: 1.2;
    text-align: center;
  }
  .sec-kind-seg button.small-seg {
    font-size: 13px;
    padding: 8px 6px;
    gap: 7px;
  }
  .sec-kind-seg button.small-seg .sec-chip-icon {
    width: 24px;
    height: 24px;
  }
  @media (max-width: 380px) {
    .secondary-activities-bar {
      gap: 8px;
    }
    .sec-more-drawer {
      gap: 6px;
    }
    .sec-activity-chip {
      padding: 8px 2px 6px;
      font-size: 11.5px;
      min-height: 72px;
    }
    .sec-chip-icon {
      width: 40px;
      height: 40px;
    }
  }
  button.active-action {
    animation: pulse-ring 2s infinite ease-in-out;
  }
  @keyframes pulse-ring {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45); }
    50% { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.6); }
  }
  button.breast { background: var(--breast); } button.bottle { background: var(--bottle); } button.diaper { background: var(--diaper); }
  button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
  button.small { padding: 6px 10px; font-size: 14px; border-radius: 8px; }
  button.danger { background: var(--danger); }
  .active { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .active .t { font-size: 24px; font-variant-numeric: tabular-nums; font-weight: 700; }
  .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
    min-height: 48px;
    border-radius: 10px;
    border-top: 1px solid var(--row-divider);
    transition: background 0.12s ease;
    touch-action: manipulation;
  }
  .row:first-child { border-top: 0; }
  .row[data-clickable="true"] { cursor: pointer; }
  .row[data-clickable="true"]:hover { background: var(--row-hover); }
  .row[data-clickable="true"]:active { background: var(--row-hover); }
  .row[data-tone="night"], .row[data-tone="sleep"], .row[data-tone="nap"] {
    background: rgba(40, 53, 147, 0.05);
    border-left: 3px solid rgba(40, 53, 147, 0.7);
  }
  .row[data-tone="breast"] {
    background: rgba(232, 120, 154, 0.06);
    border-left: 3px solid rgba(232, 120, 154, 0.75);
  }
  .row[data-tone="bottle"], .row[data-tone="feed"] {
    background: rgba(240, 165, 58, 0.06);
    border-left: 3px solid rgba(240, 165, 58, 0.75);
  }
  .row[data-tone="formula"] {
    background: rgba(59, 176, 143, 0.06);
    border-left: 3px solid rgba(59, 176, 143, 0.75);
  }
  .row[data-tone="diaper"] {
    background: rgba(32, 178, 170, 0.06);
    border-left: 3px solid rgba(32, 178, 170, 0.75);
  }
  .row[data-tone="growth"] {
    background: rgba(5, 150, 105, 0.06);
    border-left: 3px solid rgba(5, 150, 105, 0.75);
  }
  .row[data-tone="med"] {
    background: rgba(139, 92, 246, 0.06);
    border-left: 3px solid rgba(139, 92, 246, 0.75);
  }
  .row[data-tone="temp"] {
    background: rgba(249, 115, 22, 0.06);
    border-left: 3px solid rgba(249, 115, 22, 0.75);
  }
  .row[data-tone="tummy"] {
    background: rgba(6, 182, 212, 0.06);
    border-left: 3px solid rgba(6, 182, 212, 0.75);
  }
  .row[data-tone="pump"] {
    background: rgba(14, 165, 233, 0.06);
    border-left: 3px solid rgba(14, 165, 233, 0.75);
  }
  .log-row-label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 15.5px;
    min-width: 0;
    flex: 1;
  }
  .log-row-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  :root.dark .row[data-tone="night"], :root.dark .row[data-tone="sleep"], :root.dark .row[data-tone="nap"] {
    background: rgba(79, 70, 229, 0.09);
    border-left-color: #818cf8;
  }
  :root.dark .row[data-tone="breast"] {
    background: rgba(232, 120, 154, 0.10);
    border-left-color: #f472b6;
  }
  :root.dark .row[data-tone="bottle"], :root.dark .row[data-tone="feed"] {
    background: rgba(240, 165, 58, 0.10);
    border-left-color: #fbbf24;
  }
  :root.dark .row[data-tone="formula"] {
    background: rgba(59, 176, 143, 0.10);
    border-left-color: #34d399;
  }
  :root.dark .row[data-tone="diaper"] {
    background: rgba(32, 178, 170, 0.10);
    border-left-color: #2dd4bf;
  }
  :root.dark .row[data-tone="growth"] {
    background: rgba(52, 211, 153, 0.10);
    border-left-color: #34d399;
  }
  :root.dark .row[data-tone="med"] {
    background: rgba(167, 139, 250, 0.10);
    border-left-color: #a78bfa;
  }
  :root.dark .row[data-tone="temp"] {
    background: rgba(251, 146, 60, 0.10);
    border-left-color: #fb923c;
  }
  :root.dark .row[data-tone="tummy"] {
    background: rgba(34, 211, 238, 0.10);
    border-left-color: #22d3ee;
  }
  :root.dark .row[data-tone="pump"] {
    background: rgba(56, 189, 248, 0.10);
    border-left-color: #38bdf8;
  }
  @media (prefers-color-scheme: dark) {
    :root:not(.light) .row[data-tone="night"], :root:not(.light) .row[data-tone="sleep"], :root:not(.light) .row[data-tone="nap"] {
      background: rgba(79, 70, 229, 0.09);
      border-left-color: #818cf8;
    }
    :root:not(.light) .row[data-tone="breast"] {
      background: rgba(232, 120, 154, 0.10);
      border-left-color: #f472b6;
    }
    :root:not(.light) .row[data-tone="bottle"], :root:not(.light) .row[data-tone="feed"] {
      background: rgba(240, 165, 58, 0.10);
      border-left-color: #fbbf24;
    }
    :root:not(.light) .row[data-tone="formula"] {
      background: rgba(59, 176, 143, 0.10);
      border-left-color: #34d399;
    }
    :root:not(.light) .row[data-tone="diaper"] {
      background: rgba(32, 178, 170, 0.10);
      border-left-color: #2dd4bf;
    }
    :root:not(.light) .row[data-tone="growth"] {
      background: rgba(52, 211, 153, 0.10);
      border-left-color: #34d399;
    }
    :root:not(.light) .row[data-tone="med"] {
      background: rgba(167, 139, 250, 0.10);
      border-left-color: #a78bfa;
    }
    :root:not(.light) .row[data-tone="temp"] {
      background: rgba(251, 146, 60, 0.10);
      border-left-color: #fb923c;
    }
    :root:not(.light) .row[data-tone="tummy"] {
      background: rgba(34, 211, 238, 0.10);
      border-left-color: #22d3ee;
    }
    :root:not(.light) .row[data-tone="pump"] {
      background: rgba(56, 189, 248, 0.10);
      border-left-color: #38bdf8;
    }
  }
  .log-row-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    background: #fff;
    position: relative;
  }
  .log-row-icon.night, .log-row-icon.sleep, .log-row-icon.nap {
    box-shadow: 0 0 0 1.5px rgba(40, 53, 147, 0.45), 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  .log-row-icon.breast, .log-row-icon.bottle, .log-row-icon.formula {
    box-shadow: 0 0 0 1.5px rgba(232, 120, 154, 0.45), 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  .log-row-icon.diaper {
    box-shadow: 0 0 0 1.5px rgba(32, 178, 170, 0.45), 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  .log-row-icon.growth {
    box-shadow: 0 0 0 1.5px rgba(5, 150, 105, 0.45), 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  .log-row-icon.med {
    box-shadow: 0 0 0 1.5px rgba(139, 92, 246, 0.45), 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  .log-row-icon.temp {
    box-shadow: 0 0 0 1.5px rgba(249, 115, 22, 0.45), 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  .log-row-icon.tummy {
    box-shadow: 0 0 0 1.5px rgba(6, 182, 212, 0.45), 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  .log-row-icon.small {
    width: 26px;
    height: 26px;
  }
  .log-row-icon.active-icon {
    width: 38px;
    height: 38px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  }
  .log-row-icon img.log-icon-img {
    width: 124%;
    height: 124%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
  }
  .log-row-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    flex-shrink: 0;
    line-height: 1.25;
  }
  .log-row-detail {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
  }
  .log-row-detail.ongoing {
    background: rgba(16, 185, 129, 0.14);
    color: var(--target);
    border: 1px solid rgba(16, 185, 129, 0.28);
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    display: inline-block;
  }
  .log-row-time {
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
    opacity: 0.78;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    margin-top: 2px;
    background: transparent;
    border: none;
    padding: 0;
    letter-spacing: 0.01em;
    transition: opacity 0.15s ease;
  }
  .log-row-time.standalone {
    font-size: 13px;
    margin-top: 0;
    opacity: 0.82;
  }
  .row[data-clickable="true"]:hover .log-row-time {
    opacity: 0.95;
  }
  .row.is-awake {
    background: rgba(245, 158, 11, 0.05);
    border-left: 3px solid var(--awake-accent, #d97706);
  }
  .row.is-awake .log-row-detail {
    color: var(--awake-accent, #d97706);
    font-weight: 600;
  }
  :root.dark .row.is-awake {
    background: rgba(251, 191, 36, 0.07);
    border-left-color: #fbbf24;
  }
  :root.dark .row.is-awake .log-row-detail {
    color: #fbbf24;
  }
  @media (prefers-color-scheme: dark) {
    :root:not(.light) .row.is-awake {
      background: rgba(251, 191, 36, 0.07);
      border-left-color: #fbbf24;
    }
    :root:not(.light) .row.is-awake .log-row-detail {
      color: #fbbf24;
    }
  }
  nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--line);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 100;
    box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.04);
  }
  nav button {
    flex: 1;
    min-width: 0;
    background: transparent;
    color: var(--muted);
    border: none;
    border-radius: 0;
    padding: 7px 4px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.15;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: color 0.18s ease, transform 0.08s ease;
    -webkit-tap-highlight-color: transparent;
  }
  nav button:active {
    transform: scale(0.92);
  }
  nav button .nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: currentColor;
    opacity: 0.65;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }
  nav button .nav-icon-svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 1.85;
    fill: none;
    display: block;
    transition: stroke-width 0.18s ease;
  }
  nav button .nav-label {
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: currentColor;
    transition: font-weight 0.18s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  nav button:hover {
    color: var(--ink);
    background: transparent;
  }
  nav button:hover .nav-icon {
    opacity: 0.88;
  }
  nav button.on {
    color: var(--primary);
    background: transparent;
    border: none;
  }
  nav button.on .nav-icon {
    opacity: 1;
    transform: translateY(-1px) scale(1.05);
  }
  nav button.on .nav-icon-svg {
    stroke-width: 2.2;
  }
  nav button.on .nav-label {
    font-weight: 650;
    color: currentColor;
  }
  :root.dark nav button.on,
  :root:not(.light) nav button.on {
    color: #818cf8;
    background: transparent;
    border: none;
  }
  :root.dark nav button.on .nav-label,
  :root:not(.light) nav button.on .nav-label {
    color: #818cf8;
  }

  /* Native App Modal Overlay & Translucent Backdrop */
  body.modal-open,
  body:has(dialog[open]) {
    overflow: hidden !important;
  }

  dialog::backdrop {
    background: var(--dialog-backdrop, rgba(0, 0, 0, 0.65));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeInBackdrop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes fadeInBackdrop {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  dialog {
    border: 0;
    border-radius: 20px;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    width: min(92vw, 440px);
    max-height: calc(100dvh - 36px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--line);
    margin: auto;
    position: fixed;
    inset: 0;
  }

  dialog[open] {
    animation: dialogNativeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes dialogNativeIn {
    from {
      opacity: 0;
      transform: scale(0.95) translateY(14px);
    }
    to {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }

  .dlg-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
  }
  .dlg-header-row h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
  }
  .dlg-close-btn {
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
  }
  .dlg-close-btn:hover {
    background: var(--line);
    color: var(--ink);
  }
  label { display: block; margin: 10px 0 4px; font-size: 14px; color: var(--muted); }
  input, select, textarea {
    width: 100%;
    font: inherit;
    font-size: 16px !important; /* Critical for iOS Safari: prevents auto-zooming on focus */
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink);
  }
  .seg { display: flex; gap: 6px; }
  .seg button {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
  }
  .seg-icon-wrap {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  }
  .seg-icon-wrap img {
    width: 124%;
    height: 124%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
  }
  .seg button.on { background: var(--sleep); color: #fff; border-color: var(--sleep); }
  .dlg-date-group {
    margin-top: 12px;
  }
  .dlg-field-label {
    display: block;
    margin: 0 0 5px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
  .date-seg {
    display: flex;
    gap: 6px;
  }
  .date-seg button {
    flex: 1;
    padding: 8px 6px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 9px;
    transition: all 0.12s ease;
  }
  .date-seg button.on {
    background: var(--sleep);
    color: #fff;
    border-color: var(--sleep);
    box-shadow: 0 1px 4px rgba(57, 73, 171, 0.25);
  }
  .time-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
    align-items: start;
  }
  .time-grid.single-col {
    grid-template-columns: 1fr;
  }
  .time-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .time-col label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 6px 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
  }
  /* Modern Unified Date & Time Card in Entry Dialog */
  .dlg-datetime-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 4px 12px 10px;
    margin: 8px 0 14px;
  }
  :root.dark .dlg-datetime-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
  }
  .dlg-dt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
    padding: 8px 4px;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
    user-select: none;
    transition: background 0.12s ease;
  }
  .dlg-dt-row:last-of-type {
    border-bottom: none;
  }
  .dlg-dt-row:active {
    opacity: 0.72;
  }
  .dlg-dt-left {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .dlg-dt-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
  }
  .dlg-dt-sublabel {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
  }
  .dlg-dt-right {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .dlg-dt-val {
    font-size: 15px;
    font-weight: 700;
    color: #2b6e82;
    letter-spacing: -0.01em;
  }
  :root.dark .dlg-dt-val {
    color: #38bdf8;
  }
  .dlg-dt-val.unset {
    color: var(--muted);
    font-weight: 500;
  }
  .dlg-dt-chevron {
    font-size: 18px;
    color: var(--muted);
    font-weight: 400;
    margin-left: 2px;
  }
  .dlg-dt-clear {
    border: 0;
    background: rgba(148, 163, 184, 0.18);
    color: var(--muted);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    margin-right: 2px;
    transition: all 0.12s ease;
  }
  .dlg-dt-clear:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
  }
  .overnight-badge {
    font-size: 11px;
    font-weight: 700;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    padding: 1px 6px;
    border-radius: 6px;
    letter-spacing: 0.02em;
    cursor: pointer;
  }
  .duration-hint {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--target, #0d9488);
    margin: 4px 4px 6px;
    min-height: 16px;
  }

  /* Native Drum Wheel Date & Time Picker Bottom Sheet Modal */
  dialog#dtPickerDlg.dt-picker-sheet {
    position: fixed;
    inset: auto 0 0 0;
    margin: 0 auto;
    width: 100%;
    max-width: 480px;
    border: 0;
    border-radius: 24px 24px 0 0;
    padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    background: var(--card, #ffffff);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.32), 0 0 0 1px var(--line);
    max-height: 90dvh;
    overflow: hidden;
    z-index: 99999;
  }
  dialog#dtPickerDlg::backdrop {
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  dialog#dtPickerDlg[open] {
    animation: dtSheetSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  :root.dark dialog#dtPickerDlg.dt-picker-sheet {
    background: #1e293b;
    color: #f8fafc;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  }
  @keyframes dtSheetSlideUp {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  .dt-drag-handle {
    width: 44px;
    height: 4.5px;
    background: #cbd5e1;
    border-radius: 3px;
    margin: 0 auto 14px;
  }
  :root.dark .dt-drag-handle {
    background: #475569;
  }
  .dt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 8px;
    position: relative;
    min-height: 36px;
  }
  .dt-title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0;
    letter-spacing: -0.01em;
  }
  :root.dark .dt-title {
    color: #f1f5f9;
  }
  .dt-calendar-jump-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #2b6e82;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
  }
  :root.dark .dt-calendar-jump-btn {
    background: #334155;
    border-color: #475569;
    color: #38bdf8;
  }
  .dt-calendar-jump-btn:active {
    transform: scale(0.96);
  }
  .dt-calendar-hidden-input {
    position: fixed;
    top: -9999px;
    left: -9999px;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    opacity: 0;
    pointer-events: none;
    font-size: 16px !important;
  }
  .dt-header-spacer {
    width: 68px;
  }
  .dt-wheels-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 220px;
    margin: 4px -6px 10px;
    overflow: hidden;
    user-select: none;
    mask-image: linear-gradient(to bottom, transparent 0%, black 22%, black 78%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 22%, black 78%, transparent 100%);
  }
  .dt-selection-window {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 88px; /* (220 - 44) / 2 */
    height: 44px;
    pointer-events: none;
    border-top: 1.5px solid #cbd5e1;
    border-bottom: 1.5px solid #cbd5e1;
    background: rgba(43, 110, 130, 0.04);
    border-radius: 6px;
    z-index: 1;
    transition: background 0.2s ease, border-color 0.2s ease;
  }
  .dt-selection-window.pulse {
    animation: dtWindowPulse 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes dtWindowPulse {
    0% {
      background: rgba(43, 110, 130, 0.04);
      border-color: #cbd5e1;
      transform: scale(1);
    }
    50% {
      background: rgba(43, 110, 130, 0.16);
      border-color: #2b6e82;
      transform: scale(1.015);
      box-shadow: 0 0 12px rgba(43, 110, 130, 0.2);
    }
    100% {
      background: rgba(43, 110, 130, 0.04);
      border-color: #cbd5e1;
      transform: scale(1);
    }
  }
  :root.dark .dt-selection-window {
    border-color: #475569;
    background: rgba(56, 189, 248, 0.05);
  }
  :root.dark .dt-selection-window.pulse {
    animation: dtWindowPulseDark 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes dtWindowPulseDark {
    0% {
      background: rgba(56, 189, 248, 0.05);
      border-color: #475569;
      transform: scale(1);
    }
    50% {
      background: rgba(56, 189, 248, 0.2);
      border-color: #38bdf8;
      transform: scale(1.015);
      box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
    }
    100% {
      background: rgba(56, 189, 248, 0.05);
      border-color: #475569;
      transform: scale(1);
    }
  }
  .dt-wheel-col {
    position: relative;
    height: 220px;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior: contain;
  }
  .dt-wheel-col::-webkit-scrollbar {
    display: none;
  }
  .dt-wheel-date {
    flex: 1.85;
  }
  .dt-wheel-hour, .dt-wheel-minute {
    flex: 0.85;
  }
  .dt-wheel-spacer {
    height: 88px;
    flex-shrink: 0;
  }
  .dt-wheel-item {
    height: 44px;
    line-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    font-size: 16px;
    color: #94a3b8;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    text-align: center;
  }
  .dt-wheel-date .dt-wheel-item {
    font-size: 15px;
  }
  .dt-wheel-item.selected {
    color: #2b6e82; /* Exactly matching screenshot teal/slate */
    font-size: 20px;
    font-weight: 700;
  }
  .dt-wheel-date .dt-wheel-item.selected {
    font-size: 17.5px;
  }
  :root.dark .dt-wheel-item.selected {
    color: #38bdf8;
  }
  .dt-quick-bar {
    display: flex;
    gap: 7px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 0 14px;
    border-top: 1px solid var(--line, #f1f5f9);
  }
  .dt-quick-chip {
    min-height: 34px;
    padding: 6px 13px;
    border-radius: 17px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .dt-quick-chip:active {
    background: #e2e8f0;
    transform: scale(0.96);
  }
  .dt-quick-chip.active {
    background: #2b6e82;
    border-color: #2b6e82;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(43, 110, 130, 0.3);
  }
  :root.dark .dt-quick-chip {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
  }
  :root.dark .dt-quick-chip.active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
  }
  .dt-quick-chip-cal {
    position: relative;
    background: #e0f2fe;
    border-color: #7dd3fc;
    color: #0369a1;
  }
  :root.dark .dt-quick-chip-cal {
    background: #0c4a6e;
    border-color: #0284c7;
    color: #bae6fd;
  }
  .dt-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 6px;
  }
  .dt-btn-cancel {
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 16px;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
  }
  .dt-btn-save {
    border: 0;
    background: transparent;
    color: #00b4d8; /* Bright teal/cyan matching screenshot */
    font-size: 17px;
    font-weight: 700;
    padding: 8px 16px;
    cursor: pointer;
  }
  .dt-btn-save:hover {
    color: #0284c7;
  }
  .stats-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .v { font-size: 22px; font-weight: 700; } .stat .l { font-size: 13px; color: var(--muted); }
  .hidden { display: none !important; }
  .alert-banner { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; font-weight: 600; color: #fff; flex-wrap: wrap; }
  .alert-actions { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
  .alert-btn { background: rgba(255, 255, 255, 0.22); border: 1px solid rgba(255, 255, 255, 0.45); color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
  .alert-btn:hover { background: rgba(255, 255, 255, 0.35); }
  .alert-close { background: transparent; border: 0; color: #fff; font-size: 18px; line-height: 1; padding: 4px 8px; cursor: pointer; border-radius: 6px; opacity: 0.85; }
  .alert-close:hover { opacity: 1; background: rgba(255,255,255,0.2); }
  .chart-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: baseline; color: var(--ink); }
  .chart-title .muted { font-size: 13.5px; font-weight: 500; }
  .slot-picker { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 6px 0 10px; }
  .slot-picker button { padding: 4px 10px; font-size: 13px; border-radius: 8px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); font-weight: normal; }
  .slot-picker button.on { background: var(--sleep); color: #fff; border-color: var(--sleep); font-weight: 600; }
  .notify-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; font-size: 14px; }
  .pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
  .log-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 0 10px;
  }
  .log-history-header h2 { margin: 0; font-size: 20px; font-weight: 800; }
  .log-sync-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--muted);
    user-select: none;
  }
  .log-sync-time {
    white-space: nowrap;
    opacity: 0.8;
    font-variant-numeric: tabular-nums;
  }
  .btn-log-sync {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 3px;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    opacity: 0.65;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
    box-shadow: none;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
  }
  .btn-log-sync:hover:not(:disabled) {
    opacity: 1;
    color: var(--ink);
    background: rgba(125, 125, 125, 0.12);
  }
  .btn-log-sync:disabled {
    cursor: default;
    opacity: 0.45;
  }
  .btn-log-sync .sync-icon {
    display: block;
    transform-origin: center;
  }
  .btn-log-sync.is-syncing .sync-icon {
    animation: syncSpin 0.75s linear infinite;
    color: var(--teal, #0d9488);
  }
  @keyframes syncSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }
  .log-filters {
    display: flex;
    align-items: center;
    gap: 8px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 14px;
    margin-bottom: 8px;
    flex-wrap: wrap;
  }
  .filter-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
  }
  .filter-more-drawer {
    display: flex;
    align-items: center;
    gap: 8px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 14px;
    margin-top: -6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    animation: fadeInDrawer 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .filter-more-drawer.hidden {
    display: none !important;
  }
  .filter-chip {
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    background: var(--card);
    color: var(--muted);
    border: 1.5px solid var(--line);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    touch-action: manipulation;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  }
  .filter-chip:hover {
    color: var(--ink);
    border-color: var(--muted);
  }
  .filter-chip.on {
    background: var(--ink);
    color: var(--card);
    border-color: var(--ink);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.16);
    transform: translateY(-1px);
  }
  :root.dark .filter-chip.on {
    background: #f1f3f9;
    color: #0f1420;
    border-color: #f1f3f9;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  }
  @media (prefers-color-scheme: dark) {
    :root:not(.light) .filter-chip.on {
      background: #f1f3f9;
      color: #0f1420;
      border-color: #f1f3f9;
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    }
  }
  .wake-toggle-btn {
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    background: transparent;
    color: var(--muted);
    border: 1.5px dashed var(--line);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    touch-action: manipulation;
  }
  .wake-toggle-btn:hover {
    color: var(--ink);
    border-color: var(--muted);
  }
  .wake-toggle-btn.on {
    background: rgba(245, 158, 11, 0.16);
    color: var(--awake-accent, #d97706);
    border: 1.5px solid rgba(245, 158, 11, 0.5);
  }
  :root.dark .wake-toggle-btn.on {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(245, 158, 11, 0.22);
  }
  @media (prefers-color-scheme: dark) {
    :root:not(.light) .wake-toggle-btn.on {
      color: #fbbf24;
      border-color: rgba(251, 191, 36, 0.5);
      background: rgba(245, 158, 11, 0.22);
    }
  }
  .chip-img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: inline-block;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
    background: #fff;
  }
  .log-date-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 22px 4px 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
  }
  .log-date-header:first-child { margin-top: 4px; }
  .log-date-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--line);
    color: var(--muted);
    letter-spacing: 0.02em;
  }
  .log-date-badge.today {
    background: rgba(67, 85, 219, 0.15);
    color: var(--sleep);
    box-shadow: 0 0 0 1px rgba(67, 85, 219, 0.2);
  }
  .log-day-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }
  .log-load-more-wrap {
    display: flex;
    justify-content: center;
    margin: 16px 0 28px;
  }
  .log-load-more-btn {
    background: var(--card);
    color: var(--ink);
    border: 1.5px solid var(--line);
    padding: 12px 26px;
    border-radius: 999px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .log-load-more-btn:hover {
    background: var(--bg);
    border-color: var(--muted);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
  .log-end-msg {
    text-align: center;
    padding: 20px 12px 32px;
    font-size: 13.5px;
    font-weight: 600;
  }
  .log-day-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: var(--summary-bg);
    border: 1.5px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 14px;
  }
  @media (max-width: 440px) {
    .log-day-summary {
      gap: 10px;
      padding: 12px;
      margin-bottom: 12px;
    }
  }
  .day-sum-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg);
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid var(--line);
    min-width: 0;
    min-height: 64px;
    transition: transform 0.1s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  }
  .day-sum-chip.feeds {
    background: var(--chip-feeds-bg);
    border-color: var(--chip-feeds-border);
  }
  .day-sum-chip.feeds .day-sum-label { color: var(--chip-feeds-accent); }
  .day-sum-chip.sleep {
    background: var(--chip-sleep-bg);
    border-color: var(--chip-sleep-border);
  }
  .day-sum-chip.sleep .day-sum-label { color: var(--chip-sleep-accent); }
  .day-sum-chip.awake {
    background: var(--chip-awake-bg);
    border-color: var(--chip-awake-border);
  }
  .day-sum-chip.awake .day-sum-label { color: var(--chip-awake-accent); }
  .day-sum-chip.diapers {
    background: var(--chip-diapers-bg);
    border-color: var(--chip-diapers-border);
  }
  .day-sum-chip.diapers .day-sum-label { color: var(--chip-diapers-accent); }
  .day-sum-chip.activities {
    background: var(--chip-awake-bg, rgba(245, 158, 11, 0.08));
    border-color: var(--chip-awake-border, rgba(245, 158, 11, 0.25));
  }
  .day-sum-chip.activities .day-sum-label {
    color: var(--chip-awake-accent, #d97706);
  }
  .day-sum-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
    background: #fff;
  }
  .day-sum-icon.mini {
    width: 20px;
    height: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  }
  .day-sum-icon img {
    width: 120%;
    height: 120%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
  }
  .day-sum-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
  }
  .day-sum-label {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 3px;
  }
  .day-sum-val {
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    white-space: normal;
  }
  .day-sum-sub {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    white-space: normal;
    line-height: 1.35;
    margin-top: 3px;
  }
  .stats-section {
    margin-bottom: 28px;
  }
  /* Trends Category Switcher & Large Icons */
  .trends-category-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 12px;
    margin-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .trends-category-nav::-webkit-scrollbar {
    display: none;
  }
  .trends-cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 16px;
    border-radius: 26px;
    border: 1.5px solid var(--line);
    background: var(--card);
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .trends-cat-btn:active {
    transform: scale(0.96);
  }
  .trends-cat-btn.on {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  }
  .trends-cat-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.28);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    border: 1.5px solid rgba(255, 255, 255, 0.45);
  }
  .trends-cat-icon img {
    width: 125%;
    height: 125%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
  }
  .trends-cat-label {
    line-height: 1;
  }
  .trends-range-seg {
    margin-bottom: 14px;
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: 14px;
    padding: 4px;
    display: flex;
    gap: 4px;
  }
  .trends-range-seg button {
    flex: 1;
    padding: 9px 8px;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--muted);
    transition: all 0.15s ease;
    white-space: nowrap;
  }
  .trends-range-seg button.on {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  }
  .stats-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 4px 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--line);
  }
  .stats-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.015em;
  }
  .stats-section-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
    border: 2px solid rgba(255, 255, 255, 0.65);
    background: var(--card);
  }
  .stats-section-icon-badge img {
    width: 125%;
    height: 125%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
  }
  .stats-action-btn {
    padding: 6px 12px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    border-radius: 9px !important;
  }
  /* Native-style Flat Chart Panes with Dividers */
  .chart-pane {
    background: transparent;
    border: none;
    padding: 18px 0 24px 0;
    margin-bottom: 0;
    border-bottom: 1.5px solid var(--line);
    position: relative;
    width: 100%;
  }
  .chart-pane:last-of-type,
  .chart-pane:last-child {
    border-bottom: none;
    padding-bottom: 10px;
  }
  .chart-pane .chart-title {
    padding: 0 2px 10px;
    margin-bottom: 4px;
  }
  .stats-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin: 8px 0 16px;
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: 14px;
  }
  .stats-summary-card {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 14px 18px;
    margin: 8px 0 16px;
    flex-wrap: wrap;
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: 14px;
  }
  /* Sleep Calendar Component */
  .sleep-calendar-card {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    margin: 8px 0 12px;
  }
  .sleep-calendar-wrapper {
    position: relative;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    margin: 0;
  }
  .sc-header-row {
    display: flex;
    width: max-content;
    min-width: 100%;
    border-bottom: 1px solid var(--line);
    background: var(--card);
    position: sticky;
    top: 0;
    z-index: 6;
  }
  .sc-time-gutter-header {
    width: 48px;
    flex-shrink: 0;
    border-right: 1px solid var(--line);
    position: sticky;
    left: 0;
    background: var(--card);
    z-index: 10;
  }
  .sc-cols-header {
    display: flex;
    flex: 1;
    min-width: 0;
  }
  .sc-col-head {
    text-align: center;
    padding: 8px 4px;
    border-right: 1px solid var(--line);
  }
  .sc-col-head:last-child {
    border-right: none;
  }
  .sc-col-head.is-today {
    background: rgba(37, 99, 235, 0.08);
  }
  .sc-col-label {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
  }
  .sc-col-sub {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 1px;
    font-weight: 500;
  }
  .sc-grid-body {
    display: flex;
    width: max-content;
    min-width: 100%;
    height: 380px;
    position: relative;
    background: var(--bg);
  }
  .sc-time-gutter {
    width: 48px;
    flex-shrink: 0;
    position: sticky;
    left: 0;
    border-right: 1px solid var(--line);
    background: var(--card);
    user-select: none;
    z-index: 8;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
  }
  .sc-time-tick {
    position: absolute;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    text-align: center;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
    pointer-events: none;
  }
  .sc-time-tick.is-first,
  .sc-time-tick:first-child {
    transform: translateY(3px) !important;
  }
  .sc-time-tick.is-last,
  .sc-time-tick:last-child {
    transform: translateY(calc(-100% - 3px)) !important;
  }
  .sc-cols-container {
    display: flex;
    flex: 1;
    position: relative;
    min-width: 0;
  }
  .sc-grid-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--line);
    opacity: 0.7;
    pointer-events: none;
  }
  .sc-col {
    position: relative;
    height: 100%;
    border-right: 1px solid var(--line);
    cursor: pointer;
  }
  .sc-col:last-child {
    border-right: none;
  }
  .sc-col.is-today {
    background: rgba(37, 99, 235, 0.03);
  }
  .sc-block {
    position: absolute;
    left: 3px;
    right: 3px;
    border-radius: 6px;
    padding: 3px 5px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    z-index: 2;
    box-sizing: border-box;
  }
  .sc-block:hover {
    transform: scale(1.02);
    z-index: 3;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  }
  .sc-block.sc-night {
    background: linear-gradient(135deg, #1e293b, #312e81);
    color: #e0e7ff;
    border: 1px solid rgba(129, 140, 248, 0.35);
  }
  .sc-block.sc-nap {
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    color: #ffffff;
    border: 1px solid rgba(125, 211, 252, 0.5);
  }
  .sc-block.sc-ongoing {
    animation: scPulse 2s infinite ease-in-out;
  }
  @keyframes scPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
    50% { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0); }
  }
  .sc-block-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    line-height: 1.15;
  }
  .sc-block-title {
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
  .sc-block-time {
    font-size: 9px;
    opacity: 0.85;
    white-space: nowrap;
    margin-top: 1px;
  }
  .sc-now-indicator {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 3;
    pointer-events: none;
    transform: translateY(-50%);
  }
  .sc-now-dot {
    position: absolute;
    left: -3px;
    top: -3px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
  }
  .sc-now-line {
    height: 2px;
    background: #ef4444;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.6);
  }
  .sc-popover {
    position: absolute;
    z-index: 20;
    width: 180px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    pointer-events: auto;
  }
  .sc-pop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }
  .sc-pop-close {
    background: none;
    border: none;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    padding: 2px 4px;
  }
  .sc-legend {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    background: var(--card);
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    position: sticky;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 5;
    flex-wrap: wrap;
  }
  .sc-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }
  .sc-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 3px;
  }
  .sc-dot-night { background: #312e81; }
  .sc-dot-nap { background: #0284c7; }
  .sc-dot-now { background: #ef4444; border-radius: 50%; }
  .stats-section-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .log-day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .sum-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  @media (min-width: 560px) { .sum-grid { grid-template-columns: repeat(3, 1fr); } }
  .sum-tile { background: var(--bg); border-radius: 12px; padding: 10px 12px; min-width: 0; }
  .sum-tile.hero { grid-column: 1 / -1; }
  .sum-label { font-size: 12px; color: var(--muted); }
  .sum-val { font-size: 18px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .sum-tile.hero .sum-val { font-size: 30px; }
  .sum-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
  .chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart-scroll-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
    scrollbar-width: thin;
    margin-bottom: 6px;
    border-radius: 12px;
  }
  .chart-scroll-wrap::-webkit-scrollbar {
    height: 5px;
  }
  .chart-scroll-wrap::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 3px;
  }
  .chart-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
  }
  .chart-toggle-group {
    display: inline-flex;
    background: var(--bg);
    border: 1.5px solid var(--line);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
  }
  .chart-toggle-btn {
    border: none;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .chart-toggle-btn.on {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
  }
  .chart-toggle-btn:not(.on):hover {
    background: rgba(0, 0, 0, 0.05);
  }
  html.dark .chart-toggle-btn:not(.on):hover {
    background: rgba(255, 255, 255, 0.08);
  }
  .chart-avg-banner {
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .chart-avg-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
  }
  .chart-avg-hero {
    font-size: 19px;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
  }
  .chart-avg-sub {
    font-size: 12.5px;
    color: var(--ink);
    opacity: 0.9;
    margin-top: 2px;
  }
  .chart-avg-sub strong {
    font-weight: 700;
  }
  .sleep-averages-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
  }
  .sleep-avg-card {
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .sleep-avg-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
  }
  .sleep-avg-hero {
    font-size: 19px;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
  }
  .sleep-avg-unit {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
  }
  .sleep-avg-meta {
    font-size: 12.5px;
    color: var(--ink);
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
  }
  .sleep-avg-meta strong {
    font-weight: 700;
  }
  .chart-target-legend {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    margin-top: 6px;
    width: 100%;
  }
  .chart-html-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 4px 6px 2px;
    margin-top: 4px;
    width: 100%;
    box-sizing: border-box;
  }
  .chart-html-legend:empty {
    display: none;
    padding: 0;
    margin: 0;
  }
  .chart-legend-list {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 14px;
  }
  .chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    touch-action: manipulation;
    transition: opacity 0.15s ease, background 0.15s ease;
  }
  .chart-legend-item:hover {
    background: rgba(0, 0, 0, 0.05);
  }
  :root.dark .chart-legend-item:hover {
    background: rgba(255, 255, 255, 0.08);
  }
  .chart-legend-item.is-hidden {
    opacity: 0.38;
    text-decoration: line-through;
  }
  .chart-legend-box {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    display: inline-block;
  }
  .chart-legend-label {
    line-height: 1.2;
    white-space: nowrap;
  }
  .target-band-chip {
    display: inline-block;
    width: 22px;
    height: 12px;
    border-radius: 3px;
    background: rgba(16, 185, 129, 0.22);
    border: 1.5px dashed #10b981;
    flex-shrink: 0;
  }
  .chart-stage {
    position: relative;
    width: max-content;
    min-width: 100%;
    display: flex;
  }
  .chart-y-axis-sticky-wrap {
    position: sticky;
    left: 0;
    top: 0;
    width: 0;
    flex-shrink: 0;
    overflow: visible;
    z-index: 6;
    pointer-events: none;
  }
  .chart-y-axis-sticky {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    border-right: 1px solid transparent;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
  }
  .chart-scroll-wrap.is-scrolled .chart-y-axis-sticky {
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.14);
    border-right: 1px solid var(--line);
  }
  .growth-chart-wrap {
    width: 100%;
    height: 270px;
    position: relative;
    margin-bottom: 6px;
  }
  @media (max-width: 480px) {
    .growth-chart-wrap {
      height: 240px;
    }
  }
  .tl-wrap { position: relative; font-size: 12px; }
  .tl-row { display: flex; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .tl-label { width: 72px; flex-shrink: 0; line-height: 1.2; padding-right: 8px; }
  .tl-label b { display: block; font-size: 12px; }
  .tl-label span { font-size: 10px; color: var(--muted); }
  .tl-track { flex: 1; position: relative; height: 32px; background: var(--bg); border-radius: 8px; overflow: hidden; }
  .tl-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
  .tl-block { position: absolute; top: 4px; height: 24px; min-width: 6px; border-radius: 5px; cursor: pointer; touch-action: manipulation; }
  .tl-night { background: var(--night-sleep); z-index: 1; }
  .tl-nap { background: var(--nap); z-index: 1; }
  .tl-awake { background: rgba(255, 159, 64, 0.22); }
  .tl-awake.waking { background: rgba(255, 159, 64, 0.5); }
  .tl-bed { box-shadow: inset 3px 0 0 #fff; }
  .tl-awake.gap { background: rgba(124, 58, 237, 0.28); }
  .tl-awake.ongoing { background: repeating-linear-gradient(45deg, rgba(255,159,64,.6) 0 4px, rgba(255,159,64,.15) 4px 8px); }
  .tl-tip { position: absolute; display: none; z-index: 10; width: max-content; max-width: 250px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.4; box-shadow: 0 4px 14px rgba(0,0,0,.2); pointer-events: auto; }
  .tl-tip-btns { display: flex; gap: 6px; margin-top: 6px; }
  .tl-tip-btn { font-size: 11px; padding: 4px 8px; border-radius: 6px; border: 0; background: var(--sleep); color: #fff; font-weight: 600; cursor: pointer; }
  .tl-tip-btn.wake { background: var(--line); color: var(--ink); }
  @media (max-width: 480px) {
    main { padding: 10px; }
    .chart-title { font-size: 16.5px; font-weight: 700; }
    .chart-box { height: 220px; }
    .seg button { padding: 9px 4px; font-size: 14px; }
    /* Mobile-optimized Sleep Timeline: Stack row label above track, give full width and comfortable height */
    .tl-row { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 0; width: 100%; box-sizing: border-box; }
    .tl-row.axis-row { display: flex; flex-direction: row; align-items: center; padding: 0 0 6px; margin-bottom: 2px; width: 100%; }
    .tl-row.axis-row .tl-label { display: none; }
    .tl-row.axis-row > div:last-child { flex: 1; width: 100%; position: relative; height: 18px; }
    .tl-label { width: 100%; display: flex; justify-content: space-between; align-items: baseline; padding-right: 0; box-sizing: border-box; }
    .tl-label b { display: inline-block; font-size: 13px; font-weight: 700; color: var(--ink); }
    .tl-label span { font-size: 11px; color: var(--muted); }
    .tl-track { flex: none; display: block; width: 100%; height: 38px; min-height: 38px; position: relative; background: rgba(0, 0, 0, 0.05); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-sizing: border-box; }
    .tl-block { position: absolute; top: 4px; height: 28px; min-width: 8px; border-radius: 6px; display: block; }
  }
  :root.dark .tl-track { background: rgba(255, 255, 255, 0.06); }
  @media (max-width: 480px) and (prefers-color-scheme: dark) {
    :root:not(.light) .tl-track { background: rgba(255, 255, 255, 0.06); }
  }

  /* Settings view */
  .settings-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 24px;
  }
  .settings-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .settings-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }
  .settings-card-icon {
    font-size: 20px;
    line-height: 1;
    padding: 6px;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--line);
    flex-shrink: 0;
  }
  .settings-field-group {
    margin-bottom: 10px;
  }
  .settings-field-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 4px;
  }
  .settings-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--ink);
  }
  .settings-notify-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-top: 4px;
  }
  .settings-notify-status {
    font-size: 13px;
    line-height: 1.3;
  }
  .saved-notice {
    font-size: 13px;
    font-weight: 600;
    color: var(--target);
    transition: opacity 0.3s ease;
  }

  /* ========================================================
     Unified Next Step Suggestions (Native Widget Architecture)
     No box-inside-box: direct Hero Nap/Awake card + 2-col Feed/Diaper
     ======================================================== */
  .suggestions-section {
    margin-top: 4px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .guidance-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  /* Compact Active Activity Bar (for active pump / tummy / nursing if active) */
  .active-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    min-height: 50px;
    border-radius: 14px;
    background: var(--card);
    border: 1.5px solid var(--line);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.15s ease;
  }
  .active-status-bar.active-awake {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.35);
  }
  .active-status-bar.active-sleep {
    background: rgba(57, 73, 171, 0.08);
    border-color: rgba(57, 73, 171, 0.35);
  }
  .active-status-bar.active-breast {
    background: rgba(232, 120, 154, 0.08);
    border-color: rgba(232, 120, 154, 0.35);
  }
  .active-status-bar.active-tummy {
    background: rgba(8, 145, 178, 0.08);
    border-color: rgba(8, 145, 178, 0.35);
  }
  .active-status-bar.active-tummy .active-status-time {
    color: #0891b2;
  }
  .active-status-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
  }
  .active-status-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  .active-status-img {
    width: 124%;
    height: 124%;
    object-fit: cover;
    display: block;
  }
  .active-status-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    gap: 2px;
  }
  .active-status-row-main {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
  }
  .active-status-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
  }
  .active-status-time {
    font-size: 17px;
    font-weight: 800;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  .active-status-bar.active-awake .active-status-time {
    color: var(--awake-accent, #d97706);
  }
  .active-status-row-sub {
    display: flex;
    align-items: center;
    min-width: 0;
  }
  .active-status-since {
    font-size: 12px;
    color: var(--muted);
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .active-edit-btn {
    padding: 6px 12px;
    min-height: 28px;
    font-size: 12px;
    border-radius: 6px;
    flex-shrink: 0;
    margin-left: 10px;
  }

  /* --------------------------------------------------------
     Hero Sleep & Wake Card (Merged Awake timer + Next Nap)
     -------------------------------------------------------- */
  .guidance-hero-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--card);
    border: 1.5px solid var(--line);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  }
  .guidance-hero-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.08);
  }
  .guidance-hero-card:active {
    transform: scale(0.985);
  }
  .guidance-hero-card:focus-visible {
    outline: 2px solid var(--sleep);
    outline-offset: 2px;
  }

  .hero-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
  }
  .hero-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .hero-icon-wrap {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
  }
  .hero-icon-img {
    width: 122%;
    height: 122%;
    object-fit: cover;
    display: block;
  }

  /* Status Pill (Awake for X or Asleep for X) */
  .hero-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3.5px 10px 3.5px 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    border: 1px solid transparent;
  }
  .hero-status-pill.awake {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.32);
  }
  .hero-status-pill.sleeping {
    background: rgba(57, 73, 171, 0.14);
    color: #3730a3;
    border-color: rgba(57, 73, 171, 0.32);
  }
  .hero-status-pill.generic {
    background: rgba(100, 116, 139, 0.12);
    color: var(--muted);
    border-color: rgba(100, 116, 139, 0.25);
  }

  .hero-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
  }
  .hero-pulse-dot.awake {
    background: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6);
    animation: heroPulseAmber 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
  }
  .hero-pulse-dot.sleeping {
    background: #6366f1;
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.6);
    animation: heroPulseIndigo 2.2s infinite cubic-bezier(0.4, 0, 0.6, 1);
  }
  @keyframes heroPulseAmber {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
    50% { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0); }
  }
  @keyframes heroPulseIndigo {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.55); }
    50% { box-shadow: 0 0 0 5px rgba(99, 102, 241, 0); }
  }

  .hero-status-pill-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
  }

  .hero-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .hero-target-pill {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    opacity: 0.85;
  }

  /* Hero Main Content */
  .hero-main-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
  }
  .hero-primary-val {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 21px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1.2;
    flex-wrap: wrap;
  }
  .hero-label-prefix {
    font-size: 15px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: normal;
  }
  .hero-val-highlight {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
  }
  .hero-sub-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.35;
    flex-wrap: wrap;
  }
  .hero-sub-val {
    color: var(--ink);
    font-weight: 600;
  }
  .hero-separator {
    opacity: 0.45;
  }
  .hero-last-val {
    color: var(--muted);
  }

  /* Tone styling for Hero Card */
  .guidance-hero-card.nap {
    background: linear-gradient(135deg, rgba(57, 73, 171, 0.06) 0%, rgba(57, 73, 171, 0.02) 100%), var(--card);
    border-color: rgba(57, 73, 171, 0.28);
  }
  .guidance-hero-card.night {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(79, 70, 229, 0.03) 100%), var(--card);
    border-color: rgba(79, 70, 229, 0.32);
  }
  .guidance-hero-card.open {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.09) 0%, rgba(16, 185, 129, 0.03) 100%), var(--card);
    border-color: rgba(16, 185, 129, 0.38);
  }
  .guidance-hero-card.open .hero-val-highlight {
    color: #059669;
  }
  .guidance-hero-card.overdue {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.09) 0%, rgba(239, 68, 68, 0.03) 100%), var(--card);
    border-color: rgba(239, 68, 68, 0.38);
  }
  .guidance-hero-card.overdue .hero-val-highlight {
    color: #dc2626;
  }

  /* --------------------------------------------------------
     Secondary Guidance Grid (Feed & Diaper: Prominent 2-Col)
     -------------------------------------------------------- */
  .guidance-secondary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
  }

  /* Feed & Diaper Guidance Cards */
  .guidance-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px 14px;
    min-height: 86px;
    border-radius: 16px;
    background: var(--card);
    border: 1.5px solid var(--line);
    min-width: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    position: relative;
    user-select: none;
    transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  }
  .guidance-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
  }
  .guidance-card:active {
    transform: scale(0.98);
  }
  .guidance-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }

  .guidance-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
    min-width: 0;
  }
  .guidance-card-header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .guidance-card-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  .guidance-card-img {
    width: 122%;
    height: 122%;
    object-fit: cover;
    display: block;
  }
  .guidance-card-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .guidance-card-value {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    letter-spacing: -0.01em;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .guidance-card-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }
  .guidance-card-sub {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    opacity: 0.95;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .guidance-card-last {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    opacity: 0.8;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .guidance-card-info-badge {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid currentColor;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    opacity: 0.55;
    flex-shrink: 0;
    color: var(--muted);
    transition: opacity 0.15s ease;
  }
  .guidance-card:hover .guidance-card-info-badge,
  .guidance-hero-card:hover .guidance-card-info-badge {
    opacity: 0.95;
  }

  /* Specific accents for Feed and Diaper */
  .guidance-card.feed {
    background: linear-gradient(135deg, rgba(232, 120, 154, 0.07) 0%, rgba(232, 120, 154, 0.02) 100%), var(--card);
    border-color: rgba(232, 120, 154, 0.28);
  }
  .guidance-card.feed .guidance-card-label { color: #be185d; }
  .guidance-card.feed .guidance-card-value { color: #9d174d; }

  .guidance-card.feed.due {
    background: linear-gradient(135deg, rgba(240, 165, 58, 0.12) 0%, rgba(240, 165, 58, 0.03) 100%), var(--card);
    border-color: rgba(240, 165, 58, 0.4);
  }
  .guidance-card.feed.due .guidance-card-label { color: #b45309; }
  .guidance-card.feed.due .guidance-card-value { color: #b45309; }

  .guidance-card.diaper {
    background: linear-gradient(135deg, rgba(32, 178, 170, 0.07) 0%, rgba(32, 178, 170, 0.02) 100%), var(--card);
    border-color: rgba(32, 178, 170, 0.28);
  }
  .guidance-card.diaper .guidance-card-label { color: #0d9488; }
  .guidance-card.diaper .guidance-card-value { color: #0f766e; }

  .guidance-card.diaper.due {
    background: linear-gradient(135deg, rgba(240, 165, 58, 0.12) 0%, rgba(240, 165, 58, 0.03) 100%), var(--card);
    border-color: rgba(240, 165, 58, 0.4);
  }
  .guidance-card.diaper.due .guidance-card-label { color: #b45309; }
  .guidance-card.diaper.due .guidance-card-value { color: #b45309; }

  /* Dark mode theme overrides */
  :root.dark .hero-status-pill.awake {
    background: rgba(245, 158, 11, 0.22);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.45);
  }
  :root.dark .hero-status-pill.sleeping {
    background: rgba(99, 102, 241, 0.22);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.45);
  }
  :root.dark .guidance-card.feed .guidance-card-label { color: #f472b6; }
  :root.dark .guidance-card.feed .guidance-card-value { color: #fbcfe8; }
  :root.dark .guidance-card.feed.due .guidance-card-label { color: #fbbf24; }
  :root.dark .guidance-card.feed.due .guidance-card-value { color: #fef3c7; }
  :root.dark .guidance-card.diaper .guidance-card-label { color: #2dd4bf; }
  :root.dark .guidance-card.diaper .guidance-card-value { color: #ccfbf1; }
  :root.dark .guidance-card.diaper.due .guidance-card-label { color: #fbbf24; }
  :root.dark .guidance-card.diaper.due .guidance-card-value { color: #fef3c7; }
  :root.dark .guidance-hero-card.open .hero-val-highlight { color: #34d399; }
  :root.dark .guidance-hero-card.overdue .hero-val-highlight { color: #f87171; }

  /* Dark mode overrides (programmatic :root.dark and OS prefers-color-scheme) */
  :root.dark .active-status-bar.active-awake,
  @media (prefers-color-scheme: dark) { :root:not(.light) .active-status-bar.active-awake {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.3);
  }}
  :root.dark .active-status-bar.active-awake .active-status-time,
  @media (prefers-color-scheme: dark) { :root:not(.light) .active-status-bar.active-awake .active-status-time {
    color: #fbbf24;
  }}
  :root.dark .active-status-bar.active-sleep,
  @media (prefers-color-scheme: dark) { :root:not(.light) .active-status-bar.active-sleep {
    background: rgba(79, 70, 229, 0.12);
    border-color: rgba(79, 70, 229, 0.35);
  }}
  :root.dark .active-status-bar.active-sleep .active-status-time,
  @media (prefers-color-scheme: dark) { :root:not(.light) .active-status-bar.active-sleep .active-status-time {
    color: #818cf8;
  }}
  :root.dark .active-status-bar.active-breast,
  @media (prefers-color-scheme: dark) { :root:not(.light) .active-status-bar.active-breast {
    background: rgba(232, 120, 154, 0.12);
    border-color: rgba(232, 120, 154, 0.35);
  }}
  :root.dark .active-status-bar.active-breast .active-status-time,
  @media (prefers-color-scheme: dark) { :root:not(.light) .active-status-bar.active-breast .active-status-time {
    color: #f472b6;
  }}
  :root.dark .active-status-bar.active-tummy,
  @media (prefers-color-scheme: dark) { :root:not(.light) .active-status-bar.active-tummy {
    background: rgba(6, 182, 212, 0.14);
    border-color: rgba(6, 182, 212, 0.4);
  }}
  :root.dark .active-status-bar.active-tummy .active-status-time,
  @media (prefers-color-scheme: dark) { :root:not(.light) .active-status-bar.active-tummy .active-status-time {
    color: #22d3ee;
  }}
  :root.dark .guidance-card.wake,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.wake {
    background: rgba(79, 70, 229, 0.12);
    border-color: rgba(79, 70, 229, 0.32);
  }}
  :root.dark .guidance-card.wake .guidance-card-label,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.wake .guidance-card-label { color: #818cf8; }}
  :root.dark .guidance-card.wake .guidance-card-value,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.wake .guidance-card-value { color: #a5b4fc; }}

  :root.dark .guidance-card.wake.open,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.wake.open {
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.4);
  }}
  :root.dark .guidance-card.wake.open .guidance-card-label,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.wake.open .guidance-card-label { color: #34d399; }}
  :root.dark .guidance-card.wake.open .guidance-card-value,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.wake.open .guidance-card-value { color: #34d399; }}

  :root.dark .guidance-card.wake.overdue,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.wake.overdue {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
  }}
  :root.dark .guidance-card.wake.overdue .guidance-card-label,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.wake.overdue .guidance-card-label { color: #f87171; }}
  :root.dark .guidance-card.wake.overdue .guidance-card-value,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.wake.overdue .guidance-card-value { color: #f87171; }}

  :root.dark .guidance-card.feed,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.feed {
    background: rgba(232, 120, 154, 0.12);
    border-color: rgba(232, 120, 154, 0.32);
  }}
  :root.dark .guidance-card.feed .guidance-card-label,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.feed .guidance-card-label { color: #f472b6; }}
  :root.dark .guidance-card.feed .guidance-card-value,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.feed .guidance-card-value { color: #fbcfe8; }}

  :root.dark .guidance-card.feed.due,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.feed.due {
    background: rgba(251, 191, 36, 0.14);
    border-color: rgba(251, 191, 36, 0.4);
  }}
  :root.dark .guidance-card.feed.due .guidance-card-label,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.feed.due .guidance-card-label { color: #fbbf24; }}
  :root.dark .guidance-card.feed.due .guidance-card-value,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.feed.due .guidance-card-value { color: #fde68a; }}

  :root.dark .guidance-card.diaper,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.diaper {
    background: rgba(32, 178, 170, 0.12);
    border-color: rgba(32, 178, 170, 0.32);
  }}
  :root.dark .guidance-card.diaper .guidance-card-label,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.diaper .guidance-card-label { color: #2dd4bf; }}
  :root.dark .guidance-card.diaper .guidance-card-value,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.diaper .guidance-card-value { color: #99f6e4; }}

  :root.dark .guidance-card.diaper.due,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.diaper.due {
    background: rgba(251, 191, 36, 0.14);
    border-color: rgba(251, 191, 36, 0.4);
  }}
  :root.dark .guidance-card.diaper.due .guidance-card-label,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.diaper.due .guidance-card-label { color: #fbbf24; }}
  :root.dark .guidance-card.diaper.due .guidance-card-value,
  @media (prefers-color-scheme: dark) { :root:not(.light) .guidance-card.diaper.due .guidance-card-value { color: #fde68a; }}

  /* Suggestion Explainer Modal Dialog */
  dialog#guidanceExplainerDlg {
    border: 0;
    border-radius: 20px;
    padding: 20px;
    width: min(92vw, 440px);
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  }
  .explainer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
  }
  .explainer-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .explainer-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(57, 73, 171, 0.08);
    flex-shrink: 0;
  }
  .explainer-icon-img {
    width: 26px;
    height: 26px;
    object-fit: contain;
  }
  .explainer-method-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
  }
  .explainer-current-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--summary-bg);
    border: 1px solid var(--line);
    margin-bottom: 12px;
  }
  .explainer-current-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
  }
  .explainer-current-value {
    font-weight: 800;
    color: var(--ink);
    font-size: 14.5px;
  }
  .explainer-summary-text {
    font-size: 13.5px;
    line-height: 1.48;
    color: var(--ink);
    margin-bottom: 12px;
  }
  .explainer-breakdown-card {
    background: var(--summary-bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 12px;
  }
  .explainer-breakdown-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .explainer-factors-list {
    display: flex;
    flex-direction: column;
  }
  .explainer-factor-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid var(--row-divider);
    font-size: 12.5px;
    gap: 10px;
  }
  .explainer-factor-row:last-child {
    border-bottom: 0;
  }
  .explainer-factor-label {
    color: var(--muted);
    flex-shrink: 0;
  }
  .explainer-factor-value {
    color: var(--ink);
    font-weight: 600;
    text-align: right;
  }
  .explainer-tip-box {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.09);
    border: 1px solid rgba(245, 158, 11, 0.28);
    color: var(--ink);
    font-size: 12px;
    line-height: 1.42;
    margin-bottom: 6px;
  }
  .explainer-trust-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
    margin-top: 8px;
    margin-bottom: 4px;
    justify-content: center;
  }

  /* Multi-Tenant Authentication Dialog Styles */
  .auth-dialog {
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    max-width: 420px;
    width: 92%;
    max-height: 90vh;
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .auth-dialog::backdrop {
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  .auth-box {
    padding: 22px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
  .auth-header {
    text-align: center;
    margin-bottom: 2px;
  }
  .auth-brand-lockup {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 auto 6px;
    vertical-align: middle;
  }
  .auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    margin: 0;
    flex-shrink: 0;
  }
  .auth-logo-img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: block;
    object-fit: cover;
    flex-shrink: 0;
  }
  :root.dark .auth-logo-img {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.12);
  }
  .first-run-logo-img {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2);
    display: inline-block;
    vertical-align: middle;
  }
  .auth-header h2,
  .auth-header h2.auth-brand-title {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-transform: none !important;
    color: var(--ink);
    line-height: 1.15;
    display: inline-block;
    background: linear-gradient(135deg, var(--ink) 45%, #0284c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  :root.dark .auth-header h2,
  :root.dark .auth-header h2.auth-brand-title {
    background: linear-gradient(135deg, #ffffff 45%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  @media (prefers-color-scheme: dark) {
    :root:not(.light) .auth-logo-img {
      box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.12);
    }
    :root:not(.light) .auth-header h2,
    :root:not(.light) .auth-header h2.auth-brand-title {
      background: linear-gradient(135deg, #ffffff 45%, #38bdf8 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
  }
  .auth-header p,
  .auth-header .auth-subheading {
    color: var(--muted);
    font-size: 13.5px !important;
    line-height: 1.45;
    margin: 4px auto 16px !important;
    max-width: 320px;
  }
  .auth-trust-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 18px;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: -0.01em;
  }

  /* Segmented Mode Tabs */
  .auth-seg {
    display: flex;
    gap: 4px;
    background: var(--bg);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--line);
    margin-bottom: 18px;
    position: relative;
    z-index: 10;
  }
  .auth-seg button {
    flex: 1;
    border: none;
    border-radius: 9px;
    padding: 9px 6px;
    min-height: 40px;
    font-weight: 600;
    font-size: 13px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    transition: all 0.15s ease;
  }
  .auth-seg button:hover {
    color: var(--ink);
  }
  .auth-seg button.on {
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    font-weight: 700;
    border-color: transparent;
  }
  :root.dark .auth-seg button.on {
    background: #2a3144;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  }
  @media (prefers-color-scheme: dark) {
    :root:not(.light) .auth-seg button.on {
      background: #2a3144;
      color: #ffffff;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    }
  }

  /* Google Sign-in Button */
  .btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    color: #1f2937;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.15s ease;
    cursor: pointer;
  }
  .btn-google:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  }
  :root.dark .btn-google {
    background: #242c3d;
    color: #f3f4f6;
    border-color: #3b455b;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  }
  :root.dark .btn-google:hover {
    background: #2c364b;
    border-color: #4b5773;
  }
  @media (prefers-color-scheme: dark) {
    :root:not(.light) .btn-google {
      background: #242c3d;
      color: #f3f4f6;
      border-color: #3b455b;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    }
    :root:not(.light) .btn-google:hover {
      background: #2c364b;
      border-color: #4b5773;
    }
  }

  /* Google Auth Bridge Screen (PWA / Mobile Web Bridge) */
  .google-bridge-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInBackdrop 0.2s ease-out;
  }
  .google-bridge-modal {
    background: var(--card, #ffffff);
    color: var(--ink, #1f2937);
    border: 1px solid var(--line, #e5e7eb);
    border-radius: 20px;
    padding: 32px 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
    animation: toastSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Divider */
  .auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 18px 0 14px;
    color: var(--muted);
    font-size: 12px;
  }
  .auth-divider::before,
  .auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--line);
  }
  .auth-divider span {
    padding: 0 12px;
    opacity: 0.85;
    font-weight: 500;
  }

  /* Error Box */
  .auth-error-box {
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #ef4444;
    font-size: 13px;
    margin-bottom: 14px;
    text-align: center;
    font-weight: 600;
  }

  /* Form Labels & Inputs */
  .auth-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin: 10px 0 5px;
  }
  .auth-form input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg);
    border: 1.5px solid var(--line);
    color: var(--ink);
    font-size: 14.5px;
    border-radius: 10px;
    padding: 11px 13px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }
  .auth-form input:focus {
    outline: none;
    border-color: var(--primary, #3949ab);
    box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.2);
  }

  /* Primary Submit Button */
  .btn-auth-submit {
    display: block;
    width: 100%;
    background: #3949ab;
    color: #ffffff !important;
    padding: 13px 18px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 14px rgba(57, 73, 171, 0.35);
    transition: all 0.15s ease;
  }
  .btn-auth-submit:hover {
    background: #303f9f;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(57, 73, 171, 0.45);
  }
  .btn-auth-submit:active {
    transform: translateY(0) scale(0.98);
  }
  :root.dark .btn-auth-submit {
    background: #4f46e5;
    color: #ffffff !important;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.45);
  }
  :root.dark .btn-auth-submit:hover {
    background: #4338ca;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.55);
  }
  @media (prefers-color-scheme: dark) {
    :root:not(.light) .btn-auth-submit {
      background: #4f46e5;
      color: #ffffff !important;
      box-shadow: 0 4px 16px rgba(79, 70, 229, 0.45);
    }
    :root:not(.light) .btn-auth-submit:hover {
      background: #4338ca;
      box-shadow: 0 6px 20px rgba(79, 70, 229, 0.55);
    }
  }

  /* Compact mode when soft keyboard is open or on short screens */
  @media (max-height: 720px) {
    .auth-dialog {
      max-height: calc(100dvh - 16px);
      margin: auto auto;
    }
    .auth-box {
      padding: 14px 18px 24px;
    }
    .auth-brand-lockup {
      gap: 10px;
      margin-bottom: 4px;
    }
    .auth-logo {
      font-size: 26px;
      margin-bottom: 0;
    }
    .auth-logo-img {
      width: 36px;
      height: 36px;
      border-radius: 10px;
    }
    .auth-header h2,
    .auth-header h2.auth-brand-title {
      font-size: 20px;
    }
    .auth-header p,
    .auth-header .auth-subheading {
      margin: 2px 0 10px !important;
      font-size: 12px !important;
    }
    .auth-trust-badge {
      margin-top: 12px;
      font-size: 11px;
    }
    .auth-seg {
      margin-bottom: 12px !important;
      padding: 3px;
    }
    .auth-seg button {
      padding: 7px 10px;
      font-size: 13px;
    }
    .btn-google {
      padding: 9px 12px;
      font-size: 13.5px;
    }
    .auth-divider {
      margin: 10px 0 8px;
    }
    .auth-form label {
      margin: 6px 0 2px !important;
      font-size: 12px !important;
    }
    .auth-form input {
      padding: 9px 12px;
      font-size: 16px;
    }
    .btn-auth-submit {
      padding: 11px 16px;
      margin-top: 12px !important;
    }
  }

  .active-status-bar.active-pump {
    background: rgba(14, 165, 233, 0.08);
    border-color: rgba(14, 165, 233, 0.35);
  }
  .active-status-bar.active-pump .active-status-time {
    color: #0284c7;
  }
  :root.dark .active-status-bar.active-pump {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.4);
  }
  :root.dark .active-status-bar.active-pump .active-status-time {
    color: #38bdf8;
  }

  /* Activity Selector Grid & Drawer (shown on Add Past Entry & Edit) */
  .dlg-kind-select-wrap {
    margin-bottom: 14px;
  }
  .dlg-kind-grid-primary,
  .dlg-kind-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 6px;
  }
  .dlg-kind-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 12px;
    background: var(--card);
    border: 1.5px solid var(--line);
    cursor: pointer;
    transition: all 0.15s ease;
    box-sizing: border-box;
    min-height: 48px;
  }
  .dlg-kind-btn img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
  }
  .dlg-kind-btn span {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
  }
  .dlg-kind-btn:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
  }
  .dlg-kind-btn.on {
    background: rgba(14, 165, 233, 0.12);
    border-color: #0284c7;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  }
  .dlg-kind-btn.on span {
    color: #0284c7;
  }

  .dlg-kind-more-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--surface, rgba(0, 0, 0, 0.03));
    border: 1px dashed var(--line);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .dlg-kind-more-toggle:hover {
    background: rgba(14, 165, 233, 0.06);
    border-color: var(--primary);
    color: var(--primary);
  }
  .dlg-kind-more-toggle.on {
    background: rgba(14, 165, 233, 0.08);
    border-color: rgba(14, 165, 233, 0.4);
    border-style: solid;
    color: #0284c7;
  }
  .dlg-kind-more-arrow {
    font-size: 11px;
    transition: transform 0.2s ease;
  }

  .dlg-more-kind-drawer {
    margin-top: 8px;
    animation: fadeInDrawer 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .dlg-more-kind-drawer.hidden {
    display: none !important;
  }
  .dlg-kind-grid-more {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .dlg-kind-grid-more .dlg-kind-btn {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    min-height: 52px;
  }
  .dlg-kind-grid-more .dlg-kind-btn span {
    font-size: 11.5px;
  }

  /* Live Pump Timer Card */
  .pump-timer-card {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(2, 132, 199, 0.04));
    border: 1.5px solid rgba(14, 165, 233, 0.25);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 14px;
  }
  .pump-timer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }
  .pump-timer-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #0284c7;
  }
  .pump-timer-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(14, 165, 233, 0.15);
    color: #0369a1;
  }
  .pump-timer-badge.running {
    background: #0284c7;
    color: #fff;
    animation: pulse 1.5s infinite;
  }
  .pump-timer-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  .pump-timer-clock {
    font-size: 28px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    letter-spacing: 0.02em;
  }
  .pump-timer-controls {
    display: flex;
    gap: 6px;
    align-items: center;
  }
  .pump-ctrl-btn {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 9px;
    cursor: pointer;
    border: none;
    transition: all 0.12s ease;
  }
  .pump-ctrl-btn.start {
    background: #0284c7;
    color: #fff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
  }
  .pump-ctrl-btn.start:hover {
    background: #0369a1;
  }
  .pump-ctrl-btn.stop {
    background: #e11d48;
    color: #fff;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.35);
  }
  .pump-ctrl-btn.reset {
    padding: 7px 10px;
    font-size: 12px;
  }
  :root.dark .pump-timer-card {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(14, 165, 233, 0.06));
    border-color: rgba(56, 189, 248, 0.3);
  }
  :root.dark .pump-timer-title {
    color: #38bdf8;
  }
  :root.dark .pump-timer-badge {
    background: rgba(56, 189, 248, 0.2);
    color: #7dd3fc;
  }
  :root.dark .pump-timer-clock {
    color: #f1f5f9;
  }

  /* Baby Firsts & Milestones Styling */
  .row.is-milestone {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(251, 191, 36, 0.03));
    border-left: 3.5px solid var(--first, #f59e0b);
    border-radius: 12px;
    margin-bottom: 6px;
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    box-shadow: 0 1px 4px rgba(245, 158, 11, 0.1);
  }
  .row.is-milestone:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(251, 191, 36, 0.06));
  }
  .row .log-row-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
  .log-milestone-photo-wrap {
    margin-top: 4px;
    border-radius: 10px;
    overflow: hidden;
    max-height: 200px;
    border: 1px solid rgba(245, 158, 11, 0.25);
    background: #000;
  }
  .log-milestone-photo {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
  }
  .log-milestone-photo:hover {
    transform: scale(1.02);
  }

  /* Milestone Form Photo Picker */
  .milestone-photo-section {
    margin-top: 14px;
    background: var(--bg);
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 12px;
  }

  /* ==========================================================================
     Modern Photo Upload & Dropzone Layouts
     ========================================================================== */

  .modern-photo-dropzone {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: var(--summary-bg);
    border: 1.5px dashed var(--line);
    border-radius: 16px;
    margin-top: 10px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .modern-photo-dropzone:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.04);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  }

  .modern-photo-dropzone:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }

  .modern-photo-dropzone.drag-over {
    border-color: var(--primary) !important;
    background: rgba(37, 99, 235, 0.08) !important;
    border-style: solid !important;
    transform: scale(1.01);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.15) !important;
  }

  .modern-photo-dropzone.compact {
    padding: 10px 14px;
    gap: 12px;
    border-radius: 14px;
  }

  .modern-avatar-preview-wrap {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--line);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    overflow: visible;
  }

  .modern-photo-dropzone.compact .modern-avatar-preview-wrap {
    width: 54px;
    height: 54px;
  }

  .modern-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }

  .modern-avatar-placeholder {
    font-size: 32px;
    line-height: 1;
  }

  .modern-photo-dropzone.compact .modern-avatar-placeholder {
    font-size: 26px;
  }

  .modern-avatar-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    border: 2px solid var(--card);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    transition: transform 0.15s ease;
  }

  .modern-photo-dropzone:hover .modern-avatar-badge {
    transform: scale(1.12);
  }

  .modern-dropzone-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .modern-dropzone-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
  }

  .modern-dropzone-hint {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 2px;
    line-height: 1.3;
  }

  .modern-dropzone-subhint {
    font-size: 11px;
    color: var(--muted);
    opacity: 0.8;
    margin-top: 2px;
  }

  .modern-dropzone-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
  }

  .btn-dropzone-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .btn-dropzone-action:hover {
    background: var(--line);
    color: var(--ink);
  }

  .btn-dropzone-action.danger {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.28);
  }

  .btn-dropzone-action.danger:hover {
    background: rgba(239, 68, 68, 0.16);
    border-color: #ef4444;
    color: #b91c1c;
  }

  :root.dark .btn-dropzone-action.danger,
  @media (prefers-color-scheme: dark) {
    :root:not(.light) .btn-dropzone-action.danger {
      color: #fca5a5;
      background: rgba(239, 68, 68, 0.16);
      border-color: rgba(248, 113, 113, 0.38);
    }
    :root:not(.light) .btn-dropzone-action.danger:hover {
      color: #ffffff;
      background: rgba(239, 68, 68, 0.32);
      border-color: #f87171;
    }
  }

  .modern-photo-dropzone.has-photo {
    border-style: solid;
    border-color: rgba(57, 73, 171, 0.25);
    background: rgba(57, 73, 171, 0.03);
  }

  :root.dark .modern-photo-dropzone.has-photo,
  @media (prefers-color-scheme: dark) {
    :root:not(.light) .modern-photo-dropzone.has-photo {
      border-color: rgba(99, 102, 241, 0.3);
      background: rgba(99, 102, 241, 0.05);
    }
  }

  /* Milestone / Firsts Media Dropzone */
  .modern-media-dropzone {
    min-height: 140px;
    background: var(--summary-bg);
    border: 2px dashed var(--line);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    margin-top: 8px;
  }

  .modern-media-dropzone:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.04);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
  }

  .modern-media-dropzone.drag-over {
    border-color: var(--primary) !important;
    background: rgba(37, 99, 235, 0.08) !important;
    border-style: solid !important;
    transform: scale(1.01);
  }

  .modern-media-dropzone-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px;
  }

  .modern-media-icon-badge {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--card);
    border: 1.5px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease;
  }

  .modern-media-dropzone:hover .modern-media-icon-badge {
    transform: scale(1.1);
  }

  .modern-media-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
  }

  .modern-media-hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
  }

  .modern-media-sub {
    font-size: 11px;
    color: var(--muted);
    opacity: 0.75;
    margin-top: 3px;
  }

  .modern-media-preview-wrap {
    width: 100%;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #09090b;
  }

  .modern-media-preview-img {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    display: block;
  }

  .modern-media-preview-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.75), transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .btn-media-bar-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.92);
    color: #18181b;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.15s ease;
  }

  .btn-media-bar-action:hover {
    background: #ffffff;
    transform: scale(1.02);
  }

  .btn-media-bar-action.danger {
    background: rgba(239, 68, 68, 0.92);
    color: #ffffff;
  }

  .btn-media-bar-action.danger:hover {
    background: rgba(239, 68, 68, 1);
  }

  .modern-media-dropzone.has-photo {
    border-style: solid;
    padding: 0;
    min-height: auto;
  }

  :root.dark .btn-media-bar-action,
  @media (prefers-color-scheme: dark) {
    :root:not(.light) .btn-media-bar-action {
      background: rgba(27, 33, 48, 0.88);
      color: #e2e8f0;
      border: 1px solid rgba(255, 255, 255, 0.18);
    }
    :root:not(.light) .btn-media-bar-action:hover {
      background: rgba(38, 47, 68, 0.96);
      color: #ffffff;
    }
    :root:not(.light) .btn-media-bar-action.danger {
      background: rgba(220, 38, 38, 0.88);
      color: #ffffff;
      border: 1px solid rgba(248, 113, 113, 0.4);
    }
    :root:not(.light) .btn-media-bar-action.danger:hover {
      background: rgba(239, 68, 68, 0.98);
      border-color: #f87171;
    }
  }

  /* Legacy compatibility classes */
  .photo-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .photo-upload-label:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
  }
  .photo-cam-icon {
    font-size: 16px;
  }
  .milestone-photo-preview-wrap {
    position: relative;
    margin-top: 10px;
    width: 100%;
    max-height: 220px;
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid var(--line);
    background: #111;
  }
  .milestone-photo-preview-wrap img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    display: block;
  }
  .btn-remove-photo {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: background 0.15s ease;
  }
  .btn-remove-photo:hover {
    background: rgba(220, 38, 38, 0.9);
  }

  /* Child Profile Header Bar */
  .child-profile-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
  }
  .child-profile-main {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    border-radius: 12px;
    padding: 4px 6px;
    margin: -4px -6px;
    transition: background 0.15s ease;
  }
  .child-profile-main:hover {
    background: rgba(0, 0, 0, 0.04);
  }
  :root.dark .child-profile-main:hover {
    background: rgba(255, 255, 255, 0.06);
  }
  .child-avatar-wrap {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(147, 51, 234, 0.15));
    border: 2px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }
  .child-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .child-avatar-placeholder {
    font-size: 22px;
    line-height: 1;
    font-weight: 700;
    color: var(--primary);
  }
  .child-profile-info {
    display: flex;
    flex-direction: column;
  }
  .child-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .child-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.015em;
  }
  .child-switcher-arrow {
    font-size: 13px;
    color: var(--muted);
    transition: transform 0.2s ease;
  }
  .child-profile-main[aria-expanded="true"] .child-switcher-arrow {
    transform: rotate(180deg);
  }
  .child-subtitle {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
  }
  .child-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .child-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .child-header-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
    color: var(--primary);
  }

  /* Child Switcher List */
  .child-switcher-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
  }
  .child-switcher-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg);
    border: 1.5px solid var(--line);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .child-switcher-item:hover {
    border-color: var(--primary);
  }
  .child-switcher-item.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.03));
    border-color: var(--primary);
  }
  .child-switcher-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .switcher-avatar-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--card);
    border: 1.5px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .switcher-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .switcher-avatar-ph {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
  }
  .switcher-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
  }
  .switcher-age {
    font-size: 12px;
    color: var(--muted);
  }
  .child-switcher-item-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .switcher-check {
    font-size: 16px;
    font-weight: 900;
    color: var(--primary);
  }
  .btn-edit-child-profile {
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 6px;
  }

  /* Child Photo Preview */
  .child-photo-preview-wrap {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--line);
    background: #000;
  }
  .child-photo-preview-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* First-Run Setup Modal */
  .first-run-box {
    max-width: 460px;
  }
  .first-run-header {
    text-align: center;
    margin-bottom: 16px;
  }
  .first-run-logo {
    font-size: 42px;
    display: inline-block;
    animation: bounce 1s infinite alternate ease-in-out;
  }
  .setup-section-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
  }
  .setup-section-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  /* Subtle Header Offline Status Pill Indicator */
  .offline-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 700;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    line-height: 1;
    background: transparent;
  }
  .offline-status-pill .offline-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
  }
  /* Offline state (device offline) */
  .offline-status-pill.offline {
    background: rgba(100, 116, 139, 0.12);
    color: var(--muted, #64748b);
    border-color: rgba(100, 116, 139, 0.25);
  }
  .offline-status-pill.offline .offline-status-dot {
    background: var(--muted, #64748b);
  }
  /* Server unreachable / pending sync state */
  .offline-status-pill.unreachable {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.3);
  }
  .offline-status-pill.unreachable .offline-status-dot {
    background: #d97706;
  }
  /* Syncing state */
  .offline-status-pill.syncing {
    background: rgba(2, 132, 199, 0.12);
    color: #0284c7;
    border-color: rgba(2, 132, 199, 0.3);
  }
  .offline-status-pill.syncing .offline-status-dot {
    background: #0284c7;
    animation: offlinePulse 1.4s infinite ease-in-out;
  }
  @keyframes offlinePulse {
    0%, 100% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.2); }
  }
  .offline-status-pill:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
  }
  .offline-banner {
    display: none !important;
  }

  .badge-pending-sync {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 9999px;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted, #64748b);
    border: 1px solid rgba(148, 163, 184, 0.25);
    letter-spacing: 0.01em;
    flex-shrink: 0;
  }
  @media (prefers-color-scheme: dark) {
    .badge-pending-sync {
      background: rgba(148, 163, 184, 0.2);
      color: #94a3b8;
      border-color: rgba(148, 163, 184, 0.3);
    }
  }
  [data-theme="dark"] .badge-pending-sync {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    border-color: rgba(148, 163, 184, 0.3);
  }

  .row.pending-sync-row {
    opacity: 0.92;
  }
  [data-theme="dark"] .row.pending-sync-row {
    opacity: 0.92;
  }

  /* Notification Permission Pre-Prompt Modal */
  .notif-modal-dlg {
    padding: 0;
    border-radius: 24px;
    width: min(92vw, 420px);
    border: none;
    background: var(--card);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--line);
    overflow: hidden;
  }

  .notif-prompt-container {
    padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .notif-prompt-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .notif-prompt-icon-ring {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(57, 73, 171, 0.12), rgba(59, 176, 143, 0.18));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(57, 73, 171, 0.1);
  }

  .notif-prompt-bell {
    font-size: 28px;
    animation: notifBellWiggle 2.5s ease-in-out infinite;
  }

  @keyframes notifBellWiggle {
    0%, 70%, 100% { transform: rotate(0deg); }
    75% { transform: rotate(-12deg); }
    80% { transform: rotate(12deg); }
    85% { transform: rotate(-8deg); }
    90% { transform: rotate(8deg); }
    95% { transform: rotate(0deg); }
  }

  .notif-prompt-title {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.3px;
  }

  .notif-prompt-desc {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--muted);
  }

  .notif-prompt-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--summary-bg);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 12px;
  }

  .notif-feature-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .notif-feature-icon {
    font-size: 18px;
    line-height: 1.2;
    flex-shrink: 0;
    padding-top: 1px;
  }

  .notif-feature-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
  }

  .notif-feature-text strong {
    display: block;
    color: var(--ink);
    font-weight: 600;
    font-size: 13px;
  }

  .notif-feature-text p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 12px;
  }

  .notif-ios-guide-box {
    background: rgba(2, 132, 199, 0.08);
    border: 1px solid rgba(2, 132, 199, 0.25);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 12.5px;
    color: var(--ink);
  }

  .notif-ios-guide-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--nap);
  }

  .notif-ios-guide-box p {
    margin: 0;
    line-height: 1.4;
    color: var(--muted);
  }

  .notif-prompt-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
  }

  .notif-btn-enable {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 18px;
    background: linear-gradient(135deg, var(--primary), var(--formula));
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(57, 73, 171, 0.25);
    transition: transform 0.15s ease, opacity 0.15s ease;
  }

  .notif-btn-enable:active {
    transform: scale(0.98);
  }

  .notif-btn-later {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .notif-btn-later:hover,
  .notif-btn-later:active {
    background: var(--row-hover);
    color: var(--ink);
  }

  /* Settings Master-Detail Navigation & Sub-Menus */
  .settings-page-header {
    margin-bottom: 14px;
    padding: 0 4px;
  }

  .settings-page-title {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.4px;
  }

  .settings-page-subtitle {
    margin: 0;
    font-size: 13.5px;
    color: var(--muted);
  }

  .settings-group {
    margin-bottom: 18px;
  }

  .settings-group-header {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin: 0 6px 6px;
  }

  .settings-menu-list {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  }

  .settings-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--row-divider);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .settings-menu-item:last-child {
    border-bottom: none;
  }

  .settings-menu-item:hover,
  .settings-menu-item:active {
    background: var(--row-hover);
  }

  .settings-menu-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
  }

  .settings-menu-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .settings-menu-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
  }

  .settings-menu-subtitle {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .settings-menu-chevron {
    font-size: 18px;
    color: var(--muted);
    font-weight: 400;
    padding-left: 4px;
  }

  /* Sub-Menu Detail View Header */
  .settings-sub-view {
    animation: settingsSubIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes settingsSubIn {
    from {
      opacity: 0;
      transform: translateX(12px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .settings-sub-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 2px 0 6px;
  }

  .settings-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 10px 6px 0;
    border-radius: 8px;
    transition: opacity 0.15s ease;
  }

  .settings-back-btn:active {
    opacity: 0.7;
  }

  .settings-back-arrow {
    font-size: 20px;
    line-height: 1;
  }

  .settings-sub-nav-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    text-align: center;
    flex: 1;
  }

  .settings-nav-spacer {
    width: 60px;
  }

  /* Settings Time Inputs */
  .settings-time-input {
    font-size: 16px !important;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--ink);
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
  }

  /* Baby Information Settings Card */
  .baby-settings-avatar-wrap {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--chip-feeds-bg);
    border: 2.5px solid var(--chip-feeds-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  }

  .baby-settings-avatar-wrap:hover {
    transform: scale(1.05);
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(0,0,0,0.14);
  }

  .baby-settings-avatar-wrap:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  .baby-settings-avatar-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 22px;
    height: 22px;
    background: rgba(17, 24, 39, 0.72);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    backdrop-filter: blur(4px);
    border: 1.5px solid #ffffff;
    pointer-events: none;
    transition: background 0.16s ease;
  }

  .baby-settings-avatar-wrap:hover .baby-settings-avatar-badge {
    background: var(--accent);
  }

  .baby-settings-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .baby-settings-avatar-placeholder {
    font-size: 30px;
    line-height: 1;
  }

  .baby-age-readout {
    background: var(--summary-bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 10px;
  }

  /* Legal & Medical Health Disclaimer & Privacy Policy */
  .legal-disclaimer-alert {
    background: rgba(239, 68, 68, 0.06);
    border: 1.5px solid rgba(239, 68, 68, 0.28);
    border-radius: 14px;
    padding: 14px 16px;
    margin-top: 4px;
  }
  :root.dark .legal-disclaimer-alert {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
  }
  .legal-alert-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }
  .legal-alert-icon {
    font-size: 18px;
    line-height: 1;
  }
  .legal-alert-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #dc2626;
  }
  :root.dark .legal-alert-title {
    color: #f87171;
  }
  .legal-alert-body {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .legal-alert-body p {
    margin: 0;
  }
  .privacy-policy-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 6px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }
  .privacy-section-block {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
  }
  .privacy-section-block h5 {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
  }
  .privacy-section-block p {
    margin: 0 0 6px 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink);
  }
  .privacy-section-block p:last-child {
    margin-bottom: 0;
  }
  .privacy-section-block ul {
    margin: 4px 0 0 0;
    padding-left: 20px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--ink);
  }
  .privacy-section-block li {
    margin-bottom: 4px;
  }

  /* ---------------------------------------------------------------------------
     Sleep Started Bottom Sheet Modal (High Contrast & Touch-Friendly)
     --------------------------------------------------------------------------- */
  dialog#sleepStartedSheet.sleep-started-sheet {
    position: fixed;
    inset: auto 0 0 0;
    margin: 0 auto;
    width: 100%;
    max-width: 480px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 24px 24px 0 0;
    padding: 0;
    background: var(--card, #ffffff);
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.28), 0 0 0 1px var(--line);
    max-height: 90dvh;
    overflow-y: auto;
    z-index: 99999;
  }
  dialog#sleepStartedSheet::backdrop {
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
  }
  dialog#sleepStartedSheet[open] {
    animation: sleepSheetSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  :root.dark dialog#sleepStartedSheet.sleep-started-sheet {
    background: #1a2233;
    color: #f1f5f9;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  }
  @keyframes sleepSheetSlideUp {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .sleep-sheet-content {
    display: flex;
    flex-direction: column;
    padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px)) 20px;
    gap: 16px;
  }

  .sleep-sheet-drag-handle {
    width: 40px;
    height: 4.5px;
    border-radius: 3px;
    background: var(--line, #cbd5e1);
    margin: 0 auto 4px auto;
  }
  :root.dark .sleep-sheet-drag-handle {
    background: rgba(255, 255, 255, 0.2);
  }

  .sleep-sheet-header {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
  }

  .sleep-sheet-badge {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(57, 73, 171, 0.15), rgba(79, 70, 229, 0.25));
    border: 1.5px solid rgba(57, 73, 171, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(57, 73, 171, 0.15);
  }

  .sleep-sheet-titles {
    flex: 1;
    min-width: 0;
  }

  .sleep-sheet-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--ink, #0f172a);
    line-height: 1.25;
  }

  .sleep-sheet-subtitle {
    margin: 3px 0 0 0;
    font-size: 13px;
    color: var(--muted, #64748b);
    line-height: 1.3;
  }

  .sleep-sheet-close-btn {
    background: var(--summary-bg, #f1f5f9);
    border: 1px solid var(--line, #e2e8f0);
    color: var(--muted, #64748b);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
  }
  .sleep-sheet-close-btn:hover {
    background: var(--line, #e2e8f0);
    color: var(--ink, #0f172a);
  }

  .sleep-sheet-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .sleep-sheet-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted, #64748b);
  }

  .sleep-sheet-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .sleep-sheet-preset {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    min-height: 52px;
    border-radius: 14px;
    background: var(--summary-bg, #f8fafc);
    border: 1.5px solid var(--line, #e2e8f0);
    color: var(--ink, #0f172a);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s ease;
  }
  .sleep-sheet-preset:hover {
    background: var(--chip-sleep-bg, rgba(57, 73, 171, 0.08));
    border-color: var(--chip-sleep-border, rgba(57, 73, 171, 0.3));
    color: var(--chip-sleep-accent, #3949ab);
  }
  .sleep-sheet-preset.active {
    background: var(--sleep, #3949ab);
    border-color: var(--sleep, #3949ab);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(57, 73, 171, 0.3);
  }

  .sleep-sheet-preset .preset-icon {
    font-size: 16px;
    margin-right: 6px;
  }
  .sleep-sheet-preset .preset-text {
    flex: 1;
    text-align: left;
  }
  .sleep-sheet-preset .preset-check {
    font-size: 14px;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.15s ease;
  }
  .sleep-sheet-preset.active .preset-check {
    opacity: 1;
  }

  .sleep-sheet-custom-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    min-height: 48px;
    border-radius: 14px;
    background: var(--card, #ffffff);
    border: 1.5px dashed var(--line, #cbd5e1);
    color: var(--ink, #0f172a);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    transition: all 0.15s ease;
  }
  .sleep-sheet-custom-btn:hover {
    border-color: var(--sleep, #3949ab);
    background: var(--chip-sleep-bg, rgba(57, 73, 171, 0.06));
    color: var(--chip-sleep-accent, #3949ab);
  }
  .sleep-sheet-custom-btn .custom-btn-icon {
    font-size: 15px;
    margin-right: 8px;
  }
  .sleep-sheet-custom-btn .custom-btn-text {
    flex: 1;
    text-align: left;
  }
  .sleep-sheet-custom-btn .custom-btn-arrow {
    font-size: 14px;
    color: var(--muted, #94a3b8);
  }

  .sleep-sheet-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
  }

  .sleep-sheet-btn-done {
    width: 100%;
    min-height: 50px;
    border-radius: 14px;
    background: var(--primary, #3949ab);
    color: #ffffff;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(57, 73, 171, 0.32);
    transition: all 0.15s ease;
  }
  .sleep-sheet-btn-done:hover {
    background: var(--primary-hover, #303f9f);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(57, 73, 171, 0.38);
  }

  .sleep-sheet-btn-undo {
    width: 100%;
    min-height: 44px;
    border-radius: 14px;
    background: rgba(217, 83, 79, 0.08);
    color: var(--danger, #d9534f);
    border: 1px solid rgba(217, 83, 79, 0.25);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
  }
  .sleep-sheet-btn-undo:hover {
    background: rgba(217, 83, 79, 0.16);
    border-color: rgba(217, 83, 79, 0.45);
  }

  /* Desktop Adaptive Layout (Centered Modal on Desktop/Tablet >= 641px) */
  @media (min-width: 641px) {
    dialog#sleepStartedSheet.sleep-started-sheet {
      inset: 0;
      margin: auto;
      border: 1px solid var(--line);
      border-radius: 22px;
      width: min(92vw, 470px);
      max-height: calc(100dvh - 60px);
      box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--line);
    }
    :root.dark dialog#sleepStartedSheet.sleep-started-sheet {
      border: 1px solid rgba(255, 255, 255, 0.12);
      box-shadow: 0 28px 70px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
    }
    dialog#sleepStartedSheet[open] {
      animation: dialogNativeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .sleep-sheet-drag-handle {
      display: none;
    }
    .sleep-sheet-content {
      padding: 22px 24px 24px 24px;
      gap: 16px;
    }
    .sleep-sheet-actions {
      flex-direction: row-reverse;
      gap: 10px;
      margin-top: 6px;
    }
    .sleep-sheet-btn-done {
      flex: 1.35;
      min-height: 46px;
      font-size: 14.5px;
    }
    .sleep-sheet-btn-undo {
      flex: 1;
      min-height: 46px;
      font-size: 13.5px;
    }
  }

  /* Compact floating feedback notifications */
  .toast-container {
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 12px);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 150000;
    padding: 0 14px;
  }

  .toast-mini-feedback {
    pointer-events: auto;
    background: var(--ink, #0f172a);
    color: var(--card, #ffffff);
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    animation: toastSlideUp 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  .toast-mini-feedback.dismissing {
    animation: toastSlideDown 0.2s cubic-bezier(0.4, 0, 1, 1) forwards !important;
  }

  @keyframes toastSlideUp {
    from {
      opacity: 0;
      transform: translateY(18px) scale(0.97);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  @keyframes toastSlideDown {
    from {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
    to {
      opacity: 0;
      transform: translateY(18px) scale(0.97);
    }
  }

  /* Defensive safeguard: ensure any cached or stale HTML splash screen never renders or blocks logs */
  #appSplashScreen,
  .app-splash-screen,
  .app-splash-content,
  .app-splash-logo {
    display: none !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }

  /* ==========================================================================
     History Tab: Calendar Days & Activities Styling
     ========================================================================== */
  .history-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 2px 14px;
    gap: 12px;
  }
  .history-title-group h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--ink);
  }
  .history-subtitle {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    margin-top: 1px;
    display: block;
  }
  .history-mode-segmented {
    display: inline-flex;
    background: var(--bg-deep, rgba(0, 0, 0, 0.05));
    border-radius: 999px;
    padding: 3px;
    border: 1px solid var(--line);
    gap: 2px;
  }
  .history-mode-btn {
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.18s ease;
  }
  .history-mode-btn.on {
    background: var(--card);
    color: var(--primary, #2563eb);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  }

  /* Date Navigator Card */
  .history-date-nav-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px 14px;
    margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  }
  .history-date-nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
  }
  .history-nav-arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--bg, #f8fafc);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    flex-shrink: 0;
  }
  .history-nav-arrow:hover:not(:disabled) {
    background: var(--bg-hover, #f1f5f9);
    transform: scale(1.05);
  }
  .history-nav-arrow:active:not(:disabled) {
    transform: scale(0.94);
  }
  .history-nav-arrow:disabled,
  .history-nav-arrow.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
  }
  .history-date-picker-btn {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 10px;
    transition: background 0.15s ease;
  }
  .history-date-picker-btn:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.03));
  }
  .history-cal-icon {
    font-size: 16px;
  }
  .history-date-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .history-relative-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
  }
  .history-relative-badge.today {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary, #2563eb);
  }
  .history-relative-badge.yesterday {
    background: rgba(100, 116, 139, 0.12);
    color: var(--muted, #64748b);
  }
  .history-date-arrow {
    font-size: 12px;
    color: var(--muted);
  }
  .history-today-btn {
    font-size: 11px;
    font-weight: 700;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary, #2563eb);
    border: 1px solid rgba(37, 99, 235, 0.2);
    cursor: pointer;
    flex-shrink: 0;
  }
  .history-cal-jump-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--bg, #f8fafc);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    flex-shrink: 0;
  }
  .history-cal-jump-btn:hover {
    color: var(--primary, #2563eb);
    border-color: var(--primary, #2563eb);
  }

  /* Weekly Strip */
  .history-week-strip-wrap {
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0 0;
  }
  .history-week-strip-wrap::-webkit-scrollbar {
    display: none;
  }
  .history-week-strip {
    display: flex;
    gap: 6px;
    justify-content: space-between;
  }
  .history-strip-day {
    flex: 1;
    min-width: 40px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    padding: 6px 2px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .history-strip-day:hover:not(.is-selected) {
    background: var(--bg-hover, rgba(0, 0, 0, 0.03));
  }
  .history-strip-dayname {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 2px;
  }
  .history-strip-daynum {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.15;
    margin-bottom: 4px;
  }
  .history-strip-dots {
    display: flex;
    gap: 3px;
    height: 5px;
    align-items: center;
    justify-content: center;
  }
  .history-strip-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
  }
  .history-strip-dot.empty {
    background: transparent;
  }
  .history-strip-day.is-today:not(.is-selected) {
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.04);
  }
  .history-strip-day.is-selected {
    background: var(--primary, #2563eb);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
    transform: translateY(-1px);
  }
  .history-strip-day.is-selected .history-strip-dayname,
  .history-strip-day.is-selected .history-strip-daynum {
    color: #ffffff;
  }
  .history-strip-day.is-selected .history-strip-dot {
    background: #ffffff !important;
  }

  /* Summary Grid */
  .history-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 14px;
  }
  @media (max-width: 440px) {
    .history-summary-grid {
      gap: 10px;
      margin-bottom: 12px;
    }
  }
  .history-sum-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg);
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid var(--line);
    min-width: 0;
    min-height: 64px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    transition: transform 0.1s ease;
  }
  .history-sum-card.feeds {
    background: var(--chip-feeds-bg);
    border-color: var(--chip-feeds-border);
  }
  .history-sum-card.feeds .history-sum-title,
  .history-sum-card.feeds .day-sum-label { color: var(--chip-feeds-accent); }
  .history-sum-card.sleep {
    background: var(--chip-sleep-bg);
    border-color: var(--chip-sleep-border);
  }
  .history-sum-card.sleep .history-sum-title,
  .history-sum-card.sleep .day-sum-label { color: var(--chip-sleep-accent); }
  .history-sum-card.awake {
    background: var(--chip-awake-bg);
    border-color: var(--chip-awake-border);
  }
  .history-sum-card.awake .history-sum-title,
  .history-sum-card.awake .day-sum-label { color: var(--chip-awake-accent); }
  .history-sum-card.activities {
    background: var(--chip-awake-bg, rgba(245, 158, 11, 0.08));
    border-color: var(--chip-awake-border, rgba(245, 158, 11, 0.25));
  }
  .history-sum-card.activities .history-sum-title,
  .history-sum-card.activities .day-sum-label { color: var(--chip-awake-accent, #d97706); }
  .history-sum-card.diapers {
    background: var(--chip-diapers-bg);
    border-color: var(--chip-diapers-border);
  }
  .history-sum-card.diapers .history-sum-title,
  .history-sum-card.diapers .day-sum-label { color: var(--chip-diapers-accent); }
  .history-sum-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
    background: #fff;
  }
  .history-sum-icon img,
  .history-icon-img {
    width: 120%;
    height: 120%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
  }
  .history-sum-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 3px;
  }
  .history-sum-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
  }
  .history-sum-body .day-sum-val {
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
    white-space: normal;
  }
  .history-sum-body .day-sum-sub {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    white-space: normal;
    line-height: 1.35;
  }

  /* Empty State */
  .history-empty-card {
    text-align: center;
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 6px;
  }
  .history-empty-icon {
    font-size: 38px;
    margin-bottom: 10px;
    opacity: 0.85;
  }
  .history-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 4px;
  }
  .history-empty-sub {
    font-size: 13.5px;
    color: var(--muted);
    margin-bottom: 18px;
    max-width: 280px;
  }
  .history-empty-btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 999px;
  }

  /* All Days Mode */
  .history-alldays-card {
    padding: 14px 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  }
  .history-alldays-card:hover {
    transform: translateY(-1px);
    border-color: var(--primary, #2563eb);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  }
  .history-alldays-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
  }
  .history-alldays-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
  }
  .history-alldays-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary, #2563eb);
  }
  .history-alldays-summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .history-mini-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    background: var(--bg);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  }
  .history-mini-chip.feeds {
    background: var(--chip-feeds-bg);
    border-color: var(--chip-feeds-border);
  }
  .history-mini-chip.sleep {
    background: var(--chip-sleep-bg);
    border-color: var(--chip-sleep-border);
  }
  .history-mini-chip.diapers {
    background: var(--chip-diapers-bg);
    border-color: var(--chip-diapers-border);
  }
  .mini-chip-img {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  }

  /* Month Calendar Modal */
  .history-month-modal {
    border: none;
    border-radius: 20px;
    padding: 0;
    background: var(--card);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
    width: 90%;
    max-width: 360px;
    color: var(--ink);
  }
  .history-month-modal::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }
  .history-month-modal-inner {
    padding: 18px 16px 14px;
  }
  .history-month-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
  }
  .history-month-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
  }
  .month-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
  }
  .history-month-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--bg-deep, rgba(0, 0, 0, 0.06));
    cursor: pointer;
    font-size: 14px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .history-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
  }
  .month-grid-head {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    padding: 6px 0;
  }
  .month-grid-day {
    aspect-ratio: 1;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
    transition: all 0.12s ease;
  }
  .month-grid-day:hover:not(.future):not(.empty):not(.selected) {
    background: var(--bg-hover, rgba(0, 0, 0, 0.04));
  }
  .month-grid-day.empty {
    cursor: default;
  }
  .month-grid-day.future {
    opacity: 0.25;
    cursor: not-allowed;
  }
  .month-grid-day.today:not(.selected) {
    border: 1.5px solid var(--primary, #2563eb);
  }
  .month-grid-day.selected {
    background: var(--primary, #2563eb);
    color: #ffffff;
    font-weight: 700;
  }
  .month-day-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary, #2563eb);
    position: absolute;
    bottom: 3px;
  }
  .month-grid-day.selected .month-day-dot {
    background: #ffffff;
  }
  .history-month-legend {
    margin-top: 14px;
    font-size: 11.5px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
  }
  .month-legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary, #2563eb);
    display: inline-block;
  }

  /* ==========================================================================
     In-App Direct Feedback System Styles
     ========================================================================== */
  .feedback-header-btn {
    background: rgba(236, 72, 153, 0.12);
    color: #db2777;
    border-color: rgba(236, 72, 153, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
  }
  .feedback-header-btn:hover {
    background: rgba(236, 72, 153, 0.2);
    border-color: rgba(236, 72, 153, 0.4);
  }
  :root.dark .feedback-header-btn {
    background: rgba(244, 114, 182, 0.16);
    color: #f472b6;
    border-color: rgba(244, 114, 182, 0.3);
  }

  @media (max-width: 440px) {
    .feedback-btn-label {
      display: none;
    }
  }

  .feedback-form {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .feedback-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
  }

  .feedback-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
  }

  .feedback-label-row .feedback-label {
    margin-bottom: 0;
  }

  .feedback-char-count {
    font-size: 11.5px;
    color: var(--muted);
    font-family: ui-monospace, monospace;
  }
  .feedback-char-count.near-limit {
    color: var(--danger, #ef4444);
    font-weight: 700;
  }

  .required-star {
    color: var(--danger, #ef4444);
    font-weight: 700;
  }

  /* Category Selection Chips */
  .feedback-category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
  }

  .feedback-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    background: var(--card-hover, rgba(0, 0, 0, 0.03));
    border: 1px solid var(--line);
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .feedback-chip:hover {
    background: var(--row-hover);
    border-color: var(--primary);
  }

  .feedback-chip.active {
    background: rgba(236, 72, 153, 0.12);
    color: #db2777;
    border-color: #ec4899;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(236, 72, 153, 0.15);
  }

  :root.dark .feedback-chip.active {
    background: rgba(244, 114, 182, 0.18);
    color: #f472b6;
    border-color: #f472b6;
  }

  /* Sentiment Rating Selector */
  .feedback-sentiment-group {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 4px;
  }

  .feedback-sentiment-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 12px;
    background: var(--card-hover, rgba(0, 0, 0, 0.03));
    border: 1.5px solid var(--line);
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .sentiment-emoji {
    font-size: 22px;
    line-height: 1;
    transition: transform 0.18s ease;
  }

  .sentiment-label {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100%;
  }

  .feedback-sentiment-btn:hover {
    background: var(--row-hover);
    border-color: var(--primary);
    color: var(--ink);
  }

  .feedback-sentiment-btn:hover .sentiment-emoji {
    transform: scale(1.18);
  }

  .feedback-sentiment-btn.active {
    background: rgba(57, 73, 171, 0.12);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 700;
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(57, 73, 171, 0.15);
  }

  :root.dark .feedback-sentiment-btn.active {
    background: rgba(79, 70, 229, 0.22);
    border-color: #818cf8;
    color: #a5b4fc;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
  }

  /* Diagnostic Info Box */
  .feedback-diagnostics-card {
    background: var(--card-hover, rgba(0, 0, 0, 0.02));
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    margin-top: 2px;
  }

  .feedback-diag-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
  }

  .feedback-diag-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
  }

  .feedback-diag-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 14px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--line);
    font-size: 11.5px;
    color: var(--muted);
  }

  @media (max-width: 500px) {
    .feedback-diag-details {
      grid-template-columns: 1fr;
    }
  }

  .diag-item {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .diag-k {
    font-weight: 600;
    color: var(--ink);
  }

  .diag-v {
    font-family: ui-monospace, monospace;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Status message */
  .feedback-status-msg {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
  }

  .feedback-status-msg.error {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.3);
  }

  :root.dark .feedback-status-msg.error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
  }

  .feedback-status-msg.warning {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.3);
  }

  :root.dark .feedback-status-msg.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.4);
  }

  .feedback-status-msg.success {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.3);
  }

  /* Success Card View */
  .feedback-success-card {
    text-align: center;
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: feedbackSuccessPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  @keyframes feedbackSuccessPop {
    0% { transform: scale(0.92); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
  }

  .feedback-success-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 4px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1));
  }

  .feedback-success-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
  }

  .feedback-success-desc {
    font-size: 14px;
    color: var(--muted);
    max-width: 360px;
    margin: 0 auto 12px;
    line-height: 1.5;
  }

  .feedback-success-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
  }

  /* Logged In Account Pill */
  .feedback-account-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--card-hover, rgba(0, 0, 0, 0.03));
    border: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--muted);
  }

  .feedback-account-pill strong {
    color: var(--ink);
  }

  .feedback-account-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
  }

  /* Modal Specific Header */
  .feedback-dlg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }

  .feedback-dlg-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .feedback-dlg-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
  }

  /* PWA Install Smart Banner */
  .install-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin: 8px 0 12px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(57, 73, 171, 0.14) 100%);
    border: 1px solid rgba(79, 70, 229, 0.22);
    border-radius: 12px;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .install-bar.hidden {
    display: none !important;
  }
  .install-bar-content {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
  }
  .install-bar-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    overflow: hidden;
    flex-shrink: 0;
    background: #1f2a44;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  }
  .install-bar-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .install-bar-text {
    min-width: 0;
  }
  .install-bar-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.25;
  }
  .install-bar-subtitle {
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .install-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .install-bar-btn {
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 700;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(57, 73, 171, 0.25);
    transition: opacity 0.15s ease, transform 0.1s ease;
  }
  .install-bar-btn:hover {
    background: var(--primary-hover);
  }
  .install-bar-btn:active {
    transform: scale(0.97);
  }
  .install-bar-dismiss {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 14px;
    padding: 6px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease;
  }
  .install-bar-dismiss:hover {
    color: var(--ink);
    background: rgba(0, 0, 0, 0.06);
  }
  :root.dark .install-bar {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.16) 0%, rgba(30, 41, 59, 0.45) 100%);
    border-color: rgba(79, 70, 229, 0.32);
  }
  :root.dark .install-bar-dismiss:hover {
    background: rgba(255, 255, 255, 0.08);
  }
  @media (max-width: 480px) {
    .install-bar-subtitle {
      white-space: normal;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
    }
  }

  /* Terms, Liability & Legal Consent Styles */
  .auth-social-legal-notice {
    font-size: 11.5px;
    color: var(--muted);
    text-align: center;
    line-height: 1.4;
    margin: 6px 0 10px;
    padding: 0 4px;
  }
  .auth-social-legal-notice a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 500;
  }

  .auth-terms-consent {
    margin: 14px 0 6px;
    padding: 10px 12px;
    background: rgba(2, 132, 199, 0.04);
    border: 1px solid rgba(2, 132, 199, 0.15);
    border-radius: 10px;
  }
  :root.dark .auth-terms-consent {
    background: rgba(2, 132, 199, 0.08);
    border-color: rgba(2, 132, 199, 0.25);
  }
  .auth-terms-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
  }
  .auth-terms-label input[type="checkbox"] {
    margin-top: 2px;
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
  }
  .auth-terms-label a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 600;
  }

  .micro-legal-notice {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.35;
    margin-top: 6px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.025);
    border-radius: 6px;
  }
  :root.dark .micro-legal-notice {
    background: rgba(255, 255, 255, 0.04);
  }

  /* Disclaimer Modal Dialog */
  dialog#dlgMedicalDisclaimer:not([open]),
  .disclaimer-dialog:not([open]) {
    display: none !important;
  }
  .disclaimer-dialog {
    max-width: 480px;
    width: 92%;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 100002 !important;
  }
  dialog#dlgMedicalDisclaimer[open],
  .disclaimer-dialog[open] {
    display: block !important;
    z-index: 100002 !important;
  }
  .disclaimer-box {
    padding: 24px 20px 20px;
  }
  .disclaimer-header {
    text-align: center;
    margin-bottom: 18px;
  }
  .disclaimer-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #b45309;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
  }
  :root.dark .disclaimer-badge {
    background: rgba(245, 158, 11, 0.22);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fcd34d;
  }
  .disclaimer-header h2 {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 6px;
    color: var(--ink);
  }
  .disclaimer-subtitle {
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
  }
  .disclaimer-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
  }
  .disclaimer-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.025);
    border: 1px solid var(--line);
    border-radius: 12px;
    transition: transform 0.15s ease, background 0.15s ease;
  }
  :root.dark .disclaimer-card {
    background: rgba(255, 255, 255, 0.035);
  }
  .disclaimer-card:hover {
    background: rgba(0, 0, 0, 0.04);
  }
  :root.dark .disclaimer-card:hover {
    background: rgba(255, 255, 255, 0.06);
  }
  .disclaimer-card-icon {
    font-size: 22px;
    line-height: 1.2;
    flex-shrink: 0;
  }
  .disclaimer-card-body h4 {
    margin: 0 0 3px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
  }
  .disclaimer-card-body p {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--muted);
  }
  .disclaimer-card-body strong {
    color: var(--ink);
  }
  .disclaimer-legal-agree-text {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    line-height: 1.45;
    margin-bottom: 16px;
    padding: 0 6px;
  }
  .disclaimer-legal-agree-text a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 600;
  }

  /* =========================================================
     In-App Legal Document Viewer Modal (Terms & Privacy)
     ========================================================= */
  dialog#dlgLegalViewer:not([open]),
  .legal-viewer-dialog:not([open]) {
    display: none !important;
  }
  .legal-viewer-dialog {
    max-width: 640px;
    width: 94%;
    height: 90vh;
    height: calc(100dvh - 36px);
    max-height: 840px;
    padding: 0;
    border-radius: 20px;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--line);
    background: var(--card);
    z-index: 100002 !important;
  }
  dialog#dlgLegalViewer[open],
  .legal-viewer-dialog[open] {
    display: flex !important;
    z-index: 100002 !important;
  }

  .legal-viewer-box {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
  }

  .legal-viewer-header {
    padding: 16px 20px 12px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
  }

  .legal-viewer-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
  }

  .btn-legal-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(2, 132, 199, 0.1);
    color: var(--primary, #0284c7);
    border: 1px solid rgba(2, 132, 199, 0.25);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .btn-legal-back:hover {
    background: var(--primary, #0284c7);
    color: #fff;
  }
  :root.dark .btn-legal-back {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.3);
  }
  :root.dark .btn-legal-back:hover {
    background: #38bdf8;
    color: #0f172a;
  }

  .btn-legal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--line);
    border-radius: 50%;
    font-size: 19px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s ease;
  }
  :root.dark .btn-legal-close {
    background: rgba(255, 255, 255, 0.08);
  }
  .btn-legal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
  }

  .legal-viewer-header h2 {
    font-size: 19px;
    font-weight: 800;
    margin: 0 0 3px;
    color: var(--ink);
    letter-spacing: -0.3px;
  }

  .legal-viewer-subtitle {
    font-size: 12.5px;
    line-height: 1.4;
    margin: 0 0 12px;
    color: var(--muted);
  }

  .legal-viewer-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.04);
    padding: 3px;
    border-radius: 12px;
    gap: 4px;
    border: 1px solid var(--line);
  }
  :root.dark .legal-viewer-tabs {
    background: rgba(255, 255, 255, 0.05);
  }

  .legal-viewer-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-align: center;
  }
  .legal-viewer-tab:hover {
    color: var(--ink);
  }
  .legal-viewer-tab.active {
    background: var(--card);
    color: var(--primary, #0284c7);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    font-weight: 700;
  }
  :root.dark .legal-viewer-tab.active {
    background: rgba(255, 255, 255, 0.12);
    color: #38bdf8;
  }

  .legal-viewer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 20px 24px;
    overscroll-behavior: contain;
  }

  .legal-doc-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .legal-doc-block {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
  }
  :root.dark .legal-doc-block {
    background: rgba(255, 255, 255, 0.025);
  }

  .legal-doc-block h4 {
    font-size: 13.5px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--ink);
  }

  .legal-doc-block p {
    font-size: 12.5px;
    line-height: 1.5;
    margin: 0 0 8px;
    color: var(--ink);
  }
  .legal-doc-block p:last-child {
    margin-bottom: 0;
  }

  .legal-doc-block ul {
    margin: 6px 0 0 16px;
    padding: 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--ink);
  }
  .legal-doc-block li {
    margin-bottom: 6px;
  }

  .legal-viewer-footer {
    padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px));
    background: var(--card);
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
  }

  .legal-viewer-done-btn {
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 10px;
    flex: 1;
    max-width: 220px;
  }

  .legal-ext-link {
    font-size: 12.5px;
    color: var(--muted);
    text-decoration: underline;
    white-space: nowrap;
  }
  .legal-ext-link:hover {
    color: var(--primary);
  }

  /* Mobile screen optimization: full height & proper inset padding so action buttons are never cut off */
  @media (max-width: 600px) {
    .legal-viewer-dialog {
      width: 100% !important;
      max-width: 100% !important;
      height: 100dvh !important;
      height: 100svh !important;
      max-height: 100dvh !important;
      border-radius: 0 !important;
      border: none !important;
      margin: 0 !important;
      inset: 0 !important;
      z-index: 100002 !important;
    }
    .legal-viewer-dialog .legal-viewer-box {
      height: 100% !important;
      max-height: 100% !important;
    }
    .legal-viewer-dialog .legal-viewer-header {
      padding-top: calc(14px + env(safe-area-inset-top, 0px)) !important;
    }
    .legal-viewer-dialog .legal-viewer-footer {
      padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .disclaimer-dialog {
      width: 94% !important;
      max-height: calc(100dvh - 24px) !important;
      margin: auto auto !important;
      z-index: 100002 !important;
    }
    .disclaimer-box {
      padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    }
  }

