    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    :root {
      --bg:#F0F2F8; --surface:#fff; --surface2:#F7F8FC; --border:#E8EBF2;
      --text:#1A202C; --text2:#718096; --text3:#A0AEC0;
      --accent:#6366F1; --accent2:#8B5CF6;
    }
    html[data-dark] {
      --bg:#0D0F1A; --surface:#161927; --surface2:#1C2033; --border:#252A42;
      --text:#E2E8F0; --text2:#8896A5; --text3:#596577;
      --accent:#818CF8; --accent2:#A78BFA;
    }
    body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; transition: background 0.2s, color 0.2s; }
    a { color: var(--accent); } button { cursor: pointer; }
    .screen { display: none; } .screen.active { display: flex; }
    #setup-screen, #auth-screen { flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 2rem; background: var(--bg); }
    .auth-card { background: var(--surface); border-radius: 20px; padding: 2.5rem; max-width: 500px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,0.1); border: 1px solid var(--border); }
    .brand { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 2rem; justify-content: center; }
    .brand-icon { width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg,var(--accent),var(--accent2)); display: flex; align-items: center; justify-content: center; font-size: 22px; }
    .brand-name { font-size: 1.5rem; font-weight: 800; }
    .auth-card h1 { font-size: 1.375rem; font-weight: 700; margin-bottom: 0.5rem; text-align: center; }
    .auth-card .sub { color: var(--text2); font-size: 0.875rem; text-align: center; line-height: 1.6; margin-bottom: 2rem; }
    .form-group { margin-bottom: 1.25rem; }
    .form-group label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; }
    .form-group input, .form-group textarea, .form-group select { width: 100%; padding: 0.75rem 1rem; border: 1.5px solid var(--border); border-radius: 10px; font-size: 0.875rem; outline: none; transition: border-color 0.2s; font-family: inherit; resize: none; background: var(--surface); color: var(--text); }
    .form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--accent); }
    .form-group .hint { font-size: 0.75rem; color: var(--text3); margin-top: 0.3rem; }
    .btn { padding: 0.75rem 1.5rem; border-radius: 10px; border: none; font-size: 0.875rem; font-weight: 600; transition: all 0.2s; }
    .btn-primary { background: linear-gradient(135deg,var(--accent),var(--accent2)); color: #fff; width: 100%; }
    .btn-primary:hover { opacity: 0.92; transform: translateY(-1px); }
    .btn-secondary { background: var(--surface); color: var(--accent); border: 1.5px solid var(--accent); width: 100%; }
    .btn-secondary:hover { background: #EEF2FF; }
    .google-btn { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 0.875rem 1.5rem; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 0.9375rem; font-weight: 500; width: 100%; transition: all 0.2s; color: var(--text); }
    .google-btn:hover { border-color: var(--accent); }
    .divider { height: 1px; background: var(--border); margin: 1.5rem 0; }
    .setup-steps { margin-bottom: 1.75rem; }
    .setup-step { display: flex; gap: 1rem; margin-bottom: 0.875rem; }
    .step-num { width: 26px; height: 26px; border-radius: 50%; background: #EEF2FF; color: var(--accent); font-size: 0.75rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
    .step-title { font-size: 0.8125rem; font-weight: 600; margin-bottom: 0.2rem; }
    .step-desc { font-size: 0.78rem; color: var(--text2); line-height: 1.5; }
    code { background: var(--surface2); padding: 0.1rem 0.4rem; border-radius: 4px; font-family: monospace; font-size: 0.8em; }
    #app-screen { flex-direction: row; min-height: 100vh; }
    .sidebar { width: 220px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 1.25rem 1rem; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 10; }
    .sidebar-brand { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 2rem; padding: 0 0.25rem; }
    .sidebar-brand .icon { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg,var(--accent),var(--accent2)); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
    .sidebar-brand .name { font-size: 0.9375rem; font-weight: 800; }
    .nav-section { margin-bottom: 1.5rem; }
    .nav-label { font-size: 0.65rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.4rem; padding: 0 0.5rem; }
    .nav-item { display: flex; align-items: center; gap: 0.65rem; padding: 0.575rem 0.625rem; border-radius: 8px; color: var(--text2); font-size: 0.8125rem; font-weight: 500; transition: all 0.15s; margin-bottom: 0.15rem; border: none; background: transparent; width: 100%; text-align: left; }
    .nav-item:hover { background: var(--surface2); color: var(--text); }
    .nav-item.active { background: #EEF2FF; color: var(--accent); font-weight: 600; }
    html[data-dark] .nav-item.active { background: #1E2340; }
    .nav-icon { font-size: 15px; flex-shrink: 0; }
    .sidebar-footer { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.5rem; }
    .dark-toggle { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.625rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); font-size: 0.75rem; font-weight: 500; color: var(--text2); width: 100%; transition: all 0.15s; }
    .dark-toggle:hover { border-color: var(--accent); color: var(--accent); }
    .user-card { display: flex; align-items: center; gap: 0.625rem; padding: 0.625rem 0.5rem; background: var(--surface2); border-radius: 10px; cursor: pointer; transition: background 0.15s; }
    .user-card:hover { background: #EEF2FF; }
    html[data-dark] .user-card:hover { background: #1E2340; }
    .avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg,var(--accent),var(--accent2)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.7rem; font-weight: 700; overflow: hidden; }
    .avatar img { width: 100%; height: 100%; object-fit: cover; }
    .user-name-text { font-size: 0.75rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .user-email-text { font-size: 0.65rem; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .main { margin-left: 220px; flex: 1; padding: 2rem; overflow-x: hidden; }
    .tab-content { display: none; } .tab-content.active { display: block; }
    .page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem; }
    .page-header h2 { font-size: 1.375rem; font-weight: 700; }
    .page-header .subtitle { font-size: 0.8125rem; color: var(--text3); margin-top: 0.2rem; }
    .date-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
    .view-btns { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
    .view-btn { padding: 0.5rem 0.875rem; border: none; background: transparent; font-size: 0.78rem; font-weight: 500; color: var(--text2); transition: all 0.15s; }
    .view-btn.active { background: var(--accent); color: #fff; }
    .view-btn:hover:not(.active) { background: var(--surface2); color: var(--text); }
    .nav-row { display: flex; align-items: center; gap: 0.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 0.25rem; }
    .nav-arrow { width: 28px; height: 28px; border-radius: 6px; border: none; background: transparent; color: var(--text2); font-size: 13px; transition: all 0.15s; }
    .nav-arrow:hover { background: var(--surface2); color: var(--text); }
    /* ── Polish: shared utilities for new dashboard components ── */
    .tt-tile { background: var(--surface2); border-radius: 10px; padding: 0.875rem; transition: transform 0.12s, box-shadow 0.12s; }
    .tt-tile-hover:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
    .tt-caption { font-size: 0.65rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; }
    .tt-stat-num { font-size: 1.4rem; font-weight: 700; line-height: 1.05; color: var(--text); }
    .tt-stat-sub { font-size: 0.7rem; color: var(--text3); margin-top: 0.25rem; }
    /* Mood emoji buttons */
    .mood-btn { border: none; border-radius: 8px; padding: 0.4rem 0.55rem; cursor: pointer; font-size: 1.1rem; background: var(--surface2); color: var(--text); transition: all 0.15s; }
    .mood-btn:hover { background: var(--border); }
    .mood-btn.active { background: var(--accent); color: #fff; transform: scale(1.05); }
    /* Mood note input */
    .mood-note { flex: 1; min-width: 200px; padding: 0.55rem 0.75rem; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.82rem; background: var(--surface2); color: var(--text); outline: none; font-family: inherit; transition: border-color 0.15s; }
    .mood-note:focus { border-color: var(--accent); }
    .mood-note::placeholder { color: var(--text3); }
    /* Habit tile */
    .habit-tile { background: var(--surface2); border: 1.5px solid transparent; border-radius: 10px; padding: 0.75rem; cursor: pointer; transition: all 0.15s; }
    .habit-tile:hover { border-color: var(--border); transform: translateY(-1px); }
    .habit-tile.done { background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.55); }
    html[data-dark] .habit-tile.done { background: rgba(16,185,129,0.18); }
    .habit-tile-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.4rem; }
    .habit-tile-actions { display: flex; gap: 0.1rem; opacity: 0.55; transition: opacity 0.15s; }
    .habit-tile:hover .habit-tile-actions { opacity: 1; }
    .habit-icon-btn { background: transparent; border: none; color: var(--text3); cursor: pointer; padding: 0.15rem 0.35rem; line-height: 1; border-radius: 5px; font-size: 0.78rem; }
    .habit-icon-btn:hover { background: var(--border); color: var(--text); }
    .habit-name { font-size: 0.78rem; font-weight: 600; color: var(--text); margin-bottom: 0.25rem; line-height: 1.3; word-break: break-word; }
    .habit-status { font-size: 0.68rem; color: var(--text3); }
    .habit-status.done { color: #10B981; font-weight: 700; }
    .habit-streak { font-size: 0.68rem; color: #F59E0B; font-weight: 700; }
    /* Today card — left accent stripe */
    #today-card { border-left: 3px solid var(--accent); background: var(--surface) !important; }
    /* Best Days rank chip */
    .bd-rank { font-size: 1.4rem; font-weight: 800; color: #F59E0B; width: 36px; text-align: center; flex-shrink: 0; }
    /* Suggest button on Needs Tagging */
    .suggest-btn { border-radius: 8px; padding: 0.42rem 0.7rem; font-size: 0.72rem; font-weight: 700; cursor: pointer; white-space: nowrap; transition: all 0.15s; margin-right: 0.4rem; }
    .suggest-btn:hover { transform: translateY(-1px); }
    /* ── Utility classes (extracted from repeated inline styles) ── */
    .card-meta { font-size: 0.72rem; color: var(--text3); }
    .card-desc { font-size: 0.78rem; color: var(--text2); margin-bottom: 1rem; line-height: 1.5; }
    .btn-auto { width: auto !important; }
    .card-spacer-lg { margin-top: 1.5rem; }
    .card-spacer-md { margin-bottom: 1rem; }
    .empty-pad { text-align: center; padding: 2rem 1rem; color: var(--text3); }
    .empty-pad .empty-icon-lg { font-size: 2rem; margin-bottom: 0.5rem; }
    .empty-pad .empty-title { font-size: 0.95rem; font-weight: 600; color: var(--text2); margin-bottom: 0.4rem; }
    .empty-pad .empty-sub { font-size: 0.8rem; }

    /* ── Mobile: hamburger sidebar + reflow ── */
    .mobile-menu-btn { display: none; position: fixed; top: max(0.75rem, env(safe-area-inset-top, 0.75rem)); left: max(0.75rem, env(safe-area-inset-left, 0.75rem)); z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; width: 44px; height: 44px; align-items: center; justify-content: center; cursor: pointer; font-size: 1.2rem; color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,0.12); -webkit-tap-highlight-color: transparent; }
    .mobile-menu-btn:active { transform: scale(0.96); }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 30; -webkit-tap-highlight-color: transparent; }
    .sidebar-overlay.show { display: block; }
    @media (max-width: 768px) {
      .mobile-menu-btn { display: flex; }
      .sidebar { transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: 4px 0 16px rgba(0,0,0,0.18); z-index: 40; }
      .sidebar.show { transform: translateX(0); }
      .main { margin-left: 0 !important; padding: 4rem 1rem 2rem !important; }
      .page-header { flex-direction: column; align-items: stretch !important; }
      .page-header h2 { font-size: 1.15rem !important; }
      .date-controls { flex-wrap: wrap; gap: 0.4rem !important; }
      .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.6rem !important; }
      .stat-card { padding: 0.875rem !important; }
      .stat-value { font-size: 1.5rem !important; }
      .charts-row { grid-template-columns: 1fr !important; }
      .card { padding: 1rem !important; }
      .card-header { flex-wrap: wrap; gap: 0.4rem; }
      .card-title { font-size: 0.95rem !important; }
      #today-tiles, #health-kpi-grid, #health-stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.5rem !important; }
      #habits-tiles { grid-template-columns: repeat(2, 1fr) !important; }
      #today-mood-row { flex-direction: column; align-items: stretch !important; }
      #today-mood-row > div:first-child { justify-content: center; }
      .mood-note { min-width: 0 !important; width: 100%; }
      .view-btns { flex-shrink: 0; }
      .view-btn { padding: 0.4rem 0.65rem !important; font-size: 0.72rem !important; }
      .nav-row { flex-shrink: 0; }
      .period-label { min-width: 90px !important; font-size: 0.72rem !important; }
      .events-list, .needs-tagging-rows { gap: 0.4rem; }
      .needs-tagging-row { flex-wrap: wrap; }
      .suggestion-row { flex-wrap: wrap; gap: 0.5rem !important; }
      .suggestion-actions { width: 100%; }
      .suggestion-select, .needs-tagging-select { flex: 1; }
      table { font-size: 0.75rem; }
      table th, table td { padding: 0.5rem 0.4rem !important; }
      #routes-map { height: 320px !important; }
      .chart-container, .chart-container-tall { height: 220px !important; }
      .heatmap-cell { width: 11px !important; height: 11px !important; }
    }
    @media (max-width: 480px) {
      .stats-grid, #today-tiles, #health-kpi-grid, #health-stats-grid, #habits-tiles { grid-template-columns: 1fr 1fr !important; }
      .stat-value { font-size: 1.3rem !important; }
      #today-tiles { gap: 0.45rem !important; }
      .main { padding: 3.75rem 0.75rem 1.5rem !important; }
      .card { padding: 0.875rem !important; border-radius: 12px !important; }
    }
    .period-label { font-size: 0.78rem; font-weight: 500; color: var(--text); min-width: 130px; text-align: center; }
    .refresh-btn { padding: 0.5rem 0.875rem; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); font-size: 0.78rem; font-weight: 500; color: var(--text2); display: flex; align-items: center; gap: 0.375rem; transition: all 0.15s; }
    .refresh-btn:hover { border-color: var(--accent); color: var(--accent); }
    .export-btn { padding: 0.5rem 0.875rem; border-radius: 9px; border: 1px solid #10B981; background: var(--surface); font-size: 0.78rem; font-weight: 600; color: #10B981; display: flex; align-items: center; gap: 0.375rem; transition: all 0.15s; }
    .export-btn:hover { background: #ECFDF5; }
    .stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 1rem; }
    .stat-card { background: var(--surface); border-radius: 14px; padding: 1.25rem; border: 1px solid var(--border); }
    .stat-icon { font-size: 1.25rem; margin-bottom: 0.75rem; }
    .stat-label { font-size: 0.7rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.3rem; }
    .stat-value { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1; }
    .stat-unit { font-size: 0.875rem; font-weight: 400; color: var(--text2); }
    .stat-delta { font-size: 0.7rem; font-weight: 600; margin-top: 0.375rem; display: flex; align-items: center; gap: 0.25rem; }
    .delta-up { color: #10B981; }
    .delta-down { color: #EF4444; }
    .delta-neutral { color: var(--text3); }
    /* Streak row */
    .streak-row { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
    .streak-card { background: var(--surface); border-radius: 14px; padding: 1rem 1.25rem; border: 1px solid var(--border); display: flex; align-items: center; gap: 1rem; flex: 1; }
    .streak-flame { font-size: 2rem; }
    .streak-num { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1; }
    .streak-label { font-size: 0.7rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; }
    .streak-sub { font-size: 0.72rem; color: var(--text3); margin-top: 0.2rem; }
    .charts-row { display: grid; grid-template-columns: 350px 1fr; gap: 1rem; margin-bottom: 1.5rem; }
    .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
    .card { background: var(--surface); border-radius: 14px; padding: 1.25rem; border: 1px solid var(--border); }
    .card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
    .card-title { font-size: 0.9375rem; font-weight: 700; }
    .card-action { font-size: 0.75rem; color: var(--accent); cursor: pointer; background: none; border: none; font-weight: 500; }
    .category-chart-wrap { display: flex; gap: 1.25rem; align-items: center; }
    .donut-wrap { position: relative; width: 160px; height: 160px; flex-shrink: 0; }
    .donut-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; pointer-events: none; }
    .donut-total { font-size: 1.375rem; font-weight: 700; }
    .donut-sub { font-size: 0.6rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; }
    .category-legend { flex: 1; }
    .legend-item { display: flex; align-items: center; justify-content: space-between; padding: 0.45rem 0.375rem; border-radius: 7px; cursor: pointer; transition: background 0.15s; }
    .legend-item:hover { background: var(--surface2); }
    .legend-left { display: flex; align-items: center; gap: 0.5rem; }
    .legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
    .legend-name { font-size: 0.78rem; font-weight: 500; }
    .legend-right { text-align: right; }
    .legend-hrs { font-size: 0.78rem; font-weight: 600; }
    .legend-pct { font-size: 0.7rem; color: var(--text3); }
    .chart-container { height: 200px; position: relative; }
    .chart-container-tall { height: 240px; position: relative; }
    /* Calendar view */
    .cal-wrap { background: var(--surface); border-radius: 14px; border: 1px solid var(--border); overflow: hidden; }
    .cal-head { display: grid; grid-template-columns: 52px repeat(7,1fr); border-bottom: 1px solid var(--border); background: var(--surface2); }
    .cal-head-cell { padding: 0.625rem 0.375rem; text-align: center; font-size: 0.75rem; font-weight: 600; color: var(--text2); border-left: 1px solid var(--border); }
    .cal-head-cell:first-child { border-left: none; }
    .cal-head-date { font-size: 1.125rem; font-weight: 700; color: var(--text); line-height: 1; margin-top: 0.2rem; }
    .cal-head-cell.today .cal-head-date { color: var(--accent); }
    .cal-body-wrap { display: grid; grid-template-columns: 52px 1fr; max-height: 640px; overflow-y: auto; }
    .cal-times { display: flex; flex-direction: column; }
    .cal-time-slot { height: 56px; display: flex; align-items: flex-start; justify-content: flex-end; padding: 3px 6px 0 0; font-size: 0.6rem; color: var(--text3); font-weight: 500; flex-shrink: 0; border-bottom: 1px solid var(--border); }
    .cal-days { display: grid; grid-template-columns: repeat(7,1fr); position: relative; }
    .cal-day-col { position: relative; border-left: 1px solid var(--border); }
    .cal-hour-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); pointer-events: none; }
    .cal-event { position: absolute; left: 2px; right: 2px; border-radius: 5px; padding: 3px 5px; font-size: 0.65rem; font-weight: 600; overflow: hidden; cursor: pointer; transition: opacity 0.15s; z-index: 2; line-height: 1.3; min-height: 18px; }
    .cal-event:hover { opacity: 0.85; }
    .cal-now-line { position: absolute; left: 0; right: 0; height: 2px; background: #EF4444; z-index: 3; }
    .cal-now-dot { position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #EF4444; }
    /* Goals */
    .goals-section { margin-bottom: 1.5rem; }
    .goals-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 0.875rem; }
    .goal-card { background: var(--surface); border-radius: 12px; padding: 1rem 1.125rem; border: 1px solid var(--border); }
    .goal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.625rem; }
    .goal-name { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; font-weight: 700; }
    .goal-nums { font-size: 0.75rem; color: var(--text2); }
    .goal-nums b { color: var(--text); }
    .goal-track { height: 8px; background: var(--surface2); border-radius: 999px; overflow: hidden; margin-top: 0.5rem; }
    .goal-fill { height: 100%; border-radius: 999px; transition: width 0.4s; }
    .goal-pct { font-size: 0.7rem; color: var(--text3); margin-top: 0.35rem; text-align: right; }
    /* Heatmap */
    .heatmap-wrap { overflow-x: auto; padding-bottom: 0.25rem; }
    .heatmap-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7,14px); gap: 3px; width: max-content; }
    .heatmap-cell { width: 14px; height: 14px; border-radius: 3px; cursor: default; }
    .heatmap-day-labels { display: grid; grid-template-rows: repeat(7,14px); gap: 3px; margin-right: 6px; }
    .heatmap-day-label { font-size: 9px; color: var(--text3); line-height: 14px; }
    .heatmap-legend { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 0.7rem; color: var(--text3); }
    .heatmap-legend-cells { display: flex; gap: 3px; }
    /* Suggestions Banner */
    .suggestions-banner { background: var(--surface); border-radius: 14px; padding: 1rem 1.25rem; border: 2px solid #F59E0B; margin-bottom: 1.25rem; }
    .suggestions-banner-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
    .suggestions-banner-title { font-size: 0.875rem; font-weight: 700; color: #F59E0B; display: flex; align-items: center; gap: 0.5rem; }
    .suggestions-list { display: flex; flex-direction: column; gap: 0.5rem; }
    .suggestion-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.875rem; background: var(--surface2); border-radius: 9px; flex-wrap: wrap; }
    .suggestion-event-name { font-size: 0.8125rem; font-weight: 600; flex: 1; min-width: 140px; }
    .suggestion-event-date { font-size: 0.72rem; color: var(--text3); margin-top: 0.1rem; }
    .suggestion-cat-label { font-size: 0.78rem; color: var(--text2); white-space: nowrap; }
    .suggestion-actions { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; flex-wrap: wrap; }
    .suggestion-yes { padding: 0.3rem 0.8rem; border-radius: 6px; border: none; background: #10B981; color: #fff; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: opacity 0.15s; }
    .suggestion-yes:hover { opacity: 0.85; }
    .suggestion-skip { padding: 0.3rem 0.7rem; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text2); font-size: 0.75rem; cursor: pointer; transition: all 0.15s; }
    .suggestion-skip:hover { border-color: var(--text2); }
    .suggestion-dismiss-all { padding: 0.25rem 0.6rem; border-radius: 6px; border: none; background: transparent; color: var(--text3); font-size: 0.75rem; cursor: pointer; }
    .suggestion-dismiss-all:hover { color: var(--text); }
    .suggestion-select { font-size: 0.72rem; padding: 0.25rem 0.4rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
    /* Needs Tagging */
    .needs-tagging-card { background: var(--surface); border-radius: 14px; padding: 1.25rem; border: 2px solid #FCD34D; margin-bottom: 1.5rem; }
    .needs-tagging-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
    .needs-tagging-title { font-size: 0.9375rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
    .needs-tagging-count { font-size: 0.78rem; color: var(--text3); font-weight: 400; }
    .auto-tag-btn { padding: 0.5rem 1rem; border-radius: 8px; border: none; background: linear-gradient(135deg,var(--accent),var(--accent2)); color: #fff; font-size: 0.78rem; font-weight: 600; }
    .needs-tagging-rows { display: flex; flex-direction: column; gap: 0.5rem; }
    .needs-tagging-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.75rem; background: #FFFBEB; border-radius: 8px; border: 1px solid #FDE68A; }
    html[data-dark] .needs-tagging-row { background: #241f0a; border-color: #5a4a0a; }
    .needs-tagging-info { flex: 1; min-width: 0; }
    .needs-tagging-name { font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .needs-tagging-meta { font-size: 0.7rem; color: var(--text3); }
    .needs-tagging-select { padding: 0.35rem 0.625rem; border-radius: 7px; border: 1.5px solid var(--border); font-size: 0.75rem; background: var(--surface); color: var(--text); outline: none; }
    table { width: 100%; border-collapse: collapse; }
    th { text-align: left; font-size: 0.7rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; padding: 0.5rem 0.875rem; border-bottom: 1px solid var(--border); }
    td { padding: 0.75rem 0.875rem; font-size: 0.8125rem; border-bottom: 1px solid var(--surface2); vertical-align: middle; }
    tr:last-child td { border-bottom: none; }
    tr:hover td { background: var(--surface2); }
    .tag-select { padding: 0.3rem 0.625rem; border-radius: 7px; border: 1.5px solid var(--border); font-size: 0.75rem; background: var(--surface); color: var(--text); outline: none; }
    .manual-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent2); display: inline-block; margin-left: 4px; }
    .search-bar { padding: 0.625rem 1rem; border: 1.5px solid var(--border); border-radius: 9px; font-size: 0.8125rem; outline: none; width: 280px; background: var(--surface); color: var(--text); }
    .search-bar:focus { border-color: var(--accent); }
    .filter-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
    .filter-chip { padding: 0.375rem 0.875rem; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); font-size: 0.75rem; font-weight: 500; color: var(--text2); transition: all 0.15s; }
    .filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
    .filter-chip:hover:not(.active) { border-color: var(--accent); color: var(--accent); }
    .cats-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 1rem; margin-bottom: 2rem; }
    .cat-card { background: var(--surface); border-radius: 14px; padding: 1.25rem; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.75rem; }
    .cat-card-top { display: flex; align-items: center; gap: 0.75rem; }
    .cat-swatch { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; }
    .cat-name { font-size: 0.9375rem; font-weight: 700; }
    .cat-hrs { font-size: 0.78rem; color: var(--text2); }
    .cat-bar-track { height: 6px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
    .cat-bar-fill { height: 100%; border-radius: 999px; }
    .cat-actions { display: flex; gap: 0.5rem; align-items: center; }
    .goal-input-wrap { display: flex; align-items: center; gap: 0.375rem; margin-left: auto; }
    .goal-input-wrap label { font-size: 0.7rem; color: var(--text3); white-space: nowrap; }
    .goal-input { width: 52px; padding: 0.25rem 0.5rem; border: 1.5px solid var(--border); border-radius: 6px; font-size: 0.75rem; text-align: center; outline: none; background: var(--surface); color: var(--text); }
    .goal-input:focus { border-color: var(--accent); }
    .btn-sm { padding: 0.375rem 0.875rem; border-radius: 7px; font-size: 0.75rem; font-weight: 600; border: none; transition: all 0.15s; }
    .btn-edit { background: #EEF2FF; color: var(--accent); }
    .btn-edit:hover { background: #E0E7FF; }
    html[data-dark] .btn-edit { background: #1E2340; }
    .btn-del { background: #FEF2F2; color: #EF4444; }
    .btn-del:hover { background: #FEE2E2; }
    html[data-dark] .btn-del { background: #2a1515; }
    .add-cat-btn { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 1.25rem; border-radius: 14px; border: 2px dashed var(--border); background: transparent; color: var(--text3); font-size: 0.8125rem; font-weight: 600; transition: all 0.2s; width: 100%; }
    .add-cat-btn:hover { border-color: var(--accent); color: var(--accent); background: #EEF2FF; }
    html[data-dark] .add-cat-btn:hover { background: #1E2340; }
    .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
    .modal { background: var(--surface); border-radius: 18px; padding: 2rem; width: 420px; max-width: 95vw; box-shadow: 0 20px 60px rgba(0,0,0,0.2); border: 1px solid var(--border); }
    .modal h3 { font-size: 1.125rem; font-weight: 700; margin-bottom: 1.25rem; }
    .modal-footer { display: flex; gap: 0.75rem; margin-top: 1.5rem; justify-content: flex-end; }
    .btn-cancel { padding: 0.625rem 1.25rem; border-radius: 8px; border: 1.5px solid var(--border); background: var(--surface); font-size: 0.8125rem; font-weight: 600; color: var(--text2); }
    .btn-save { padding: 0.625rem 1.25rem; border-radius: 8px; border: none; background: linear-gradient(135deg,var(--accent),var(--accent2)); color: #fff; font-size: 0.8125rem; font-weight: 600; }
    .color-swatches { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
    .color-swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: all 0.15s; }
    .color-swatch.selected { border-color: var(--text); transform: scale(1.15); }
    .auto-card { background: var(--surface); border-radius: 14px; padding: 1.25rem; border: 1px solid var(--border); margin-bottom: 1rem; }
    .auto-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
    .auto-name { font-size: 0.875rem; font-weight: 700; }
    .kw-list { display: flex; flex-wrap: wrap; gap: 0.375rem; }
    .kw-tag { padding: 0.25rem 0.625rem; background: var(--surface2); border-radius: 999px; font-size: 0.75rem; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 0.375rem; }
    .kw-del { background: none; border: none; color: var(--text3); font-size: 14px; line-height: 1; cursor: pointer; padding: 0; }
    .kw-del:hover { color: #EF4444; }
    .kw-input-row { display: flex; gap: 0.5rem; margin-top: 0.875rem; }
    .kw-input { flex: 1; padding: 0.5rem 0.875rem; border: 1.5px solid var(--border); border-radius: 8px; font-size: 0.8125rem; outline: none; background: var(--surface); color: var(--text); }
    .kw-input:focus { border-color: var(--accent); }
    .kw-add-btn { padding: 0.5rem 1rem; border-radius: 8px; border: none; background: var(--accent); color: #fff; font-size: 0.8125rem; font-weight: 600; }
    .add-auto-btn { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 1rem; border-radius: 14px; border: 2px dashed var(--border); background: transparent; color: var(--text3); font-size: 0.8125rem; font-weight: 600; transition: all 0.2s; width: 100%; }
    .add-auto-btn:hover { border-color: var(--accent); color: var(--accent); background: #EEF2FF; }
    html[data-dark] .add-auto-btn:hover { background: #1E2340; }
    .title-mem-section { margin-top: 2rem; }
    .title-mem-row { display: flex; align-items: center; justify-content: space-between; padding: 0.625rem 0.875rem; background: var(--surface2); border-radius: 8px; margin-bottom: 0.375rem; }
    .title-mem-name { font-size: 0.8125rem; font-weight: 500; font-style: italic; color: var(--text); }
    .title-mem-right { display: flex; align-items: center; gap: 0.75rem; }
    .title-mem-cat { font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.625rem; border-radius: 999px; }
    .title-mem-del { background: none; border: none; color: var(--text3); font-size: 13px; cursor: pointer; }
    .title-mem-del:hover { color: #EF4444; }
    .report-card { background: var(--surface); border-radius: 14px; padding: 1.5rem; border: 1px solid var(--border); }
    .report-row { display: flex; align-items: center; justify-content: space-between; padding: 0.625rem 0; border-bottom: 1px solid var(--surface2); }
    .report-row:last-child { border-bottom: none; }
    /* ── Productivity Score ── */
    .score-card { background: var(--surface); border-radius: 14px; padding: 1.5rem; border: 1px solid var(--border); display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
    .score-ring-wrap { position: relative; width: 130px; height: 130px; flex-shrink: 0; }
    .score-ring-wrap svg { transform: rotate(-90deg); }
    .score-ring-bg { fill: none; stroke: var(--surface2); stroke-width: 10; }
    .score-ring-fill { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
    .score-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; }
    .score-num { font-size: 2rem; font-weight: 800; line-height: 1; }
    .score-label { font-size: 0.65rem; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
    .score-breakdown { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 0.625rem; }
    .score-grade { font-size: 0.8rem; font-weight: 700; color: var(--text2); margin-bottom: 0.25rem; }
    .score-bar-row { display: flex; align-items: center; gap: 0.625rem; }
    .score-bar-label { font-size: 0.72rem; color: var(--text2); width: 110px; flex-shrink: 0; }
    .score-bar-track { flex: 1; height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
    .score-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
    .score-bar-pts { font-size: 0.7rem; color: var(--text3); width: 36px; text-align: right; flex-shrink: 0; }
    /* ── Report grid rows ── */
    .one-col { margin-bottom: 1.5rem; }
    .three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
    /* ── Day-of-week bars ── */
    .dow-bars { display: flex; align-items: flex-end; gap: 0.5rem; height: 100px; padding-top: 0.5rem; }
    .dow-bar-col { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; flex: 1; height: 100%; justify-content: flex-end; }
    .dow-bar { width: 100%; border-radius: 4px 4px 0 0; min-height: 2px; transition: height 0.3s ease; }
    .dow-bar-day { font-size: 0.65rem; color: var(--text3); font-weight: 600; }
    .dow-bar-val { font-size: 0.65rem; color: var(--text2); }
    /* ── Top events table ── */
    .top-ev-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--surface2); }
    .top-ev-row:last-child { border-bottom: none; }
    .top-ev-rank { font-size: 0.7rem; font-weight: 700; color: var(--text3); width: 18px; flex-shrink: 0; }
    .top-ev-name { font-size: 0.8125rem; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .top-ev-cat { font-size: 0.7rem; padding: 0.15rem 0.45rem; border-radius: 20px; font-weight: 600; color: #fff; flex-shrink: 0; }
    .top-ev-hrs { font-size: 0.8rem; font-weight: 700; color: var(--text); flex-shrink: 0; min-width: 36px; text-align: right; }
    .top-ev-bar-track { width: 60px; height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; flex-shrink: 0; }
    .top-ev-bar-fill { height: 100%; border-radius: 2px; }
    /* ── Category Deep Dive ── */
    .dive-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
    .dive-cat-tabs { display: flex; gap: 0.375rem; flex-wrap: wrap; }
    .dive-cat-tab { padding: 0.3rem 0.75rem; border-radius: 20px; border: 1.5px solid var(--border); background: transparent; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.15s; color: var(--text2); }
    .dive-cat-tab.active { color: #fff; border-color: transparent; }
    .dive-cat-tab:hover:not(.active) { border-color: var(--text2); color: var(--text); }
    .dive-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--surface2); }
    .dive-row:last-child { border-bottom: none; }
    .dive-name { font-size: 0.8125rem; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .dive-count { font-size: 0.72rem; color: var(--text3); background: var(--surface2); border-radius: 20px; padding: 0.1rem 0.5rem; flex-shrink: 0; }
    .dive-hrs { font-size: 0.8rem; font-weight: 700; color: var(--text); flex-shrink: 0; min-width: 36px; text-align: right; }
    .dive-avg { font-size: 0.7rem; color: var(--text3); flex-shrink: 0; min-width: 44px; text-align: right; }
    .dive-bar-track { width: 80px; height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
    .dive-bar-fill { height: 100%; border-radius: 3px; }
    .dive-empty { font-size: 0.82rem; color: var(--text3); padding: 1rem 0; }
    /* ── Focus vs meetings ── */
    .foc-row { display: flex; align-items: center; gap: 0.625rem; padding: 0.375rem 0; border-bottom: 1px solid var(--surface2); }
    .foc-row:last-child { border-bottom: none; }
    .foc-day { font-size: 0.75rem; color: var(--text2); width: 32px; flex-shrink: 0; font-weight: 600; }
    .foc-bars { flex: 1; display: flex; flex-direction: column; gap: 3px; }
    .foc-bar-wrap { display: flex; align-items: center; gap: 0.4rem; }
    .foc-bar-label { font-size: 0.65rem; color: var(--text3); width: 40px; flex-shrink: 0; }
    .foc-bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; }
    .foc-bar-fill { height: 100%; border-radius: 4px; }
    .foc-val { font-size: 0.65rem; color: var(--text3); width: 30px; text-align: right; flex-shrink: 0; }
    /* ── Insight pills ── */
    .insight-row { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
    .insight-pill { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 1rem; flex: 1; min-width: 180px; display: flex; align-items: center; gap: 0.625rem; }
    .insight-icon { font-size: 1.25rem; flex-shrink: 0; }
    .insight-text { font-size: 0.78rem; color: var(--text2); line-height: 1.45; }
    .insight-text strong { color: var(--text); font-weight: 700; }
    /* ── Sleep tracker ── */
    .sleep-card { margin-bottom: 1.5rem; }
    .sleep-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.875rem; margin-bottom: 1.25rem; }
    .sleep-stat { background: var(--surface2); border-radius: 10px; padding: 0.875rem 1rem; text-align: center; }
    .sleep-stat-val { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1; }
    .sleep-stat-unit { font-size: 0.7rem; color: var(--text3); margin-top: 0.2rem; }
    .sleep-stat-label { font-size: 0.68rem; font-weight: 600; color: var(--text3); margin-top: 0.4rem; text-transform: uppercase; letter-spacing: 0.04em; }
    .sleep-bars { display: flex; gap: 6px; align-items: flex-end; height: 80px; }
    .sleep-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; justify-content: flex-end; }
    .sleep-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; transition: height 0.3s; }
    .sleep-bar-day { font-size: 0.6rem; color: var(--text3); font-weight: 600; }
    .sleep-bar-val { font-size: 0.58rem; color: var(--text3); }
    .sleep-consistency-label { font-size: 0.75rem; color: var(--text2); text-align: center; margin-top: 0.625rem; }
    .sleep-consistency-label strong { color: var(--text); }
    .report-cat-name { display: flex; align-items: center; gap: 0.625rem; font-size: 0.875rem; font-weight: 600; }
    .empty-state { text-align: center; padding: 3rem 1rem; color: var(--text3); }
    /* ── Settings modal ── */
    .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200; display: flex; align-items: center; justify-content: center; }
    .modal-box { background: var(--surface); border-radius: 16px; padding: 1.75rem; width: 460px; max-width: 92vw; border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
    .modal-title { font-size: 1rem; font-weight: 700; margin-bottom: 1.25rem; display: flex; align-items: center; justify-content: space-between; }
    .modal-close { background: none; border: none; color: var(--text3); font-size: 1.1rem; cursor: pointer; }
    .modal-section { font-size: 0.7rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin: 1.25rem 0 0.75rem; }
    .modal-section:first-of-type { margin-top: 0; }
    .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
    .empty-text { font-size: 0.875rem; }
    .section-divider { font-size: 0.8125rem; font-weight: 700; color: var(--text); margin: 1.5rem 0 0.875rem; display: flex; align-items: center; gap: 0.75rem; }
    .section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
    .toast { position: fixed; bottom: 1.5rem; right: 1.5rem; background: #1A202C; color: #fff; padding: 0.75rem 1.25rem; border-radius: 10px; font-size: 0.8125rem; font-weight: 500; z-index: 200; opacity: 0; transform: translateY(8px); transition: all 0.25s; pointer-events: none; }
    .toast.show { opacity: 1; transform: translateY(0); }
