  #help-bubble-btn:hover { transform: scale(1.05); box-shadow: 0 8px 24px rgba(0,0,0,.22); }
  #help-input:focus      { border-color: var(--primary) !important; }
  #help-send-btn:disabled { opacity: .5; cursor: not-allowed; }
  .help-msg-user {
    align-self: flex-end; background: var(--primary); color: white;
    padding: 8px 12px; border-radius: 14px 14px 2px 14px; max-width: 85%;
    font-size: 13px; line-height: 1.45; word-wrap: break-word;
  }
  .help-msg-ai {
    align-self: flex-start; background: var(--bg); border: 1px solid var(--border);
    padding: 10px 14px; border-radius: 14px 14px 14px 2px; max-width: 92%;
    font-size: 13px; line-height: 1.5; color: var(--text); word-wrap: break-word;
  }
  .help-msg-ai p:first-child { margin-top: 0; }
  .help-msg-ai p:last-child  { margin-bottom: 0; }
  .help-msg-ai ul, .help-msg-ai ol { margin: 6px 0; padding-left: 20px; }
  .help-msg-ai code { background: var(--surface); padding: 1px 5px; border-radius: 3px; font-size: 12px; }
  .help-sources {
    margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border);
    font-size: 11px; color: var(--muted);
  }
  .help-sources strong { color: var(--text); font-weight: 600; }
  .help-feedback {
    margin-top: 8px; display: flex; gap: 6px; align-items: center;
    font-size: 11px; color: var(--muted);
  }
  .help-fb-btn {
    background: none; border: 1px solid var(--border); border-radius: 6px;
    padding: 2px 8px; font-size: 12px; cursor: pointer; color: var(--muted);
  }
  .help-fb-btn:hover { background: var(--surface); }
  .help-fb-btn.selected { background: var(--primary); color: white; border-color: var(--primary); }
  .help-thinking {
    display: inline-flex; gap: 4px; padding: 10px 14px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 14px 14px 14px 2px;
    align-self: flex-start;
  }
  .help-thinking span {
    width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
    animation: helpDot 1.2s infinite ease-in-out;
  }
  .help-thinking span:nth-child(2) { animation-delay: .15s; }
  .help-thinking span:nth-child(3) { animation-delay: .30s; }
  @keyframes helpDot {
    0%, 80%, 100% { opacity: .3; transform: translateY(0); }
    40%           { opacity: 1;  transform: translateY(-3px); }
  }
  @media (max-width: 480px) {
    #help-panel {
      right: 10px !important; bottom: 10px !important;
      width: calc(100vw - 20px) !important; height: calc(100vh - 80px) !important;
    }
  }

  /* ============================================================
     TODAY PAGE (Phase B.5)
     ============================================================ */
  .td-greeting-wrap { margin-bottom: 18px; }
  .td-greeting { font-size: 26px; font-weight: 600; margin: 0 0 4px 0; color: #111827; line-height: 1.2; }
  .td-subtitle { font-size: 14px; color: #6b7280; }
  .td-subtitle .td-dot { margin: 0 6px; }

  .td-banner-money {
    background: linear-gradient(180deg, #185FA5 0%, #0C447C 100%);
    border-radius: 14px;
    padding: 24px 26px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 4px 14px rgba(24, 95, 165, 0.20);
    transition: box-shadow .15s ease;
  }
  .td-banner-left { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
  .td-banner-icon {
    font-size: 36px; line-height: 1;
    width: 64px; height: 64px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .td-banner-eyebrow { font-size: 11px; color: #B5D4F4; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 4px; }
  .td-banner-headline { font-size: 20px; font-weight: 600; color: #FFFFFF; line-height: 1.2; margin-bottom: 4px; }
  .td-banner-sub { font-size: 12px; color: #B5D4F4; }
  .td-money-btn {
    background: #FFFFFF; color: #185FA5; border: none;
    font-size: 17px; font-weight: 600;
    padding: 16px 28px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    box-shadow: 0 2px 0 rgba(0,0,0,0.10);
  }
  .td-money-btn:hover { background: #F3F4F6; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
  .td-money-btn:active { transform: translateY(0); box-shadow: 0 1px 0 rgba(0,0,0,0.10); background: #E5E7EB; }

  .td-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 12px;
  }
  .td-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
  .td-card-title { font-size: 15px; font-weight: 600; color: #111827; }
  .td-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }

  .td-pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; }
  .td-pill-danger { background: #fee2e2; color: #b91c1c; }
  .td-pill-info   { background: #dbeafe; color: #185FA5; }
  .td-pill-muted  { background: #f3f4f6; color: #6b7280; }

  .td-empty { font-size: 13px; color: #9ca3af; padding: 8px 0; font-style: italic; }

  .td-msg-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: #F9FAFB;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.15s ease;
    cursor: pointer;
  }
  .td-msg-row:last-child { margin-bottom: 0; }
  .td-msg-row:hover { background: #F3F4F6; transform: translateX(2px); }
  .td-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #DBEAFE; color: #185FA5;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
    flex-shrink: 0;
  }
  .td-msg-body { flex: 1; min-width: 0; }
  .td-msg-name { font-weight: 600; font-size: 15px; color: #111827; }
  .td-msg-preview { color: #6b7280; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
  .td-msg-time { font-size: 11px; color: #9ca3af; flex-shrink: 0; }
  .td-btn-reply {
    background: #185FA5; color: #FFFFFF; border: none;
    font-size: 13px; font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 0 rgba(0,0,0,0.10);
    flex-shrink: 0;
  }
  .td-btn-reply:hover { background: #0C447C; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
  .td-btn-reply:active { background: #042C53; transform: translateY(0); box-shadow: none; }

  .td-cust-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid #F3F4F6;
    cursor: pointer;
    transition: background 0.15s ease;
    border-radius: 8px;
    margin: 0 -4px;
  }
  .td-cust-row:last-of-type { border-bottom: none; }
  .td-cust-row:hover { background: #F9FAFB; }
  .td-cust-body { flex: 1; min-width: 0; }
  .td-cust-name { font-weight: 600; font-size: 15px; color: #111827; }
  .td-cust-meta { color: #6b7280; font-size: 12px; margin-top: 2px; }
  .td-btn-call {
    background: #15803D; color: #FFFFFF; border: none;
    font-size: 13px; font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 4px;
    transition: all 0.15s ease;
    box-shadow: 0 1px 0 rgba(0,0,0,0.10);
    flex-shrink: 0;
  }
  .td-btn-call:hover { background: #166534; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
  .td-btn-call:active { background: #14532D; transform: translateY(0); box-shadow: none; }
  .td-no-phone { font-size: 12px; color: #9ca3af; flex-shrink: 0; }
  .td-view-all { display: block; margin-top: 10px; font-size: 13px; color: #185FA5; font-weight: 600; text-decoration: none; }

  .td-sched-row {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 4px;
    border-bottom: 1px solid #F3F4F6;
    cursor: pointer;
    transition: background 0.15s ease;
    border-radius: 8px;
    margin: 0 -4px;
  }
  .td-sched-row:last-of-type { border-bottom: none; }
  .td-sched-row:hover { background: #F9FAFB; }
  .td-sched-time { font-weight: 700; color: #185FA5; font-size: 17px; min-width: 84px; }
  .td-sched-body { flex: 1; min-width: 0; }
  .td-sched-name { font-weight: 600; font-size: 15px; color: #111827; }
  .td-sched-svc { color: #6b7280; font-size: 12px; margin-top: 2px; }
  .td-sched-chev { width: 18px; height: 18px; color: #9ca3af; flex-shrink: 0; }

  .td-quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
  .td-quick-btn {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    padding: 16px 8px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .td-quick-btn:hover { background: #F9FAFB; border-color: #185FA5; transform: translateY(-1px); }
  .td-quick-btn:active { transform: translateY(0); background: #F3F4F6; }
  .td-quick-icn { font-size: 26px; line-height: 1; }
  .td-quick-lbl { font-size: 13px; font-weight: 600; color: #111827; text-align: center; }

  .td-inv-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 4px;
    border-bottom: 1px solid #F3F4F6;
    cursor: pointer;
    transition: background 0.15s ease;
    border-radius: 8px;
    margin: 0 -4px;
  }
  .td-inv-row:last-of-type { border-bottom: none; }
  .td-inv-row:hover { background: #F9FAFB; }
  .td-inv-num { font-weight: 600; font-size: 15px; color: #111827; }
  .td-inv-meta { color: #6b7280; font-size: 12px; margin-top: 2px; }
  .td-inv-overdue { color: #b91c1c; font-weight: 600; }
  .td-inv-amt { font-weight: 700; font-size: 16px; color: #111827; }

  .td-stat-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
  .td-stat-lbl { color: #6b7280; }
  .td-stat-val { font-weight: 600; color: #111827; }

  /* ============================================================
     MOBILE BOTTOM TAB BAR (Phase B.5)
     ============================================================ */
  .mobile-tabs {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #FFFFFF;
    border-top: 1px solid #E5E7EB;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0));
    z-index: 50;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
  }
  .mobile-tab {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    background: none;
    border: none;
    color: #6b7280;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease;
  }
  .mobile-tab:hover { background: #F9FAFB; }
  .mobile-tab:active { background: #F3F4F6; }
  .mobile-tab svg { width: 22px; height: 22px; flex-shrink: 0; }
  .mobile-tab .mt-lbl { font-size: 11px; font-weight: 500; }
  .mobile-tab.active { color: #185FA5; }
  .mobile-tab .mt-badge {
    position: absolute;
    top: 2px; right: 30%;
    background: #DC2626; color: #FFFFFF;
    font-size: 10px; font-weight: 700;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
  }

  #mobile-burger {
    display: none;
    background: none; border: none;
    padding: 8px;
    cursor: pointer;
    color: #111827;
  }
  #mobile-burger svg { width: 24px; height: 24px; }

  @media (max-width: 768px) {
    .mobile-tabs { display: flex; }
    #mobile-burger { display: inline-flex; }
    /* Hide desktop sidebar on mobile until burger toggles */
    aside.sidebar { display: none; }
    aside.sidebar:not(.sidebar-hidden) {
      display: block;
      position: fixed; top: 0; left: 0; bottom: 0;
      width: 80%; max-width: 300px;
      z-index: 100;
      background: #FFFFFF;
      box-shadow: 2px 0 8px rgba(0,0,0,.15);
      overflow-y: auto;
    }
    main.main { padding-bottom: 80px; } /* leave room for bottom tabs */

    /* Single column on mobile for grid sections */
    .td-grid-2 { grid-template-columns: 1fr; }
    .td-quick-grid { grid-template-columns: repeat(2, 1fr); }

    /* Banner stacks button below content on mobile */
    .td-banner-money { flex-direction: column; align-items: stretch; }
    .td-banner-money .td-money-btn { width: 100%; }

    /* Slightly smaller greeting */
    .td-greeting { font-size: 22px; }
  }

/* ===========================================================
   Template edit modal styles (extracted from index.html)
   =========================================================== */
    @keyframes pwaBannerIn {
      from { transform: translateY(20px); opacity: 0; }
      to   { transform: translateY(0);    opacity: 1; }
    }
    /* Template edit modal: toolbar button hover/active + active tab styling */
    .tpl-tb-btn:hover { background: var(--border) !important; }
    .tpl-tb-btn.active { background: var(--border) !important; border-color: var(--primary) !important; }
    .tpl-edit-tab.active { color: var(--primary) !important; border-bottom-color: var(--primary) !important; }
    #tpl-edit-body:focus { border-color: var(--primary) !important; }
    #tpl-edit-body p:first-child { margin-top: 0; }
    #tpl-edit-body p:last-child  { margin-bottom: 0; }
    #tpl-edit-body a { color: var(--primary); }
