/* ── Electron Specific Styles ────────────────────────────────────────── */
.electron-title-bar {
  display: none;
}

body.is-electron {
  padding-top: 0;
}

.title-bar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 600;
  color: #7b7b7b;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
}

/* Ensure interactive elements aren't draggable (Electron) */
button, input, textarea, select, .tab, .nav-btn, .btn, .block-pill, .habit, .clickable, .week-nav {
  -webkit-app-region: no-drag;
}

:root {
      /* Base Colors - Light Theme (Warm Parchment) */
      --bg: #F3EDE3;
      --surface: #FAF9F6;
      --surface-hover: #EDE5D8;
      --surface-elevated: #FAF9F6;
      --paper-opacity: 0.05;
      --border: rgba(120, 85, 50, 0.10);
      --border2: rgba(120, 85, 50, 0.20);

      /* Text */
      --text: #2C1F14;
      --text2: #5A4E44;
      --text3: #B09A8A;

      /* Brand / Semantic Colors (Earthy) */
      --accent: #B96B2E;
      --accent-bg: rgba(185, 107, 46, 0.10);
      --blue: #5578A0;
      --blue-bg: rgba(85, 120, 160, 0.10);
      --purple: #836E9E;
      --purple-bg: rgba(131, 110, 158, 0.10);
      --amber: #B8852A;
      --amber-bg: rgba(184, 133, 42, 0.10);
      --red: #B85040;
      --red-bg: rgba(184, 80, 64, 0.10);

      /* Typography Scale */
      --font-body: 'Inter', sans-serif;
      --font-heading: 'Lora', Georgia, serif;
      --font-journal: 'Lora', Georgia, serif;
      --text-xs: 12px;
      --text-sm: 14px;
      --text-md: 16px;
      --text-lg: 20px;
      --text-xl: 24px;
      --text-2xl: 32px;

      /* Spacing Rhythm */
      --space-1: 8px;
      --space-2: 16px;
      --space-3: 24px;
      --space-4: 32px;
      --space-5: 40px;

      /* Elevation / Shadows (Warm-tinted layering) */
      --elevation-base: 0 1px 2px rgba(100, 60, 20, 0.04), 0 2px 4px rgba(100, 60, 20, 0.03);
      --elevation-hover: 0 8px 16px -4px rgba(100, 60, 20, 0.08), 0 4px 8px -2px rgba(100, 60, 20, 0.05);
      --elevation-modal: 0 24px 48px -12px rgba(100, 60, 20, 0.12), 0 12px 24px -6px rgba(100, 60, 20, 0.07);

      /* Surface Polishing */
      --surface-grad: linear-gradient(180deg, #FDFAF5 0%, #F9F5EE 100%);
      --radius: 14px;
      --radius-sm: 8px;
      --radius-lg: 20px;

      /* Animation Components */
      --ease: cubic-bezier(0.16, 1, 0.3, 1);
      --duration-fast: 150ms;
      --duration-normal: 250ms;

      /* Specific component variables */
      --badge-base: #ffffff;
    }

    html[data-theme="dark"] {
      /* Base Colors - Dark Theme (Midnight Journal) */
      --bg: #121110;
      --surface: #1F1D1C;
      --surface-hover: #2A2725;
      --surface-elevated: #302D2A;
      --border: rgba(229, 169, 58, 0.15);
      --border2: rgba(229, 169, 58, 0.28);

      /* Text */
      --text: #F0EBE1;
      --text2: #A39E98;
      --text3: #7A7571;

      /* Semantic Colors (Midnight Journal) */
      --accent: #E5A93A;
      --accent-bg: rgba(229, 169, 58, 0.18);
      --blue: #90BAD8;
      --blue-bg: rgba(144, 186, 216, 0.16);
      --purple: #BBA8D6;
      --purple-bg: rgba(187, 168, 214, 0.16);
      --amber: #D96C4E;
      --amber-bg: rgba(217, 108, 78, 0.18);
      --red: #C96050;
      --red-bg: rgba(201, 96, 80, 0.16);

      /* Elevation / Shadows (Deep dark layering) */
      --elevation-base: 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
      --elevation-hover: 0 10px 20px -5px rgba(0, 0, 0, 0.6), 0 6px 10px -4px rgba(0, 0, 0, 0.4);
      --elevation-modal: 0 32px 64px -16px rgba(0, 0, 0, 0.7), 0 16px 32px -8px rgba(0, 0, 0, 0.5);

      --badge-base: #2A2725;
      --surface-grad: linear-gradient(180deg, #1F1D1C 0%, #1A1817 100%);
    }

    html {
      transition: background-color var(--duration-normal) var(--ease);
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      font-family: var(--font-body);
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      font-size: var(--text-sm);
      line-height: 1.6;
    }

    .app {
      max-width: 1200px;
      margin: 0 auto;
      padding: 2rem 1.5rem 2rem 1.5rem; /* Restore top padding for regular view */
    }

    body.is-electron .app {
      padding-top: 0; /* Remove top padding in Electron (handled by header) */
    }

    .header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 1.5rem;
      -webkit-app-region: drag;
    }

    body.is-electron .header {
      padding: 32px 140px 0px 0; /* Clear controls and top edge */
    }

    .header h1 {
      font-size: 26px;
      font-weight: 600;
      letter-spacing: -0.5px;
      font-family: var(--font-heading);
    }

    .header p {
      font-size: 13px;
      color: var(--text2);
      margin-top: 2px;
    }

    .week-nav {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .week-lbl {
      font-family: var(--font-body);
      font-size: 13px;
      color: var(--text2);
      min-width: 155px;
      text-align: center;
    }

    .nav-btn {
      width: 30px;
      height: 30px;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border);
      background: var(--surface);
      cursor: pointer;
      color: var(--text2);
      font-size: 15px;
      transition: all 0.15s;
    }

    .nav-btn:hover {
      border-color: var(--border2);
      color: var(--text);
    }

    .toolbar {
      display: flex;
      gap: 8px;
      margin-bottom: 1.25rem;
      align-items: center;
    }

    .tlbl {
      font-size: 12px;
      color: var(--text3);
    }

    .btn {
      padding: var(--space-1) var(--space-2);
      border-radius: var(--radius-sm);
      border: 1px solid transparent;
      background: var(--surface-hover);
      color: var(--text2);
      font-size: var(--text-sm);
      font-weight: 500;
      font-family: var(--font-body);
      cursor: pointer;
      transition: all var(--duration-fast) var(--ease);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
    }

    .btn:hover {
      background: var(--surface-elevated);
      color: var(--text);
      box-shadow: var(--elevation-hover);
      transform: translateY(-2px);
    }

    .btn:active {
      transform: translateY(0);
      box-shadow: var(--elevation-base);
    }

    .btn:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }

    .btn-p {
      background: var(--text);
      color: var(--bg);
      border: none;
    }

    .btn-p:hover {
      background: var(--text2);
      color: var(--bg);
      box-shadow: var(--elevation-hover);
    }

    .tab {
      padding: 7px 18px;
      border-radius: 7px;
      border: none;
      background: transparent;
      color: var(--text3);
      font-size: 13px;
      font-weight: 600;
      font-family: var(--font-body);
      cursor: pointer;
      transition: all 0.2s;
    }
    
    .tab.active {
      background: var(--surface);
      color: var(--text);
      font-weight: 600;
      box-shadow: var(--shadow);
    }
    
    .tabs {
      display: flex;
      gap: 2px;
      background: var(--surface2);
      border-radius: var(--radius);
      padding: 4px;
      margin-bottom: 0;
      width: fit-content;
    }

    .sec {
      display: none;
    }

    .sec.active {
      display: block;
      animation: fi 0.2s ease;
    }

    @keyframes fi {
      from {
        opacity: 0;
        transform: translateY(3px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes gentle-pulse {
      0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
      70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
      100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
    }


    .day-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      margin-bottom: 1.5rem;
    }

    .day-card {
      background: var(--surface);
      filter: url(#paperTexture);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.75rem;
      display: flex;
      flex-direction: column;
      gap: 16px;
      min-height: 240px;
      transition: all var(--duration-fast) var(--ease);
      box-shadow: none;
    }

    .day-card:hover {
      box-shadow: var(--elevation-hover);
      transform: translateY(-2px);
      border-color: var(--border2);
    }

    .day-card.today {
      border-color: var(--accent);
      background: var(--surface);
      box-shadow: var(--elevation-hover);
      transform: translateY(-2px);
      position: relative;
      z-index: 10;
    }
    .day-card.today::before {
      content: '';
      position: absolute;
      inset: -1px;
      border-radius: var(--radius);
      background: linear-gradient(135deg, var(--accent) 0%, transparent 100%);
      opacity: 0.1;
      pointer-events: none;
    }

    .day-card.fr-day {
      border-color: var(--purple);
      background: var(--purple-bg);
    }

    .day-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: var(--space-1);
    }

    .day-name {
      font-size: var(--text-sm);
      font-weight: 600;
      color: var(--text);
      font-family: var(--font-heading);
    }

    .day-card.today .day-name {
      color: var(--blue);
    }

    .day-date {
      font-size: 11px;
      color: var(--text3);
      font-family: var(--font-body);
    }

    .habit-row {
      display: flex;
      gap: 16px;
    }

    .habit {
      display: flex;
      align-items: center;
      gap: 7px;
      cursor: pointer;
    }

    .habit input {
      appearance: none;
      -webkit-appearance: none;
      width: 18px;
      height: 18px;
      border: 2px solid var(--border2);
      border-radius: 4px;
      background: var(--surface);
      cursor: pointer;
      position: relative;
      transition: all var(--duration-fast) var(--ease);
    }
    .habit input:checked {
      background: var(--accent);
      border-color: var(--accent);
    }
    .habit input:checked::after {
      content: '✓';
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      color: #fff;
      font-size: 12px;
      font-weight: bold;
    }
    .habit input:hover {
      border-color: var(--accent);
      box-shadow: 0 0 0 4px var(--accent-bg);
    }

    .habit span {
      font-size: 13px;
      color: var(--text2);
    }

    .blocks-stack {
      display: flex;
      flex-direction: column;
      gap: 6px;
      flex: 1;
    }

    .block-pill {
      font-size: var(--text-xs);
      padding: 6px 10px;
      border-radius: var(--radius-sm);
      color: var(--text);
      cursor: pointer;
      border: 1px solid transparent;
      border-left-width: 2px;
      border-left-style: solid;
      transition: all var(--duration-fast) var(--ease);
      line-height: 1.4;
      font-weight: 500;
    }

    .block-pill:hover {
      transform: translateY(-1px);
      box-shadow: var(--elevation-hover);
      background: var(--surface-elevated) !important;
    }

    .block-pill.project {
      background: var(--blue-bg);
      color: var(--blue);
    }

    .block-pill.intern {
      background: var(--accent-bg);
      color: var(--accent);
    }

    .block-pill.upskilling {
      background: var(--purple-bg);
      color: var(--purple);
    }

    .block-pill.reading {
      background: var(--amber-bg);
      color: var(--amber);
    }

    .add-btn {
      width: 100%;
      font-size: 11px;
      padding: 6px;
      border: 1px solid transparent;
      border-radius: var(--radius-sm);
      background: transparent;
      color: var(--text3);
      cursor: pointer;
      font-family: var(--font-body);
      transition: all 0.15s;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .add-btn:hover {
      border-color: var(--border2);
      color: var(--text2);
      background: var(--surface2);
    }

    .day-badges {
      display: flex;
      gap: 6px;
    }

    .badge-btn {
      flex: 1;
      text-align: center;
      font-size: 11px;
      padding: 5px 6px;
      border-radius: 6px;
      border: 1px solid var(--border);
      background: transparent;
      color: var(--text3);
      cursor: pointer;
      transition: all 0.15s;
      font-family: var(--font-body);
    }

    .badge-btn.mvd-on {
      background: var(--amber-bg);
      color: var(--amber);
      border-color: #d4a843;
    }

    .badge-btn.fr-on {
      background: var(--purple-bg);
      color: var(--purple);
      border-color: #8b7fd4;
    }

    .ov-day {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 14px 18px;
      margin-bottom: 8px;
    }

    .ov-day.today {
      border-color: var(--blue);
    }

    .ov-day.fr {
      border-color: var(--purple);
    }

    .ov-dh {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 6px;
    }

    .ov-dn {
      font-size: 14px;
      font-weight: 500;
    }

    .ov-tags {
      display: flex;
      gap: 5px;
      flex-wrap: wrap;
    }

    .tag {
      font-size: 11px;
      padding: 2px 9px;
      border-radius: 4px;
    }

    .tag.run {
      background: var(--accent-bg);
      color: var(--accent);
    }

    .tag.rest {
      background: var(--purple-bg);
      color: var(--purple);
    }

    .tag.mvd {
      background: var(--amber-bg);
      color: var(--amber);
    }

    .tag.fr {
      background: var(--purple-bg);
      color: var(--purple);
      font-style: italic;
    }

    .ov-blocks {
      display: flex;
      gap: 5px;
      flex-wrap: wrap;
    }

    .ov-block {
      font-size: 12px;
      padding: 3px 10px;
      border-radius: 4px;
      background: var(--surface2);
      color: var(--text2);
    }

    /* Header Refinements */
    .header-actions {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .header-btn {
      height: 36px;
      padding: 0 14px;
      font-size: 13px;
      border-radius: var(--radius-sm);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .icon-btn {
      width: 36px;
      height: 36px;
      padding: 0;
      border-radius: 50%;
      justify-content: center;
    }

    .intention-box {
      background: var(--surface);
      filter: url(#paperTexture);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1rem 1.25rem;
      margin-bottom: 1.5rem;
    }

    .ilbl {
      font-size: 11px;
      color: var(--text3);
      font-family: var(--font-body);
      letter-spacing: 0.3px;
      margin-bottom: 6px;
    }

    .iinput {
      width: 100%;
      border: none;
      background: var(--surface);
      filter: url(#paperTexture);
      font-size: 14px;
      color: var(--text);
      outline: none;
      font-family: var(--font-body);
    }

    .sg {
      margin-bottom: 1.5rem;
    }

    .sg-title {
      font-size: 13px;
      color: var(--text);
      font-weight: 600;
      font-family: var(--font-heading);
      letter-spacing: -0.2px;
      margin-bottom: 12px;
      margin-top: 8px;
    }

    .si {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 0;
      background: var(--surface);
      filter: url(#paperTexture);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 11px 14px;
      margin-bottom: 6px;
      position: relative;
    }

    .si-main {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .stag {
      font-size: 11px;
      padding: 3px 10px;
      border-radius: 4px;
      font-weight: 500;
      flex-shrink: 0;
      background: color-mix(in srgb, var(--badge-hex, #888) 55%, var(--badge-base, #fff));
      color: var(--badge-text, #fff);
      pointer-events: none;
    }

    .sinput {
      flex: 1;
      border: none;
      background: var(--surface);
      filter: url(#paperTexture);
      padding: var(--space-1) var(--space-2);
      border-radius: var(--radius-sm);
      font-size: var(--text-sm);
      color: var(--text);
      outline: none;
      transition: box-shadow var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
    }

    .sinput:focus {
      background: var(--surface-elevated);
      box-shadow: inset 0 0 0 1px var(--accent);
    }

    .sinput::placeholder {
      color: var(--text3);
    }

    /* ── REVIEW TAB STYLES (CONSOLIDATED) ────────────────────────── */
    .rv-metrics-split {
      display: grid;
      grid-template-columns: 1.2fr 2fr; /* Give more space to the stats */
      gap: 3rem;
      margin-top: 1rem;
      margin-bottom: 3rem;
      min-width: 0;
    }

    .rv-habits-col, .rv-stats-col { min-width: 0; }

    .rv-stats-grid {
      display: grid;
      /* 💎 Symmetric 5-column grid for desktop */
      grid-template-columns: repeat(5, minmax(0, 1fr));
      gap: 12px;
      margin-top: 0.5rem;
    }

    .rv-stat-card {
      background: var(--surface);
      filter: url(#paperTexture);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.25rem 0.5rem;
      text-align: center;
      box-shadow: var(--elevation-base);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      transition: all 0.2s ease;
      min-width: 0;
    }
    .rv-stat-card:hover {
      box-shadow: var(--elevation-hover);
      transform: translateY(-2px);
      border-color: var(--border2);
    }

    .rv-stat-val {
      font-size: 20px;
      font-weight: 600;
      letter-spacing: -0.5px;
      margin-bottom: 6px;
      font-family: var(--font-body);
    }

    .rv-stat-lbl {
      font-size: 10px;
      font-weight: 700;
      color: var(--text3);
      letter-spacing: 0.05em;
      text-transform: uppercase;
    }

    .rv-habits-list {
      display: flex; flex-direction: column; gap: 10px;
    }
    .rv-habit-row {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 12px 16px;
    }
    .rv-habit-info { display: flex; justify-content: space-between; margin-bottom: 8px; }
    .rv-habit-lbl  { font-size: 11px; font-weight: 700; color: var(--text2); letter-spacing: 0.05em; }
    .rv-habit-val  { font-size: 12px; font-weight: 600; color: var(--text); }
    .rv-habit-bar-bg { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
    .rv-habit-bar-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }

    .rv-row-split {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 24px;
      margin-bottom: 2rem;
    }

    .rv-card {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 1.75rem;
      transition: all 0.2s;
    }
    .rv-card:focus-within { border-color: var(--blue); background: var(--surface); }
    .rv-lbl { font-size: 11px; font-weight: 600; color: var(--text3); margin-bottom: 1rem; letter-spacing: 0.02em; }
    .rv-ta { width: 100%; min-height: 240px; background: var(--surface); filter: url(#paperTexture); border: 1px solid var(--border); outline: none; color: var(--text); font-size: 15px; line-height: 1.85; resize: vertical; font-family: var(--font-journal); }

    @media (max-width: 1100px) {
      .rv-metrics-split { grid-template-columns: 1fr; gap: 2.5rem; }
      .rv-stats-grid { grid-template-columns: repeat(3, 1fr); }
    }
    @media (max-width: 600px) {
      .rv-row-split { grid-template-columns: 1fr; }
      .rv-stats-grid { grid-template-columns: repeat(2, 1fr); }
    }

    .guide-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

    .gc {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.1rem 1.25rem;
    }

    .gc-title {
      font-size: 13px;
      font-weight: 500;
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--text);
    }

    .gc-badge {
      font-size: 10px;
      padding: 2px 8px;
      border-radius: 4px;
    }

    .gc-body {
      font-size: 13px;
      color: var(--text2);
      line-height: 1.75;
    }

    .gc-rule {
      margin-top: 10px;
      padding-top: 8px;
      border-top: 1px solid var(--border);
      font-size: 11px;
      color: var(--text3);
      font-family: var(--font-body);
    }

    .overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.4);
      z-index: 999;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      animation: fi var(--duration-fast) var(--ease);
    }

    .overlay.open {
      display: flex;
    }

    .modal {
      background: var(--surface-elevated);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: var(--space-4);
      width: min(460px, 92vw);
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: var(--elevation-modal);
      transform: translateY(10px);
      animation: slideUp var(--duration-normal) var(--ease) forwards;
    }

    @keyframes slideUp {
      to { transform: translateY(0); }
    }

    .modal-title {
      font-size: var(--text-lg);
      font-weight: 600;
      margin-bottom: var(--space-3);
      color: var(--text);
      letter-spacing: -0.02em;
    }

    .frow {
      margin-bottom: 1rem;
    }

    .flbl {
      font-size: 11px;
      color: var(--text3);
      font-family: var(--font-body);
      letter-spacing: 0.02em;
      margin-bottom: 6px;
      display: block;
    }

    .frow select,
    .frow input[type=text] {
      width: 100%;
      padding: var(--space-1) var(--space-2);
      border: 1px solid transparent;
      border-radius: var(--radius-sm);
      background: var(--surface-hover);
      color: var(--text);
      font-size: var(--text-sm);
      font-family: var(--font-body);
      outline: none;
      transition: box-shadow var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
    }

    .frow select:focus,
    .frow input[type=text]:focus {
      background: var(--surface-elevated);
      box-shadow: inset 0 0 0 1px var(--accent);
    }

    /* ── Custom Select (Premium Dropdown) ─────────────────────────────────── */
    .custom-select-container {
      position: relative;
      width: 100%;
      font-family: var(--font-body);
    }
    .custom-select-trigger {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      padding: 8px 12px;
      background: var(--surface-hover);
      border: 1px solid transparent;
      border-radius: var(--radius-sm);
      color: var(--text);
      font-size: 13px;
      cursor: pointer;
      transition: all 0.2s ease;
      user-select: none;
    }
    .custom-select-container.open .custom-select-trigger,
    .custom-select-trigger:focus {
      background: var(--surface-elevated);
      border-color: var(--accent);
      box-shadow: 0 0 0 3px var(--accent-bg);
      outline: none;
    }
    .custom-select-arrow {
      font-size: 10px;
      opacity: 0.6;
      transition: transform 0.2s ease;
    }
    .custom-select-container.open .custom-select-arrow {
      transform: rotate(180deg);
    }
    .custom-select-options {
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      width: 100%;
      background: var(--surface-elevated);
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      box-shadow: var(--elevation-modal);
      z-index: 1000;
      max-height: 240px;
      overflow-y: auto;
      display: none;
      animation: selectPop 0.2s var(--ease) forwards;
    }
    .custom-select-container.open .custom-select-options {
      display: block;
    }
    @keyframes selectPop {
      from { opacity: 0; transform: translateY(-5px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .custom-select-option {
      padding: 10px 12px;
      font-size: 13px;
      color: var(--text2);
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .custom-select-option:hover {
      background: var(--surface-hover);
      color: var(--text);
      padding-left: 16px;
    }
    .custom-select-option.selected {
      background: var(--accent-bg);
      color: var(--accent);
      font-weight: 500;
    }
    .custom-select-option.disabled {
      opacity: 0.4;
      cursor: default;
      pointer-events: none;
    }


    .frow textarea {
      width: 100%;
      padding: 9px 11px;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: var(--bg);
      color: var(--text);
      font-size: 14px;
      font-family: var(--font-journal);
      outline: none;
      resize: vertical;
      min-height: 80px;
      line-height: 1.8;
      transition: border-color 0.15s;
    }

    .frow textarea:focus {
      border-color: var(--border2);
    }

    .erow {
      display: flex;
      gap: 8px;
    }

    .eopt {
      flex: 1;
      padding: 9px;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: transparent;
      color: var(--text2);
      font-size: 13px;
      font-family: var(--font-body);
      cursor: pointer;
      transition: all 0.15s;
      text-align: center;
    }

    .eopt:hover {
      border-color: var(--border2);
    }

    .eopt.sel-low {
      background: var(--red-bg);
      color: var(--red);
      border-color: #e07060;
    }

    .eopt.sel-medium {
      background: var(--amber-bg);
      color: var(--amber);
      border-color: #d4a843;
    }

    .eopt.sel-high {
      background: var(--accent-bg);
      color: var(--accent);
      border-color: #4a9e72;
    }

    .mfooter {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 1.25rem;
    }

    .del-btn {
      font-size: 12px;
      color: var(--red);
      background: none;
      border: none;
      cursor: pointer;
      font-family: var(--font-body);
      opacity: 0.7;
    }

    .del-btn:hover {
      opacity: 1;
    }

    .mactions {
      display: flex;
      gap: 8px;
    }

    ::-webkit-scrollbar {
      width: 6px;
    }

    ::-webkit-scrollbar-track {
      background: transparent;
    }

    ::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 3px;
    }

    /* Alert banner */
    /* Insights tab */
    .ins-tf {
      display: inline-flex;
      background: var(--surface-hover);
      padding: 4px;
      border-radius: 30px;
      margin-bottom: var(--space-4);
      gap: 2px;
      left: 50%;
      position: relative;
      transform: translateX(-50%);
    }

    .tf-btn {
      padding: var(--space-1) var(--space-3);
      border-radius: 20px;
      border: 1px solid transparent;
      background: transparent;
      color: var(--text3);
      font-size: var(--text-xs);
      font-family: var(--font-body);
      font-weight: 500;
      cursor: pointer;
      transition: all var(--duration-fast) var(--ease);
    }

    .tf-btn:hover {
      color: var(--text);
    }

    .tf-btn.active {
      background: var(--surface-elevated);
      color: var(--text);
      box-shadow: var(--elevation-base);
    }

    .ins-sec {
      background: var(--surface-grad);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      margin-bottom: 24px;
      overflow: hidden;
      box-shadow: var(--elevation-base);
    }

    .ins-summary-card {
      background: var(--surface);
      border-color: var(--accent);
      border-left-width: 4px;
    }

    .ins-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 24px;
      margin-bottom: 24px;
      min-width: 0;
    }
    .ins-grid > * { min-width: 0; }
    @media (max-width: 1000px) { .ins-grid { grid-template-columns: 1fr; } }

    .ins-lbl {
      font-size: 13px;
      color: var(--text);
      font-weight: 600;
      padding: 14px 20px;
      border-bottom: 1px solid var(--border);
      background: rgba(0,0,0,0.02);
      font-family: var(--font-heading);
    }

    /* weekly bar chart */
    .wk-bars {
      display: flex;
      align-items: flex-end;
      justify-content: center;
      gap: 10px;
      height: 20vh;
      min-height: 180px;
      overflow-x: auto;
      padding-bottom: 4px;
      margin: 0 auto;
    }

    .wk-bar-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      flex: 0 0 auto;
      width: 72px;
    }

    .wk-bar-col {
      width: 52px;
      border-radius: 6px 6px 0 0;
      transition: height 0.4s ease;
      min-height: 3px;
      cursor: default;
    }

    .wk-bar-col.strong {
      background: var(--blue);
    }

    .wk-bar-col.partial {
      background: #93b8e0;
    }

    .wk-bar-col.light {
      background: #c8ddf0;
    }

    .wk-bar-lbl {
      font-size: 11px;
      color: var(--text3);
      font-family: var(--font-body);
      white-space: nowrap;
      text-align: center;
    }

    .wk-bar-val {
      font-size: 12px;
      color: var(--text2);
      font-family: var(--font-body);
    }

    /* heatmap — grouped by week */
    .hm-weeks {
      display: flex;
      flex-direction: column;
      gap: 12px;
      width: fit-content;
      margin: 0 auto;
    }

    .hm-week-row {
      display: flex;
      gap: 10px;
      align-items: center;
    }

    .hm-week-lbl {
      font-size: 12px;
      color: var(--text3);
      font-family: var(--font-body);
      width: 64px;
      flex-shrink: 0;
    }

    .hm-cell {
      width: 14px;
      height: 14px;
      border-radius: 4px;
      flex-shrink: 0;
      transition: opacity var(--duration-fast) var(--ease);
    }
    .hm-cell:hover {
      opacity: 0.8;
    }

    .hm-none {
      background: var(--surface2);
    }

    .hm-run {
      background: #9bc4a8;
    }

    .hm-rest {
      background: #b8b0e0;
    }

    .hm-both {
      background: var(--accent);
    }

    .hm-fr {
      background: var(--purple);
      opacity: 0.5;
    }

    /* area distribution */
    .area-dist {
      display: flex;
      flex-direction: column;
      gap: 10px;
      max-width: 620px;
      margin: 0 auto;
    }

    .area-row {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .area-name {
      font-size: 13px;
      color: var(--text2);
      width: 96px;
      flex-shrink: 0;
      font-family: var(--font-body);
    }

    .area-bar-bg {
      flex: 1;
      height: 10px;
      background: var(--surface2);
      border-radius: 5px;
      overflow: hidden;
    }

    .area-bar-fill {
      height: 100%;
      border-radius: 5px;
      transition: width 0.4s ease;
    }

    .area-count {
      font-size: 12px;
      color: var(--text2);
      font-family: var(--font-body);
      width: 56px;
      text-align: right;
      flex-shrink: 0;
    }

    /* energy */
    .energy-row {
      display: flex;
      gap: 10px;
      max-width: 440px;
      margin: 0 auto;
    }

    .energy-card {
      flex: 1;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px 14px;
      text-align: center;
    }

    .energy-val {
      font-size: 28px;
      font-weight: 300;
      letter-spacing: -1px;
      margin-bottom: 6px;
      font-family: var(--font-body);
    }

    .energy-lbl {
      font-size: 10px;
      font-family: var(--font-body);
      color: var(--text3);
      letter-spacing: 0.3px;
    }

    /* stat row */
    .stat-row {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      max-width: 620px;
      margin: 0 auto;
    }

    .stat-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 14px 16px;
    }

    .stat-val {
      font-size: 26px;
      font-weight: 300;
      letter-spacing: -1px;
      margin-bottom: 6px;
      font-family: var(--font-body);
    }

    .stat-lbl {
      font-size: 10px;
      font-family: var(--font-body);
      color: var(--text3);
      letter-spacing: 0.3px;
    }

    /* text summary */
    .summary-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.4rem 1.5rem;
    }

    .summary-text {
      font-size: 14px;
      color: var(--text2);
      line-height: 1.9;
      font-family: var(--font-body);
    }

    .summary-text strong {
      color: var(--text);
      font-weight: 500;
    }

    .ins-empty {
      font-size: var(--text-sm);
      color: var(--text3);
      padding: var(--space-5) var(--space-3);
      text-align: center;
      font-family: var(--font-body);
      background: var(--surface-hover);
      border-radius: var(--radius);
      margin-top: var(--space-4);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    /* legend */
    .legend-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1rem 1.25rem;
    }

    .legend-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 16px;
      margin-top: 8px;
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      color: var(--text2);
      font-family: var(--font-body);
    }

    .legend-dot {
      width: 12px;
      height: 12px;
      border-radius: 2px;
      flex-shrink: 0;
    }

    .legend-bar {
      width: 20px;
      height: 6px;
      border-radius: 3px;
      flex-shrink: 0;
    }

    /* (MVD floating info removed — see Guide tab) */

    /* Category manager modal */
    .cat-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; max-height: 300px; overflow-y: auto; }
    .cat-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--surface2); border: 1px solid var(--border); transition: border-color 0.15s; }
    .cat-item:hover { border-color: var(--border2); }
    .cat-item.others-item { border-style: dashed; opacity: 0.75; }
    .cat-dot-btn { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; cursor: pointer; border: 2px solid transparent; transition: transform 0.12s; }
    .cat-dot-btn:hover { transform: scale(1.2); border-color: rgba(255,255,255,0.4); }
    .cat-name-input { flex: 1; font-size: 13px; color: var(--text); font-family: var(--font-body); background: transparent; border: none; outline: none; min-width: 0; }
    .cat-name-input:focus { background: var(--bg); border-radius: 4px; padding: 1px 4px; margin: -1px -4px; }
    .cat-del { background: none; border: none; color: var(--text3); font-size: 16px; cursor: pointer; line-height: 1; padding: 0; transition: color 0.15s; flex-shrink: 0; }
    .cat-del:hover { color: var(--red); }
    .cat-drag-handle { color: var(--text3); font-size: 12px; cursor: grab; padding: 0 2px; flex-shrink: 0; user-select: none; }
    .cat-drag-handle:hover { color: var(--text2); }
    .cat-item.cat-dragging { opacity: 0.35; }
    .cat-item.cat-drag-over { border-top: 2px solid var(--blue); }
    /* Inline colour picker popover */
    .cat-color-popover {
      position: absolute; z-index: 500; background: var(--surface); border: 1px solid var(--border2);
      border-radius: var(--radius); padding: 10px; box-shadow: 0 4px 16px rgba(100,60,20,0.10);
      display: none;
    }
    .cat-color-popover.open { display: block; }
    .cat-add-row { display: flex; gap: 8px; align-items: center; margin-bottom: 0.75rem; }
    .cat-add-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 13px; font-family: var(--font-body); outline: none; }
    .cat-add-row input:focus { border-color: var(--border2); }
    .swatch-row { display: flex; gap: 6px; margin-bottom: 0.75rem; flex-wrap: wrap; align-items: center; }
    .swatch { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: all 0.12s; flex-shrink: 0; }
    .swatch:hover { transform: scale(1.15); }
    .swatch.picked { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
    .color-picker-wrap { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
    .color-picker-label { font-size: 11px; color: var(--text3); font-family: var(--font-body); }
    input[type=color].custom-color-input {
      width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border);
      cursor: pointer; padding: 0; background: none; outline: none;
      -webkit-appearance: none; appearance: none; overflow: hidden;
    }
    input[type=color].custom-color-input::-webkit-color-swatch-wrapper { padding: 0; }
    input[type=color].custom-color-input::-webkit-color-swatch { border: none; border-radius: 50%; }
    input[type=color].custom-color-input.picked { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }

    /* ── FOCUS TOGGLE (Stack tab) ─────────────────────────────────── */
    .si-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
    .focus-toggle { display: flex; border-radius: 20px; overflow: hidden; border: 1px solid var(--border); flex-shrink: 0; }
    .focus-toggle button {
      padding: 3px 10px; font-size: 11px; border: none; background: transparent;
      cursor: pointer; font-family: var(--font-body); color: var(--text3);
      transition: all 0.15s; letter-spacing: 0.2px;
    }
    .focus-toggle button.focus-high-on { background: var(--blue); color: #fff; }
    .focus-toggle button.focus-low-on  { background: var(--surface2); color: var(--text2); }
    .si.focus-high { border-left: 3px solid var(--blue); }
    .si.focus-low  { border-left: 3px solid var(--border); }
    .si.focus-low .sinput { color: var(--text2); }
    .si.focus-low .drag-handle { opacity: 0.5; }
    .si-focus-badge {
      font-size: 10px; padding: 2px 7px; border-radius: 10px; font-family: var(--font-body);
      letter-spacing: 0.2px; flex-shrink: 0;
    }
    .si-focus-badge.high { background: var(--blue-bg); color: var(--blue); }
    .si-focus-badge.low  { background: var(--surface2); color: var(--text3); }
    .stack-section-lbl {
      font-size: var(--text-xs); color: var(--text); font-family: var(--font-heading);
      letter-spacing: 0.05em; margin: var(--space-4) 0 var(--space-2) 0; display: flex; align-items: center; gap: var(--space-2);
      font-weight: 600; text-transform: uppercase;
    }
    .stack-section-lbl::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to right, var(--border2), transparent); }

    /* ── STACK TAB TASKS (To-Do List) ─────────────────────────────── */
    .si-tasks { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 8px; }
    .task-list { display: flex; flex-direction: column; gap: 8px; }
    .task-item {
      display: flex; align-items: flex-start; gap: 10px;
      background: var(--surface-hover); border: 1px solid transparent;
      padding: 10px 12px; border-radius: var(--radius-sm);
      transition: background var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
    }
    .task-item:hover { background: var(--surface-elevated); box-shadow: var(--elevation-base); }
    .task-checkbox-fake {
      width: 14px; height: 14px; border: 1.5px solid var(--text3); opacity: 0.5;
      border-radius: 4px; flex-shrink: 0; margin-top: 2px;
    }
    .task-text { flex: 1; font-size: 13px; color: var(--text); line-height: 1.4; word-break: break-word; }
    .task-del, .task-backlog {
      background: none; border: none; padding: 4px; margin: -4px;
      color: var(--text3); cursor: pointer; border-radius: 4px;
      display: flex; align-items: center; justify-content: center;
      transition: all 0.15s;
      opacity: 0; /* Hidden by default */
    }
    .task-item:hover .task-del, .task-item:hover .task-backlog { opacity: 1; }
    .task-del:hover { color: var(--red); background: #ff444415; }
    .task-backlog:hover { color: var(--blue); background: var(--blue-bg); }
    .task-del i, .task-backlog i {
      width: 16px;
      height: 16px;
    }
    .task-add { margin-top: 0px; }
    .task-input {
      width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
      border: 1px dashed var(--border); background: transparent;
      font-size: 13px; color: var(--text); outline: none;
      transition: all 0.2s; font-family: inherit;
    }
    .task-input::placeholder { color: var(--text3); font-style: italic; }
    .task-input:focus { border-color: var(--blue); border-style: solid; background: var(--surface); box-shadow: 0 0 0 2px rgba(37,99,168,0.15); }

    /* ── CARRY FORWARD BUTTON ─────────────────────────────────────── */
    .carry-btn {
      font-size: 12px; padding: 6px 14px; border-radius: var(--radius-sm);
      border: 1px dashed var(--border); background: transparent; color: var(--text3);
      cursor: pointer; font-family: var(--font-body); transition: all 0.15s;
      display: flex; align-items: center; gap: 6px;
      white-space: nowrap;
    }
    .carry-btn:hover { border-color: var(--border2); color: var(--text2); background: var(--surface2); }
    .carry-btn.carried { border-style: solid; border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
    .carry-btn.active { color: var(--blue); background: var(--blue-bg); border-color: var(--blue); border-style: solid; }

    /* ── QUICK-PICK DURATION CHIPS ────────────────────────────────── */
    .dur-chips { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
    .dur-chip {
      padding: 4px 10px; border-radius: 14px; font-size: 12px; border: 1px solid var(--border);
      background: var(--surface2); color: var(--text2); cursor: pointer;
      font-family: var(--font-body); transition: all 0.12s;
    }
    .dur-chip:hover { border-color: var(--border2); color: var(--text); }
    .dur-chip.picked { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }
    .dur-validation { font-size: 11px; color: var(--red); margin-top: 4px; min-height: 16px; font-family: var(--font-body); }

    /* ── TIME SLOT SELECTOR ───────────────────────────────────────── */
    .time-slots { display: flex; gap: 6px; flex-wrap: wrap; }
    .time-slot {
      padding: 5px 12px; border-radius: var(--radius-sm); font-size: 12px;
      border: 1px solid var(--border); background: transparent; color: var(--text2);
      cursor: pointer; font-family: var(--font-body); transition: all 0.12s;
    }
    .time-slot:hover { border-color: var(--border2); }
    .time-slot.sel-slot { background: var(--amber-bg); color: var(--amber); border-color: #d4a843; }

    /* ── CONFIGURABLE TARGETS MODAL ───────────────────────────────── */
    .targets-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .target-field label { display: block; font-size: 11px; color: var(--text3); font-family: var(--font-body); letter-spacing: 0.3px; margin-bottom: 6px; }
    .target-field input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 14px; font-family: var(--font-body); outline: none; text-align: center; }
    .target-field input:focus { border-color: var(--border2); }

    /* ── LANDING PAGE (Overview tab) ─────────────────────────────── */
    .lp-intention {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem;
    }
    .lp-intention-lbl {
      font-size: 11px; color: var(--text3); font-family: var(--font-body);
      letter-spacing: 0.4px; margin-bottom: 6px;
    }
    .lp-intention-text {
      font-size: 15px; color: var(--text); line-height: 1.6;
      font-style: italic; opacity: 0.85; font-family: var(--font-journal);
    }
    .lp-intention-empty { font-size: 13px; color: var(--text3); font-style: italic; }

    .lp-section { 
      margin-bottom: 2rem;
      opacity: 0.95;
    }
    .lp-section:has(.day-card.today) {
      opacity: 1;
    }
    .lp-section-hdr {
      font-size: 13px;
      color: var(--text);
      font-weight: 600;
      font-family: var(--font-heading);
      letter-spacing: -0.2px;
      margin-bottom: 16px;
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .lp-section-hdr::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to right, var(--border), transparent); }

    /* Focus items — compact card grid */
    .lp-focus-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 8px;
      margin-bottom: 4px;
    }
    .lp-focus-item {
      display: flex; flex-direction: column; gap: 5px;
      padding: 10px 12px; border-radius: var(--radius);
      background: var(--surface); border: 1px solid var(--border);
      transition: border-color 0.15s; min-height: 64px;
    }
    .lp-focus-item.lp-high { border-left: 3px solid var(--blue); }
    .lp-focus-item.lp-low { border-left: 3px solid var(--border); opacity: 0.6; }
    .lp-focus-badge {
      font-size: 11px; padding: 2px 8px; border-radius: 4px;
      font-weight: 500; align-self: flex-start;
    }
    .lp-focus-text { font-size: 12px; color: var(--text2); line-height: 1.45; }
    .lp-focus-text.empty { color: var(--text3); font-style: italic; }

    /* Habits row */
    .lp-habits {
      display: flex; flex-wrap: wrap; gap: 8px;
    }
    .lp-habit-chip {
      display: flex; align-items: center; gap: 7px;
      padding: 7px 12px; border-radius: var(--radius);
      background: var(--surface); border: 1px solid var(--border);
      cursor: pointer; transition: all 0.15s; user-select: none;
      font-size: 13px; color: var(--text2);
    }
    .lp-habit-chip.done {
      border-color: var(--border2);
      background: var(--surface2);
      color: var(--text);
    }
    .lp-habit-chip input[type=checkbox] { cursor: pointer; margin: 0; }
    .lp-habit-check { width: 16px; height: 16px; flex-shrink: 0; }

    /* Habit streaks */
    .lp-streaks { display: flex; flex-wrap: wrap; gap: 6px; }
    .lp-streak-item {
      font-size: 12px; font-family: var(--font-body);
      color: var(--text2); padding: 4px 10px;
      border: 1px solid var(--border); border-radius: 20px;
      background: var(--surface);
    }
    .lp-streak-item .streak-count { font-weight: 500; color: var(--text); }

    /* Past week — not shown (user chose "nothing") */

    /* ── EXPORT TIMESTAMP ─────────────────────────────────────────── */
    .export-meta { font-size: 11px; color: var(--text3); font-family: var(--font-body); }

    /* ── HELP BUTTON ──────────────────────────────────────────────── */
    .help-btn {
      width: 28px; height: 28px; border-radius: 50%;
      border: 1px solid var(--border); background: var(--surface);
      color: var(--text3); font-size: 13px; font-weight: 600;
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      transition: all 0.15s; font-family: Georgia, serif; flex-shrink: 0;
    }
    .help-btn:hover { border-color: var(--border2); color: var(--text); background: var(--surface2); }

    /* ── HELP MODAL ───────────────────────────────────────────────── */
    .help-modal {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: 14px; padding: 1.5rem;
      width: min(600px, 94vw); max-height: 80vh;
      overflow-y: auto; box-shadow: 0 8px 32px rgba(100,60,20,0.10);
    }
    .help-modal .modal-title { margin-bottom: 1.25rem; }
    .help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    @media (max-width: 520px) { .help-grid { grid-template-columns: 1fr; } }
    .hc {
      background: var(--surface2); border: 1px solid var(--border);
      border-radius: var(--radius); padding: 1rem 1.1rem;
    }
    .hc-title {
      font-size: 13px; font-weight: 500; margin-bottom: 8px;
      display: flex; align-items: center; gap: 8px; color: var(--text);
    }
    .hc-badge { font-size: 10px; padding: 2px 8px; border-radius: 4px; }
    .hc-body { font-size: 13px; color: var(--text2); line-height: 1.75; }
    .hc-rule {
      margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border);
      font-size: 11px; color: var(--text3); font-family: var(--font-body);
    }

    /* ── DRAG-AND-DROP STACK ITEMS ────────────────────────────────── */
    .si {
      transition: transform 0.22s cubic-bezier(0.25,0.8,0.25,1), opacity 0.18s ease;
      will-change: transform;
    }
    .si.dragging { opacity: 0.35; pointer-events: none; }
    .si.flip-animating { transition: transform 0.22s cubic-bezier(0.25,0.8,0.25,1) !important; }
    .drag-handle {
      color: var(--text3); font-size: 13px; cursor: grab;
      /* Expand hit area: tall enough for the full row, wide enough to cover handle + badge */
      padding: 12px 8px 12px 4px;
      margin: -12px 6px -12px -8px; /* negative margin to not push content */
      flex-shrink: 0; user-select: none;
      line-height: 1; touch-action: none;
      display: flex; align-items: center;
      border-radius: var(--radius-sm);
      transition: background 0.12s;
      pointer-events: none;
    }
    .drag-handle:active { cursor: grabbing; }
    .drag-handle:hover { color: var(--text2); }
    /* Drag zone wraps handle + badge — the whole left portion is grabbable */
    .drag-zone {
      display: flex; align-items: center; gap: 8px;
      cursor: grab; flex-shrink: 0; padding: 4px 6px 4px 0;
      margin: -4px 0; border-radius: var(--radius-sm);
    }
    .drag-zone:active { cursor: grabbing; }
    /* Section labels become drop targets during drag */
    .stack-section-drop.drop-ready {
      padding: 8px 10px; border-radius: var(--radius-sm);
      border: 1px dashed var(--border2); cursor: copy;
      transition: all 0.15s;
    }
    .stack-section-drop.drop-over {
      background: var(--blue-bg); color: var(--blue);
      border-color: var(--blue); border-style: solid;
    }
    /* Section drop zones */
    .stack-drop-zone {
      min-height: 8px; border-radius: var(--radius-sm);
      transition: all 0.15s;
    }
    .stack-drop-zone.drop-active {
      min-height: 36px; background: var(--blue-bg);
      border: 1px dashed var(--blue); margin: 4px 0;
    }
    /* Insertion line indicator */
    #dragInsertLine {
      display: none; position: fixed; left: 0; right: 0; height: 2px;
      background: var(--blue); pointer-events: none; z-index: 9999;
      box-shadow: 0 0 6px rgba(37,99,168,0.5);
    }
    #dragInsertLine::before {
      content: ''; position: absolute; left: 0; top: -3px;
      width: 8px; height: 8px; border-radius: 50%; background: var(--blue);
    }
    /* Stack container needs to be a proper drag target */
    #stackDragContainer { position: relative; scroll-behavior: auto; }
    /* ── CUSTOM HABITS ────────────────────────────────────────────── */
    .habit-manager-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; max-height: 240px; overflow-y: auto; }
    .habit-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface2); border: 1px solid var(--border); }
    .habit-item-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
    .habit-item-name { flex: 1; font-size: 13px; color: var(--text); }
    .habit-item-target { font-size: 11px; color: var(--text3); font-family: var(--font-body); flex-shrink: 0; }
    .habit-item-del { background: none; border: none; color: var(--text3); font-size: 16px; cursor: pointer; line-height: 1; padding: 0; transition: color 0.15s; }
    .habit-item-del:hover { color: var(--red); }
    .habit-add-row { display: flex; gap: 6px; align-items: center; margin-bottom: 0.5rem; }
    .habit-add-row input[type=text] { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 13px; font-family: var(--font-body); outline: none; }
    .habit-add-row input[type=text]:focus { border-color: var(--border2); }
    .habit-add-row input[type=number] { width: 56px; padding: 8px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 13px; font-family: var(--font-body); outline: none; text-align: center; }
    .habit-add-row input[type=number]:focus { border-color: var(--border2); }
    .habit-builtin-note { font-size: 11px; color: var(--text3); font-family: var(--font-body); margin-bottom: 0.75rem; line-height: 1.5; }

    /* ── HABIT CONSISTENCY INSIGHT ────────────────────────────────── */
    .habit-cons-list { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
    .habit-cons-row { display: flex; flex-direction: column; gap: 6px; }
    .habit-cons-header { display: flex; align-items: center; justify-content: space-between; }
    .habit-cons-name { font-size: 13px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 8px; }
    .habit-cons-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .habit-cons-pct { font-size: 13px; font-family: var(--font-body); color: var(--text2); }
    .habit-cons-bar-bg { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
    .habit-cons-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
    .habit-cons-dots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 2px; }
    .habit-cons-cell { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }

    .habit-cons-cell.missed { background: var(--surface2); }
    .habit-cons-cell.fr { opacity: 0.35; }


        /* ── AUTH SCREEN ──────────────────────────────────────────────────────── */
    .auth-screen {
      position: fixed; inset: 0; z-index: 1000;
      background: var(--bg);
      display: flex; align-items: center; justify-content: center;
      padding: 1rem;
    }

    .auth-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 2rem 2rem 1.75rem;
      width: min(400px, 100%);
      box-shadow: 0 8px 40px rgba(100,60,20,0.08);
    }

    .auth-logo {
      display: flex; align-items: center; gap: 10px;
      margin-bottom: 1.75rem;
      font-size: 17px; font-weight: 500; color: var(--text);
      font-family: var(--font-body);
    }

    /* Tab row */
    .auth-tabs {
      display: flex; gap: 2px;
      background: var(--surface2);
      border-radius: 8px; padding: 3px;
      margin-bottom: 1.5rem;
    }

    .auth-tab {
      flex: 1; padding: 7px 0;
      border-radius: 6px; border: none;
      background: transparent; color: var(--text2);
      font-size: 13px; font-family: var(--font-body);
      cursor: pointer; transition: all 0.15s;
    }

    .auth-tab.active {
      background: var(--surface); color: var(--text);
      font-weight: 600;
      box-shadow: var(--shadow);
      border: 1px solid var(--border2);
    }

    /* Panels — only the active one is visible */
    .auth-panel { display: none; }
    .auth-panel.active { display: block; }

    /* Fields */
    .auth-field { margin-bottom: 1rem; }
    .auth-field label {
      display: block;
      font-size: 11px; color: var(--text3);
      font-family: var(--font-body); letter-spacing: 0.3px;
      margin-bottom: 6px;
    }
    .auth-field input {
      width: 100%; padding: 10px 12px;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: var(--bg); color: var(--text);
      font-size: 14px; font-family: var(--font-body);
      outline: none; transition: border-color 0.15s;
    }
    .auth-field input:focus { border-color: var(--border2); }

    /* Submit button */
    .auth-submit {
      width: 100%; padding: 11px;
      background: #1a1916; color: #fff;
      border: none; border-radius: var(--radius-sm);
      font-size: 14px; font-family: var(--font-body);
      font-weight: 500; cursor: pointer;
      transition: background 0.15s; margin-top: 0.5rem;
    }
    .auth-submit:hover    { background: #333; }
    .auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

    /* Banner (errors / success messages) */
    .auth-banner {
      padding: 10px 12px; border-radius: var(--radius-sm);
      font-size: 13px; font-family: var(--font-body);
      margin-bottom: 1rem; line-height: 1.5;
    }
    .auth-banner-error {
      background: var(--red-bg); color: var(--red);
      border: 1px solid #e07060;
    }
    .auth-banner-ok {
      background: var(--accent-bg); color: var(--accent);
      border: 1px solid #4a9e72;
    }

    /* ── Daily journal ────────────────────────────────────────────────────── */
    .journal-toggle-row { margin-top: 4px; }

    .journal-toggle {
      width: 100%;
      padding: 5px 9px;
      border: 1px solid transparent;
      border-radius: var(--radius-sm);
      background: transparent;
      color: var(--text3);
      font-size: 11px;
      cursor: pointer;
      font-family: var(--font-body);
      display: flex;
      align-items: center;
      gap: 5px;
      transition: all 0.15s;
    }

    .journal-toggle:hover {
      border-color: var(--border2);
      color: var(--text2);
    }

    .journal-toggle.has-entry {
      border-style: solid;
      border-color: var(--accent-bg);
      color: var(--accent);
    }

    .journal-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--accent);
      flex-shrink: 0;
    }

    .journal-area { margin-top: 6px; }

    .journal-ta {
      width: 100%;
      padding: 8px 10px;
      border: 1px solid var(--border);
      border-radius: var(--radius-sm);
      background: var(--bg);
      color: var(--text);
      font-size: 13px;
      font-family: var(--font-journal);
      resize: vertical;
      min-height: 64px;
      max-height: 140px;
      outline: none;
      line-height: 1.8;
      transition: border-color 0.15s;
    }

    .journal-ta:focus { border-color: var(--border2); }

    /* Insights journal entries */
    .journal-ins-entry {
      padding: 12px 0;
      border-bottom: 1px solid var(--border);
    }

    .journal-ins-entry:last-child { border-bottom: none; }

    .journal-ins-date {
      font-size: 11px;
      color: var(--text3);
      font-family: var(--font-body);
      letter-spacing: 0.3px;
      margin-bottom: 5px;
    }

    .journal-ins-text {
      font-size: 13px;
      color: var(--text2);
      line-height: 1.8;
    }

    .lp-section {
      transition: opacity var(--duration-normal) var(--ease);
    }
    
    .lp-section:not(:has(.ov-day-wrap)) {
      opacity: 0.9;
    }

    .lp-section-hdr {
      font-size: 11px;
      color: var(--text3);
      font-weight: 600;
      letter-spacing: 0.5px;
      margin-bottom: 1.25rem;
      font-family: var(--font-heading);
      text-transform: uppercase;
    }

    .lp-focus-item {
      background: var(--surface-grad);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.25rem;
      transition: all var(--duration-fast) var(--ease);
    }

    .lp-focus-item:hover {
      box-shadow: var(--elevation-base);
      border-color: var(--border2);
    }

    .lp-todos {
      margin-top: 10px;
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding-top: 12px;
      border-top: 1px dashed var(--border);
    }

    .lp-todo-item {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      font-size: 12.5px;
      color: var(--text2);
      transition: color 0.15s;
    }

    .lp-todo-item:hover {
      color: var(--text);
    }

    .lp-todo-item.done .lp-todo-text {
      text-decoration: line-through;
      color: var(--text3);
    }

    .lp-todo-item input[type="checkbox"] {
      width: 14px;
      height: 14px;
      accent-color: var(--accent);
      cursor: pointer;
    }

    /* ── Stack Task Inputs ── */
    .si-tasks {
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px dashed var(--border);
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .task-item {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      color: var(--text2);
    }

    .task-dot { color: var(--text3); }
    .task-text { flex: 1; }

    .task-del {
      background: none;
      border: none;
      color: var(--text3);
      font-size: 16px;
      cursor: pointer;
      padding: 0 4px;
      line-height: 1;
    }

    .task-del:hover { color: var(--red); }

    .task-input {
      width: 100%;
      background: transparent;
      border: none;
      border-bottom: 1px solid transparent;
      font-size: 12px;
      color: var(--text2);
      padding: 2px 0;
      outline: none;
      font-family: inherit;
    }

    .task-input:focus {
      border-bottom-color: var(--accent);
    }

    .lp-todo-input::placeholder { color: var(--text3); font-style: italic; }

    /* ── Missed Day Indicators ── */
    .day-card.no-log {
      border: 1px dashed var(--amber-bg);
      background: color-mix(in srgb, var(--amber-bg) 5%, transparent);
    }

    .missed-msg {
      font-size: 11px;
      color: var(--amber);
      font-family: var(--font-body);
      margin-bottom: 8px;
      letter-spacing: 0.2px;
    }

    .account-modal {
      max-width: 400px;
    }

    .account-modal .auth-field label {
      color: var(--text3);
      font-weight: 500;
      margin-bottom: 8px;
    }




    /* ── Auth screen ──────────────────────────────────────────────────────── */
    .auth-screen {
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--bg);
      padding: 1.5rem;
    }

    .auth-card {
      width: 100%;
      max-width: 400px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 2.5rem 2rem;
      box-shadow: 0 8px 40px rgba(100,60,20,0.08), 0 1px 4px rgba(100,60,20,0.05);
      animation: auth-in 0.3s ease;
    }

    @keyframes auth-in {
      from { opacity: 0; transform: translateY(12px) scale(0.98); }
      to   { opacity: 1; transform: translateY(0) scale(1); }
    }

    .auth-logo {
      display: flex;
      align-items: center;
      gap: 14px;
      margin-bottom: 2rem;
    }

    .auth-logo-text {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .auth-logo-name {
      font-size: 18px;
      font-weight: 600;
      color: var(--text);
      letter-spacing: -0.3px;
    }

    .auth-logo-sub {
      font-size: 12px;
      color: var(--text3);
    }

    .auth-social {
      margin-top: 0.5rem;
      margin-bottom: 2rem;
    }

    .auth-google-btn {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 12px;
      padding: 12px;
      background: var(--surface);
      color: var(--text);
      border: 1px solid var(--border2);
      border-radius: 10px;
      font-size: 15px;
      font-weight: 500;
      font-family: var(--font-body);
      cursor: pointer;
      transition: all 0.2s var(--ease);
      box-shadow: 0 1px 2px rgba(100,60,20,0.05);
    }

    .auth-google-btn:hover {
      background: var(--surface-hover);
      border-color: var(--text3);
      box-shadow: 0 4px 12px rgba(100,60,20,0.07);
      transform: translateY(-1px);
    }

    .auth-google-btn:active {
      transform: translateY(0);
    }

    .auth-footer-note {
      font-size: 12px;
      color: var(--text3);
      text-align: center;
      line-height: 1.5;
    }

    /* Banner */
    .auth-banner {
      padding: 10px 14px;
      border-radius: 8px;
      font-size: 13px;
      margin-bottom: 1.25rem;
      line-height: 1.5;
    }

    .auth-banner-error {
      background: var(--red-bg);
      color: var(--red);
      border: 1px solid #e8b4b0;
    }

    html[data-theme="dark"] .auth-banner-error { border-color: #5a2a28; }

    .auth-banner-ok {
      background: var(--accent-bg);
      color: var(--accent);
      border: 1px solid #b0d4c0;
    }

    /* Panels */
    .auth-panel { display: none; }
    .auth-panel.active { display: block; }

    /* Fields */
    .auth-field {
      margin-bottom: 1rem;
    }

    .auth-field label {
      display: block;
      font-size: 11px;
      color: var(--text3);
      font-family: var(--font-body);
      letter-spacing: 0.4px;
      margin-bottom: 6px;
    }

    .auth-field input {
      width: 100%;
      padding: 10px 13px;
      border: 1px solid var(--border);
      border-radius: 9px;
      background: var(--bg);
      color: var(--text);
      font-size: 14px;
      font-family: var(--font-body);
      outline: none;
      transition: border-color 0.18s, box-shadow 0.18s;
    }

    .auth-field input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(74,158,114,0.12);
    }

    /* Fields */
    .auth-field {
      margin-bottom: 1.25rem;
    }

    /* Submit button */
    .auth-submit {
      width: 100%;
      padding: 12px;
      border-radius: 10px;
      border: none;
      background: #1a1916;
      color: #fff;
      font-size: 14px;
      font-weight: 500;
      font-family: var(--font-body);
      cursor: pointer;
      margin-bottom: 0.75rem;
      transition: background 0.18s, transform 0.15s, box-shadow 0.15s;
      box-shadow: 0 2px 8px rgba(100,60,20,0.12);
    }

    .auth-submit:hover {
      background: #333;
      transform: translateY(-1px);
      box-shadow: 0 4px 16px rgba(100,60,20,0.14);
    }

    .auth-submit:active { transform: translateY(0); }

    html[data-theme="dark"] .auth-submit     { background: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
    html[data-theme="dark"] .auth-submit:hover { background: #5ab882; }

/* OVERRIDES FOR NEW HEADINGS */
h1, h2, h3, .modal-title, .app-title, .lp-section-hdr, .hc-title, .sg-title { font-family: var(--font-heading); }

/* -- ACCOUNTABILITY REBUILD - PHASE 1 -------------------------- */
.block-pill-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.block-completion-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.block-intent {
  font-size: 11px;
  color: var(--text2);
  margin-top: 3px;
  line-height: 1.3;
  opacity: 0.8;
}

.linked-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  max-height: 150px;
  overflow-y: auto;
  padding-right: 4px;
}

.linked-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text2);
  background: var(--surface2);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.linked-task-item:hover {
  background: var(--surface-hover);
}

.inline-add-task input {
  font-size: 11px !important;
  padding: 6px 10px !important;
  opacity: 0.8;
}

.copt {
  flex: 1;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.copt:hover {
  border-color: var(--border2);
}

.copt.sel-done {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: #4a9e72;
}

.copt.sel-partial {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: #d4a843;
}

.copt.sel-abandoned {
  background: var(--red-bg);
  color: var(--red);
  border-color: #e07060;
}

/* -- ACCOUNTABILITY REBUILD - PHASE 2 (STOPWATCH) ---------- */
.timer-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  padding: 6px 12px;
  border-radius: 30px;
  border: 1px solid var(--border);
  margin-left: 12px;
  box-shadow: var(--elevation-base);
}

.timer-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.timer-clock {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 45px;
  text-align: center;
}

.timer-stop-btn {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.timer-stop-btn:hover {
  background: var(--red);
  color: white;
  box-shadow: 0 2px 8px var(--red-bg);
}

/* -- STACK ACTION ROW LAYOUT ------------------------------- */
.stack-action-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-top: 1rem;
  margin-bottom: 2rem;
}
.stack-controls-group {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.backlog-add-form.integrated {
  flex: 1;
  display: flex;
  gap: 10px;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}
.backlog-add-form.integrated:focus-within { border-color: var(--blue); }

.backlog-add-form.integrated .backlog-input {
  background: transparent;
  border: none;
  flex: 1;
  padding: 8px 4px;
  color: var(--text);
  font-size: 14px;
}
.backlog-add-form.integrated .backlog-input:focus { box-shadow: none; }

.backlog-add-form.integrated .backlog-select {
  width: 140px; /* More compact */
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 4px 12px;
  font-size: 13px;
  border-radius: 8px;
  color: var(--text2);
}

/* Subtle Action Buttons (Ghost Style) */
.btn-s {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.05); /* Very subtle border */
  color: var(--text3);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-s:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-color: var(--border);
  transform: translateY(-1px);
}
.btn-s i {
  width: 17px;
  height: 17px;
}

/* Backlog Internal Task Styling */
.si-tasks {
  margin-top: 0.5rem;
  padding: 0 0.5rem 0.5rem 3.5rem; /* Indented to align after the category tag */
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.si-tasks .task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.si-tasks .task-item:hover {
  opacity: 1;
}

.si-tasks .task-text {
  flex: 1;
  font-size: 13px;
  color: var(--text2);
  outline: none;
  border-bottom: 1px solid transparent;
}
.si-tasks .task-text:focus {
  border-bottom: 1px solid var(--border);
}

.si-tasks .task-input {
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--border);
  padding: 4px 0;
  font-size: 12px;
  color: var(--text3);
  font-family: inherit;
  width: 100%;
}
.si-tasks .task-input:focus {
  outline: none;
  border-bottom: 1px solid var(--accent);
  color: var(--text);
}

.si-tasks .task-del, .si-tasks .task-pull {
  background: transparent;
  border: none;
  color: var(--text3);
  opacity: 0;
  padding: 4px; /* Increased from 2px */
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.si-tasks .task-del i, .si-tasks .task-pull i {
  width: 16px;
  height: 16px;
}
.si-tasks .task-item:hover .task-del, .si-tasks .task-item:hover .task-pull {
  opacity: 1;
}
.si-tasks .task-pull:hover {
  color: var(--blue);
}
.si-tasks .task-del:hover {
  color: var(--red);
}

.start-timer-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.offset-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.offset-chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 14px;
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.15s;
}

.offset-chip:hover {
  border-color: var(--border2);
  color: var(--text2);
}

.offset-chip.selected {
  background: var(--blue-bg);
  color: var(--blue);
  border-color: var(--blue);
}

.day-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ── TAB HIGHLIGHTING ─────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding: 0 0.5rem;
}
.tab {
  padding: 0.75rem 0.25rem;
  font-weight: 500;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  font-family: var(--font-body);
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  font-weight: 600;
}
.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* ── NEW STACK HIERARCHY (REFINED) ────────────────────────────── */
.intention-box.predominant {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 2.5rem;
  border-radius: 20px;
  margin-bottom: 2.5rem;
  box-shadow: var(--elevation-base);
  border-left: 6px solid var(--blue);
  transition: all 0.2s;
  text-align: center;
}
.intention-box.predominant .ilbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.02em;
  margin-bottom: 16px;
}
.intention-box.predominant .iinput {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text);
  background: transparent;
  width: 100%;
  border: none;
  outline: none;
  font-family: var(--font-journal);
  text-align: center;
  font-style: italic;
  border-bottom: 2px dashed transparent;
  transition: all 0.3s;
  cursor: text;
}
.intention-box.predominant:hover .iinput {
  border-bottom-color: var(--border);
}
.intention-box.predominant .iinput:focus {
  border-bottom-color: var(--blue);
  background: rgba(59, 130, 246, 0.03);
}

.si {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--elevation-base);
  transition: all var(--duration-normal) var(--ease);
}
.si:hover {
  box-shadow: var(--elevation-hover);
  transform: translateY(-2px);
  border-color: var(--border2);
}
.si-main {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
}
.sinput {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-body);
  font-weight: 500;
  outline: none;
  padding: 4px 0;
}

#backlogList {
  display: flex; flex-direction: column; gap: 0.75rem;
  padding-bottom: 3rem;
}
.backlog-card {
  background: #1c2230;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 16px;
}
.backlog-card:hover { border-color: var(--blue); }
.backlog-card .si-main {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.backlog-actions { display: flex; align-items: center; gap: 12px; }
.backlog-pull-btn {
  background: var(--surface); color: var(--text2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.backlog-del-btn {
  background: none; border: none; color: var(--text3);
  cursor: pointer; font-size: 20px; transition: color 0.15s;
}

/* ── MODAL ERROR MESSAGES ───────────────────────────────────────── */
.modal-error {
  display: none;
  font-size: 12px;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, transparent);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border-left: 3px solid var(--red);
  animation: fadeIn 0.2s ease;
}
.modal-error.visible { display: block; }

/* ── ACTIVE TIMER INDICATORS ────────────────────────────────────── */
.active-timer-card {
  background: var(--surface-elevated);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: pulse-border 2s infinite;
}
@keyframes pulse-border {
  0% { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
  50% { border-color: var(--accent); }
  100% { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
}
.active-timer-info { flex: 1; }
.active-timer-cat { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; letter-spacing: 0.05em; }
.active-timer-intent { font-size: 16px; font-weight: 500; color: var(--text); }
.active-timer-clock { font-family: 'DM Mono', monospace; font-size: 20px; font-weight: 600; color: var(--text); }

/* ── OFFSET CHIPS MANUAL INPUT ──────────────────────────────────── */
.st-manual-wrap { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.st-manual-input { 
  width: 50px; 
  padding: 6px 8px; 
  border: 1px solid var(--border); 
  border-radius: var(--radius-sm); 
  background: var(--surface2); 
  color: var(--text); 
  font-size: 13px; 
  font-family: 'DM Mono', monospace;
  text-align: center; 
  outline: none;
  transition: all 0.15s;
}
.st-manual-input:focus { border-color: var(--accent); }
/* Hide spin buttons */
.st-manual-input::-webkit-outer-spin-button,
.st-manual-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.st-manual-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ── BADGE BUTTONS (MVD / FULL REST) ────────────────────────────── */
.badge-btn {
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text3);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.badge-btn:hover {
  background: var(--surface-hover);
  border-color: var(--text3);
  color: var(--text);
}

.badge-btn.mvd-on {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: #d1b88e;
}

.badge-btn.fr-on {
  background: var(--purple-bg);
  color: var(--purple);
  border-color: #b0a8d6;
}

html[data-theme="light"] .backlog-agenda-card {
  background: #f8faff; border-color: #e0e9f5;
}

/* ── TOAST NOTIFICATIONS ─────────────────────────────────────────── */
#toastContainer {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.wt-toast {
  min-width: 280px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(100,60,20,0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  pointer-events: auto;
  
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.wt-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-info { border-left: 4px solid var(--accent); }
.toast-success { border-left: 4px solid var(--green); }
.toast-warning { border-left: 4px solid var(--amber); }
.toast-error { border-left: 4px solid var(--red); }

.wt-toast i { flex-shrink: 0; }

/* ── BACKLOG / AGENDA REFACTOR STYLES ────────────────────────────── */
.backlog-agenda-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
  transition: all 0.2s var(--ease);
}

.backlog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
}

.backlog-title-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  padding: 2px 0;
  outline: none;
  transition: border-bottom 0.2s;
}

.backlog-title-input:focus {
  border-bottom-color: var(--accent);
}

.backlog-task-list {
  padding-left: 1rem;
  border-left: 1px dashed var(--border);
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.backlog-task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.backlog-task-item:hover {
  border-color: var(--border);
  background: var(--surface-hover);
}

.backlog-task-item .task-text {
  flex: 1;
  font-size: 13px;
  outline: none;
}

.backlog-task-item button {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text3);
  opacity: 0.4;
  transition: all 0.2s var(--ease);
}

.backlog-task-item button:hover {
  opacity: 1;
  background: var(--surface-hover);
  color: var(--text);
}

.backlog-task-item .task-pull:hover {
  color: var(--accent);
}

.backlog-task-item .task-del:hover {
  color: var(--red);
}

.backlog-task-item button i {
  width: 14px;
  height: 14px;
}

.backlog-add-task-row {
  margin-top: 12px;
  padding-left: 1rem;
}

.backlog-add-task-input {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-style: italic;
  font-family: inherit;
  outline: none;
  width: 100%;
}

.backlog-add-task-input::placeholder {
  color: var(--text3);
  opacity: 0.7;
}

body.modal-open { overflow: hidden; }

