@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');
:root{
      color-scheme: light;
      --bg:#f2f8fb;
      --bg-2:#e7f4f1;
      --surface:#ffffff;
      --surface-2:#f7fbfb;
      --surface-3:#eef6f5;
      --text:#1b2a2f;
      --muted:#5c6d73;
      --accent:#4aa8a1;
      --accent-2:#2f7d78;
      --grid:#dde7ea;
      --shadow:0 10px 30px rgba(20, 32, 56, 0.08);
      --chip-bg:rgba(74, 168, 161, 0.16);
      --chip-border:rgba(74, 168, 161, 0.32);
      --hover:#f1f7f8;
      --weekend:#f3f7f7;
      --today:#e6f6ee;
      --today-border: #3fbf9f1f; 
      --danger-accent: #ff00006b;
      --today-accent:#2d9b6f;
      --today-check:#ef4444;
      --today-check-strong:#dc2626;
      --today-check-soft:rgba(239, 68, 68, 0.12);
      --today-check-glow:rgba(239, 68, 68, 0.35);
       
      --item-bg:#f9fcfb;
      --overlay:rgba(12, 14, 24, 0.35);
      --danger-text:#8b5a3c;
      --danger-border:#efd9c9;
      --status-active-bg:rgba(74, 168, 161, 0.16);
      --status-active-text:#2f7d78;
      --status-active-border:rgba(74, 168, 161, 0.32);
      --status-paused-bg:rgba(236, 201, 120, 0.22);
      --status-paused-text:#8a5d12;
      --status-paused-border:rgba(236, 201, 120, 0.38);
      --status-completed-bg:rgba(115, 125, 140, 0.2);
      --status-completed-text:#4f4a42;
      --status-completed-border:rgba(115, 125, 140, 0.35);
      --priority-low-bg:rgba(95, 170, 211, 0.2);
      --priority-low-text:#3b6d8e;
      --priority-low-border:rgba(95, 170, 211, 0.35);
      --priority-medium-bg:rgba(74, 168, 161, 0.16);
      --priority-medium-text:#2f7d78;
      --priority-medium-border:rgba(74, 168, 161, 0.32);
      --priority-high-bg:rgba(235, 183, 120, 0.22);
      --priority-high-text:#8a5d12;
      --priority-high-border:rgba(235, 183, 120, 0.4);
      --radius:16px;
    }
    [data-theme="dark"]{
      color-scheme: dark;
      --bg:#0f121a;
      --bg-2:#151a26;
      --surface:#1b212f;
      --surface-2:#222a3b;
      --surface-3:#273147;
      --text:#e7edf8;
      --muted:#a7b1c8;
      --accent:#5cc3bb;
      --accent-2:#9edfd8;
      --grid:#2e3a53;
      --shadow:0 12px 30px rgba(0, 0, 0, 0.45);
      --chip-bg:rgba(92, 195, 187, 0.22);
      --chip-border:rgba(92, 195, 187, 0.38);
      --hover:#232c3f;
      --weekend:#20283a;
      --today:#17342b;
      --today-border: #3fbf9f1f; 
      --danger-accent: #ff00006b;
      --today-accent:#3fbf9f;
      --today-check:#f87171;
      --today-check-strong:#ef4444;
      --today-check-soft:rgba(248, 113, 113, 0.18);
      --today-check-glow:rgba(248, 113, 113, 0.45);
       
      --item-bg:#1e2534;
      --overlay:rgba(5, 7, 12, 0.7);
      --danger-text:#f3c3a0;
      --danger-border:#6b4a2f;
      --status-active-bg:rgba(92, 195, 187, 0.2);
      --status-active-text:#9edfd8;
      --status-active-border:rgba(92, 195, 187, 0.38);
      --status-paused-bg:rgba(236, 201, 120, 0.18);
      --status-paused-text:#e7bf7f;
      --status-paused-border:rgba(236, 201, 120, 0.35);
      --status-completed-bg:rgba(115, 125, 140, 0.2);
      --status-completed-text:#c6ccda;
      --status-completed-border:rgba(115, 125, 140, 0.35);
      --priority-low-bg:rgba(95, 170, 211, 0.22);
      --priority-low-text:#9ec5e8;
      --priority-low-border:rgba(95, 170, 211, 0.38);
      --priority-medium-bg:rgba(92, 195, 187, 0.2);
      --priority-medium-text:#9edfd8;
      --priority-medium-border:rgba(92, 195, 187, 0.38);
      --priority-high-bg:rgba(235, 183, 120, 0.18);
      --priority-high-text:#f3d1a6;
      --priority-high-border:rgba(235, 183, 120, 0.35);
    }
    body[data-default-section="addiction"]{
      --bg:#f2f8fb;
      --bg-2:#e7f4f1;
      --surface:#ffffff;
      --surface-2:#f7fbfb;
      --surface-3:#eef6f5;
      --text:#1b2a2f;
      --muted:#5c6d73;
      --accent:#4aa8a1;
      --accent-2:#2f7d78;
      --grid:#dde7ea;
      --chip-bg:rgba(74, 168, 161, 0.16);
      --chip-border:rgba(74, 168, 161, 0.32);
      --hover:#f1f7f8;
      --today:#e6f6ee;
      --today-border:#87d7b4;
      --today-accent:#2d9b6f;
      --danger-accent:#f2c9a6;
      --danger-text:#8b5a3c;
      --danger-border:#efd9c9;
    }
    [data-theme="dark"] body[data-default-section="addiction"]{
      --bg:#0f121a;
      --bg-2:#151a26;
      --surface:#1b212f;
      --surface-2:#222a3b;
      --surface-3:#273147;
      --text:#e7edf8;
      --muted:#a7b1c8;
      --accent:#5cc3bb;
      --accent-2:#9edfd8;
      --grid:#2e3a53;
      --chip-bg:rgba(92, 195, 187, 0.22);
      --chip-border:rgba(92, 195, 187, 0.38);
      --hover:#232c3f;
      --today:#17342b;
      --today-border:#3fbf9f1f;
      --today-accent:#3fbf9f;
      --danger-accent:#ff00006b;
      --danger-text:#f3c3a0;
      --danger-border:#6b4a2f;
    }
    *{ box-sizing:border-box; }
    body{
      font-family:"Sora","Space Grotesk","Segoe UI","Trebuchet MS",sans-serif;
      margin:0;
      color: var(--text);
      background:
        radial-gradient(1200px 600px at 0% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
        radial-gradient(900px 500px at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
        linear-gradient(180deg, var(--bg), var(--bg-2));
    }
    .wrap{
      max-width: 1400px;
      margin: 0 auto;
      padding: 24px 18px 40px;
    }
    .hero{
      display:flex;
      flex-wrap:wrap;
      gap:16px;
      align-items:flex-end;
      justify-content:space-between;
      margin-bottom:16px;
    }
    .eyebrow{
      text-transform:uppercase;
      letter-spacing:0.18em;
      font-size:11px;
      color:var(--muted);
    }
    h1{
      margin:6px 0 6px;
      font-size:28px;
      font-weight:700;
    }
    .sub{
      margin:0;
      font-size:13px;
      color:var(--muted);
    }
    .chip{
      background:var(--chip-bg);
      color:var(--accent-2);
      border:1px solid var(--chip-border);
      padding:6px 10px;
      border-radius:999px;
      font-size:12px;
      font-weight:600;
    }
    .toolbar{
      display:flex;
      flex-wrap:wrap;
      gap:10px 14px;
      align-items:end;
      margin: 8px 0 18px;
      padding:12px 14px;
      background:var(--surface);
      border:1px solid var(--grid);
      border-radius:var(--radius);
      box-shadow:var(--shadow);
    }
    .toolbar-group{
      display:flex;
      flex-wrap:wrap;
      gap:10px 14px;
      align-items:end;
    }
    .toolbar-group.grow{
      flex:1 1 520px;
      min-width:280px;
    }
    .toolbar-group.actions{
      justify-content:flex-end;
      gap:8px;
      flex:0 1 auto;
      align-self: center;
    }
    .field{
      display:flex;
      flex-direction:column;
      gap:6px;
      min-width:160px;
    }
    .custom-range{
      display:none;
      gap:10px 14px;
      align-items:end;
      flex-wrap:wrap;
    }
    .custom-range.show{
      display:flex;
    }
    .toolbar label{ font-size: 12px; color:var(--muted); }
    .toolbar input[type="date"]{
      padding:8px 10px;
      border:1px solid var(--grid);
      border-radius:10px;
      background:var(--surface-2);
      color:var(--text);
    }
    .range-buttons{
      display:flex;
      flex-wrap:wrap;
      gap:6px;
      padding:6px;
      background:var(--surface-2);
      border:1px solid var(--grid);
      border-radius:12px;
    }
    .range-group{
      display:flex;
      align-items:center;
      gap:6px;
      padding:4px;
      background:var(--surface-3);
      border:1px solid var(--grid);
      border-radius:12px;
    }
    .range-btn{
      padding:6px 8px;
      font-size:11px;
      letter-spacing:0.08em;
      text-transform:uppercase;
      border-radius:10px;
      min-width:36px;
      background:transparent;
    }
    .range-btn[data-preset="this-month"]{
      width:110px;
      text-align:center;
      overflow:hidden;
      text-overflow:ellipsis;
    }
    .range-btn.active{
      background:linear-gradient(135deg, var(--accent), #4a84ee);
      color:#fff;
      border-color:transparent;
    }
    .past-edit-toggle{
      display:flex;
      align-items:center;
      gap:10px;
      padding:6px 10px;
      border:1px dashed var(--grid);
      border-radius:12px;
      background:var(--surface-2);
      cursor:pointer;
      user-select:none;
    }
    .past-edit-toggle:hover{
      border-color:var(--accent);
    }
    .past-edit-checkbox{
      width:24px;
      height:24px;
      accent-color:var(--accent-2);
      flex:0 0 auto;
    }
    .past-edit-copy{
      display:flex;
      flex-direction:column;
      gap:2px;
      line-height:1.1;
    }
    .past-edit-title{
      font-size:11px;
      font-weight:600;
      color:var(--text);
    }
    .past-edit-sub{
      font-size:10px;
      color:var(--muted);
    }
    .btn{
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--grid);
    background: var(--surface-2);
    cursor: pointer;
    font-weight: 300;
    font-size: 10px;
    text-transform: capitalize;
    transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease;
    }
    .btn:hover{
      background:var(--hover);
      box-shadow:0 6px 16px rgba(20, 32, 56, 0.08);
    }
    .btn:active{ transform:translateY(1px); }
    .btn.primary{
      background:linear-gradient(135deg, var(--accent), #4a84ee);
      color:#fff;
      border-color:transparent;
    }
    .btn.primary:hover{
      background:linear-gradient(135deg, var(--accent-2), var(--accent));
    }
    .btn.ghost{
      background:transparent;
    }
    .hint{ font-size: 12px; color:var(--muted); }

    .manage{
      margin: 0;
    }
    .manage-head{
      display:flex;
      flex-wrap:wrap;
      gap:12px;
      align-items:center;
      justify-content:space-between;
      margin-bottom:10px;
    }
    h2{
      margin:0 0 4px;
      font-size:18px;
    }
    h3{
      margin:0 0 4px;
      font-size:12px;
      text-transform:uppercase;
      letter-spacing:0.12em;
      color:var(--muted);
    }
    .counts{
      display:flex;
      gap:10px;
      font-size:12px;
      color:var(--muted);
    }
    .counts span{
      font-weight:700;
      color:var(--text);
      margin-right:4px;
    }
    .manage-grid{
      display:grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap:12px;
      align-items:stretch;
    }
  .manage-grid .panel{
    display:flex;
    flex-direction:column;
    min-height:0;
    min-width:0;
  }
  .case-manage-grid{
    grid-template-columns: 1fr;
  }
  .custom-panel{
    margin-bottom:12px;
  }
  .custom-panel .row{
    align-items:flex-end;
  }
  .case-manage .custom-panel .row{
    width:100%;
    flex-wrap:nowrap;
    align-items:center;
  }
  .case-manage .custom-panel .row input[type="text"]{
    flex:1 1 auto;
    min-width:0;
  }
  .case-manage .custom-panel .row .btn{
    flex:0 0 auto;
    white-space:nowrap;
  }
  @media (max-width: 640px){
    .case-manage .custom-panel .row{
      flex-wrap:wrap;
    }
    .case-manage .custom-panel .row .btn{
      width:100%;
    }
  }
  @media (max-width: 720px){
    .manage .row{
      flex-direction:column;
      align-items:stretch;
    }
    .manage .row .btn{
      width:100%;
    }
    .manage .row .category-field{
      min-width:0;
    }
    .habit-item{
      flex-direction:column;
      align-items:flex-start;
    }
    .habit-actions{
      width:100%;
      justify-content:flex-end;
    }
    .habit-name{
      white-space:normal;
    }
  }
    .category-field{
      min-width:160px;
    }
    .category-field label{
      display:block;
      margin-bottom:4px;
    }
    .panel{
      background:var(--surface);
      border:1px solid var(--grid);
      border-radius:18px;
      padding:12px 14px;
      box-shadow:var(--shadow);
    }
    .panel-title{
      font-size:12px;
      text-transform:uppercase;
      letter-spacing:0.12em;
      color:var(--muted);
      margin-bottom:10px;
    }
    .row{
      display:flex;
      gap:10px;
      flex-wrap:wrap;
      align-items:center;
    }
    #newHabit{
      flex:1 1 200px;
      padding:10px 12px;
      border-radius:10px;
      border:1px solid var(--grid);
      background:var(--surface-2);
      color:var(--text);
    }
    .habit-list{
      display:flex;
      flex-direction:column;
      gap:8px;
      max-height: 260px;
      overflow:auto;
      padding-right:2px;
    }
    .habit-item{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      padding:8px 10px;
      border:1px solid var(--grid);
      border-radius:12px;
      background:var(--item-bg);
    }
    .habit-info{
      display:flex;
      align-items:center;
      gap:8px;
      min-width:0;
    }
    .habit-icon{
      --icon-color: var(--accent);
      width:22px;
      height:22px;
      border-radius:7px;
      background: color-mix(in srgb, var(--icon-color) 18%, transparent);
      border:2px solid color-mix(in srgb, var(--icon-color) 55%, transparent);
      color:var(--icon-color);
      display:flex;
      align-items:center;
      justify-content:center;
      font-size:12px;
      font-weight:600;
      box-shadow:none;
      flex-shrink:0;
    }
    .habit-name{
      font-size:13px;
      font-weight:600;
      color:var(--text);
      overflow:hidden;
      text-overflow:ellipsis;
      white-space:nowrap;
    }
    .habit-cell{
      display:flex;
      align-items:center;
      gap:8px;
    }
    .habit-text{
      overflow:hidden;
      text-overflow:ellipsis;
      white-space:nowrap;
    }
    .habit-progress{
      margin-top:6px;
      display:flex;
      flex-direction:column;
      gap:4px;
      font-size:11px;
      color:var(--muted);
    }
    .habit-progress-bar{
      height:6px;
      border-radius:999px;
      background:var(--surface-3);
      overflow:hidden;
    }
    .habit-progress-bar span{
      display:block;
      height:100%;
      background:linear-gradient(90deg, var(--accent), #59a0ff);
      width:0%;
    }
    .habit-actions{
      display:flex;
      gap:6px;
      flex-shrink:0;
    }
    .library-title{
      margin-top:10px;
      font-size:11px;
      text-transform:uppercase;
      letter-spacing:0.14em;
      color:var(--muted);
    }
    .habit-library{
      display:flex;
      flex-direction:column;
      gap:10px;
      max-height: 280px;
      overflow:auto;
      padding-right:2px;
      margin-top:8px;
    }
    .library-panel .habit-library{
      flex:1;
      max-height:none;
    }
    .active-panel .habit-list{
      flex:1;
      max-height:none;
    }
    .habit-category{
      border:1px dashed var(--grid);
      border-radius:14px;
      padding:10px;
      background:var(--surface-2);
    }
    .habit-category-title{
      font-size:11px;
      letter-spacing:0.12em;
      text-transform:uppercase;
      color:var(--muted);
      display:flex;
      align-items:center;
      gap:8px;
    }
    .habit-category-title::before{
      content:"";
      width:8px;
      height:8px;
      border-radius:50%;
      background:var(--category-color, var(--accent));
      box-shadow:0 0 0 3px rgba(0,0,0,0.05);
    }
    .habit-chip-list{
      display:flex;
      flex-wrap:wrap;
      gap:6px;
      margin-top:8px;
    }
    .habit-chip{
      display:flex;
      align-items:center;
      gap:6px;
      padding:6px 10px;
      border-radius:999px;
      border:1px solid var(--grid);
      background:var(--surface);
      cursor:pointer;
      font-size:12px;
      color:var(--text);
      box-shadow:var(--shadow);
    }
    .habit-chip:disabled{
      cursor:not-allowed;
      opacity:0.65;
    }
    .habit-chip .chip-icon{
      width:18px;
      height:18px;
      border-radius:6px;
      background: color-mix(in srgb, var(--icon-color, var(--accent)) 18%, transparent);
      border:2px solid color-mix(in srgb, var(--icon-color, var(--accent)) 55%, transparent);
      color:var(--icon-color, var(--accent));
      display:flex;
      align-items:center;
      justify-content:center;
      font-size:11px;
      flex-shrink:0;
    }
    .habit-chip .chip-name{
      font-weight:600;
      white-space:nowrap;
    }
    .habit-chip .chip-state{
      font-size:10px;
      text-transform:uppercase;
      letter-spacing:0.12em;
      color:var(--muted);
      margin-left:4px;
    }
    .habit-chip.is-archived{
      border-style:dashed;
    }
    .habit-chip.is-active{
      background:var(--surface-3);
    }
    .habit-chip.is-archived .chip-state{
      color:var(--accent);
    }
    .btn.sm{
      padding:6px 10px;
      font-size:12px;
    }
    .btn.danger{
      color:var(--danger-text);
      border-color:var(--danger-border);
    }
    .btn:disabled{
      opacity:0.6;
      cursor:not-allowed;
      box-shadow:none;
    }
    .empty{
      font-size:12px;
      color:var(--muted);
      padding:10px 0;
    }
    .main-nav{
      display:grid;
      grid-template-columns: auto 1fr auto;
      gap:16px;
      align-items:center;
      padding:14px 18px;
      margin-bottom:18px;
      background:color-mix(in srgb, var(--surface) 92%, transparent);
      border:1px solid color-mix(in srgb, var(--grid) 80%, transparent);
      border-radius:22px;
      box-shadow:var(--shadow);
      backdrop-filter: blur(8px);
      position:relative;
      overflow:hidden;
    }
    .main-nav::after{
      content:"";
      position:absolute;
      inset:0;
      border-radius:inherit;
      pointer-events:none;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
    .brand{
      display:flex;
      align-items:center;
      gap:12px;
      min-width:180px;
    }
    .brand-mark{
      width:38px;
      height:38px;
      border-radius:14px;
      background:conic-gradient(from 210deg, var(--accent), #4a84ee, #7dd3fc, var(--accent));
      box-shadow:0 12px 20px rgba(47, 111, 228, 0.25);
      position:relative;
    }
    .brand-mark::after{
      content:"R";
      position:absolute;
      inset:0;
      display:grid;
      place-items:center;
      color:#fff;
      font-weight:700;
      font-size:15px;
      letter-spacing:0.08em;
    }
    .brand-title{
      font-size:17px;
      font-weight:700;
      font-family:"Space Grotesk","Sora","Segoe UI",sans-serif;
    }
    .nav-actions{
      display:flex;
      align-items:center;
      gap:12px;
      flex-wrap:wrap;
      justify-content:flex-end;
      min-width:0;
    }
    .nav-switcher{
      display:flex;
      align-items:center;
      gap:6px;
      padding:6px;
      background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface) 70%, transparent), var(--surface-2));
      border:1px solid color-mix(in srgb, var(--grid) 80%, transparent);
      border-radius:999px;
      overflow-x:auto;
      scrollbar-width:none;
      flex:1 1 520px;
      min-width:240px;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
    }
    .nav-toggle{
      display:none;
      align-items:center;
      gap:8px;
      padding:8px 12px;
      border-radius:12px;
      border:1px solid var(--grid);
      background:var(--surface-2);
      color:var(--text);
      font-weight:700;
      font-size:12px;
      cursor:pointer;
      box-shadow:var(--shadow);
    }
    .nav-toggle-icon{
      width:18px;
      height:2px;
      background:var(--text);
      border-radius:999px;
      position:relative;
      transition:transform 0.2s ease, background 0.2s ease;
    }
    .nav-toggle-icon::before,
    .nav-toggle-icon::after{
      content:"";
      position:absolute;
      left:0;
      width:18px;
      height:2px;
      border-radius:999px;
      background:var(--text);
      transition:transform 0.2s ease, top 0.2s ease;
    }
    .nav-toggle-icon::before{ top:-6px; }
    .nav-toggle-icon::after{ top:6px; }
    .main-nav.nav-open .nav-toggle-icon{
      background:transparent;
    }
    .main-nav.nav-open .nav-toggle-icon::before{
      top:0;
      transform:rotate(45deg);
    }
    .main-nav.nav-open .nav-toggle-icon::after{
      top:0;
      transform:rotate(-45deg);
    }
    .nav-tool{
      margin-left:auto;
    }
    .nav-switcher::-webkit-scrollbar{
      display:none;
    }
    .nav-btn{
      padding:8px 14px;
      font-size:12px;
      border-radius:999px;
      background:transparent;
      text-transform:none;
      font-weight:600;
      letter-spacing:0.02em;
      color:var(--muted);
      border:1px solid transparent;
      white-space:nowrap;
      text-decoration:none;
      position:relative;
      overflow:hidden;
      transition:transform 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    }
    .nav-btn:hover{
      background:var(--surface);
      color:var(--text);
      border-color:color-mix(in srgb, var(--grid) 70%, transparent);
      box-shadow:0 8px 16px rgba(20, 32, 56, 0.08);
      transform:translateY(-1px);
    }
    .nav-btn::before{
      content:"";
      position:absolute;
      left:12px;
      right:12px;
      bottom:6px;
      height:2px;
      border-radius:999px;
      background:white;
      transform:scaleX(0);
      opacity:0;
      transition:transform 0.2s ease, opacity 0.2s ease;
    }
    .nav-btn.active{
      background:linear-gradient(180deg, color-mix(in srgb, var(--accent) 18%, transparent), var(--surface));
      color:var(--text);
      border-color:color-mix(in srgb, var(--accent) 35%, var(--grid));
      box-shadow:0 12px 24px rgba(47, 111, 228, 0.12);
      transform:translateY(-1px);
    }
    .nav-btn:hover::before,
    .nav-btn:focus-visible::before{
      transform:scaleX(1);
      opacity:1;
    }
    .nav-btn:focus-visible{
      outline:2px solid color-mix(in srgb, var(--accent) 60%, transparent);
      outline-offset:2px;
    }
    .theme-toggle{
      width:42px;
      height:42px;
      border-radius:14px;
      border:1px solid var(--grid);
      background:var(--surface-2);
      display:grid;
      place-items:center;
      cursor:pointer;
      box-shadow:var(--shadow);
      transition:transform 0.1s ease, background 0.2s ease, box-shadow 0.2s ease;
    }
    .theme-toggle:hover{
      background:var(--hover);
      box-shadow:0 10px 22px rgba(20, 32, 56, 0.12);
    }
    .theme-toggle:active{
      transform:translateY(1px);
    }
    .theme-icon{
      width:18px;
      height:18px;
      display:block;
      background:linear-gradient(135deg, var(--accent), #4a84ee);
      border-radius:50%;
      position:relative;
      box-shadow:inset 0 0 0 2px rgba(255,255,255,0.6);
    }
    [data-theme="dark"] .theme-icon{
      background:var(--surface-2);
      box-shadow:inset -6px -6px 0 0 var(--accent);
      border-radius:50%;
    }
    .addiction-section .hero-actions{
      display:flex;
      flex-direction:column;
      align-items:flex-end;
      gap:8px;
      text-align:right;
    }
    .hero-note{
      margin:0;
      font-size:12px;
      color:var(--muted);
      max-width:220px;
    }
    .principles{
      display:flex;
      flex-wrap:wrap;
      gap:8px;
      margin-top:10px;
    }
    .pill{
      display:inline-flex;
      align-items:center;
      gap:6px;
      padding:6px 10px;
      border-radius:999px;
      border:1px solid var(--grid);
      background:var(--surface-2);
      font-size:11px;
      font-weight:600;
      color:var(--accent-2);
    }
    .summary.recovery-summary{
      gap:14px;
    }
    .stat-card{
      display:flex;
      flex-direction:column;
      gap:8px;
    }
    .stat-head{
      display:flex;
      align-items:center;
      gap:12px;
    }
    .stat-ring{
      --value:60;
      --ring:var(--accent);
      width:52px;
      height:52px;
      border-radius:50%;
      background:conic-gradient(var(--ring) calc(var(--value) * 1%), var(--surface-3) 0);
      position:relative;
      display:grid;
      place-items:center;
      flex-shrink:0;
    }
    .stat-ring::before{
      content:"";
      position:absolute;
      inset:6px;
      border-radius:50%;
      background:var(--surface);
      border:1px solid var(--grid);
    }
    .stat-icon{
      position:relative;
      width:20px;
      height:20px;
      color:var(--ring);
    }
    .stat-meta{
      font-size:12px;
      color:var(--muted);
      margin-top:4px;
    }
    .level-indicator{
      display:inline-flex;
      align-items:center;
      gap:6px;
      font-weight:600;
      font-size:12px;
      color:var(--accent-2);
    }
    .level-indicator::before{
      content:"";
      width:8px;
      height:8px;
      border-radius:50%;
      background:var(--level-color, #7ac7a5);
      box-shadow:0 0 0 4px color-mix(in srgb, var(--level-color, #7ac7a5) 20%, transparent);
    }
    .level-indicator.level-low{ --level-color:#7ac7a5; }
    .level-indicator.level-mid{ --level-color:#f0c17a; }
    .level-indicator.level-high{ --level-color:#f0a778; }
    .addiction-grid{
      display:grid;
      gap:14px;
      grid-template-columns: repeat(12, minmax(0, 1fr));
      margin-top:18px;
    }
    .addiction-grid .panel{
      min-height:0;
    }
    .addiction-grid .span-12{ grid-column: span 12; }
    .addiction-grid .span-8{ grid-column: span 8; }
    .addiction-grid .span-7{ grid-column: span 7; }
    .addiction-grid .span-5{ grid-column: span 5; }
    .addiction-grid .span-4{ grid-column: span 4; }
    .agent-grid{
      display:grid;
      gap:12px;
      grid-template-columns: repeat(3, minmax(240px, 1fr));
      margin-top:16px;
    }
    .agent-grid .panel{
      min-height:240px;
    }
    .panel-sub{
      margin:-4px 0 12px;
      font-size:12px;
      color:var(--muted);
    }
    .checkin-grid{
      display:grid;
      gap:12px;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .checkin-grid .field.full{
      grid-column: 1 / -1;
    }
    .range-wrap{
      display:flex;
      align-items:center;
      gap:10px;
    }
    .range{
      flex:1 1 auto;
      accent-color:var(--accent);
    }
    .range-value{
      font-size:12px;
      font-weight:700;
      padding:4px 8px;
      border-radius:999px;
      background:var(--surface-3);
      color:var(--accent-2);
    }
    input[type="range"].range{
      -webkit-appearance:none;
      height:6px;
      border-radius:999px;
      background:var(--surface-3);
      outline:none;
    }
    input[type="range"].range::-webkit-slider-thumb{
      -webkit-appearance:none;
      width:16px;
      height:16px;
      border-radius:50%;
      background:var(--accent);
      border:2px solid #fff;
      box-shadow:0 4px 10px rgba(24, 64, 66, 0.18);
    }
    input[type="range"].range::-moz-range-thumb{
      width:16px;
      height:16px;
      border-radius:50%;
      background:var(--accent);
      border:2px solid #fff;
      box-shadow:0 4px 10px rgba(24, 64, 66, 0.18);
    }
    .segmented{
      display:flex;
      flex-wrap:wrap;
      gap:6px;
    }
    .seg-btn{
      padding:6px 10px;
      border-radius:999px;
      border:1px solid var(--grid);
      background:var(--surface-2);
      font-size:11px;
      font-weight:600;
      cursor:pointer;
    }
    .seg-btn.active{
      background:linear-gradient(135deg, var(--accent), #78c9c3);
      color:#fff;
      border-color:transparent;
    }
    .toggle-group{
      display:flex;
      gap:6px;
    }
    .toggle-btn{
      padding:6px 12px;
      border-radius:999px;
      border:1px solid var(--grid);
      background:var(--surface-2);
      font-size:11px;
      font-weight:600;
      cursor:pointer;
    }
    .toggle-btn.active{
      background:linear-gradient(135deg, var(--accent), #78c9c3);
      color:#fff;
      border-color:transparent;
    }
    .checkin-actions{
      margin-top:12px;
      display:flex;
      align-items:center;
      gap:12px;
      flex-wrap:wrap;
    }
    .helper-text{
      font-size:12px;
      color:var(--muted);
    }
    .checkin-form,
    .agent-form{
      display:grid;
      gap:8px;
    }
    .tag-grid{
      display:flex;
      flex-wrap:wrap;
      gap:8px;
    }
    .tag.trigger{
      background:color-mix(in srgb, var(--accent) 10%, var(--surface));
      border-color:color-mix(in srgb, var(--accent) 35%, var(--grid));
      color:var(--accent-2);
    }
    .tag.trigger.active{
      background:linear-gradient(135deg, var(--accent), #78c9c3);
      color:#fff;
      border-color:transparent;
      box-shadow:0 8px 16px rgba(74, 168, 161, 0.22);
    }
    .tag-input{
      display:flex;
      gap:8px;
      margin-top:10px;
    }
    .tag{
      display:inline-flex;
      align-items:center;
      gap:6px;
      padding:6px 10px;
      border-radius:999px;
      border:1px solid var(--grid);
      background:var(--surface-2);
      font-size:11px;
      font-weight:600;
    }
    .tag.warning{
      background:color-mix(in srgb, var(--danger-accent) 18%, transparent);
      border-color:color-mix(in srgb, var(--danger-accent) 40%, var(--grid));
      color:var(--danger-text);
    }
    .tag.calm{
      background:color-mix(in srgb, var(--today-accent) 18%, transparent);
      border-color:color-mix(in srgb, var(--today-accent) 45%, var(--grid));
      color:var(--today-accent);
    }
    .replacement-group{
      display:grid;
      gap:8px;
      padding:10px;
      border:1px solid var(--grid);
      border-radius:14px;
      background:var(--surface-2);
    }
    .replacement-group + .replacement-group{
      margin-top:10px;
    }
    .replacement-title{
      font-size:12px;
      font-weight:700;
      color:var(--text);
    }
    .replacement-tags{
      display:flex;
      flex-wrap:wrap;
      gap:8px;
    }
    .chip-btn{
      display:inline-flex;
      align-items:center;
      gap:8px;
      padding:6px 10px;
      border-radius:999px;
      border:1px solid var(--grid);
      background:var(--surface);
      font-size:11px;
      font-weight:600;
      cursor:pointer;
    }
    .chip-kind{
      font-size:9px;
      letter-spacing:0.08em;
      text-transform:uppercase;
      opacity:0.7;
    }
    .chip-btn.physical{
      background:color-mix(in srgb, #7cc6c1 18%, var(--surface));
      border-color:color-mix(in srgb, #7cc6c1 40%, var(--grid));
      color:#2c6b68;
    }
    .chip-btn.mental{
      background:color-mix(in srgb, #9ec5ff 20%, var(--surface));
      border-color:color-mix(in srgb, #9ec5ff 40%, var(--grid));
      color:#3c5f88;
    }
    .chip-btn.social{
      background:color-mix(in srgb, #a2e6b7 20%, var(--surface));
      border-color:color-mix(in srgb, #a2e6b7 40%, var(--grid));
      color:#2b7a50;
    }
    .chip-btn.active{
      background:linear-gradient(135deg, var(--accent), #78c9c3);
      color:#fff;
      border-color:transparent;
      box-shadow:0 8px 16px rgba(74, 168, 161, 0.22);
    }
    .plan-list{
      list-style:none;
      margin:0;
      padding:0;
      display:grid;
      gap:8px;
    }
    .plan-list li{
      display:flex;
      gap:10px;
      align-items:flex-start;
      padding:8px 10px;
      border:1px solid var(--grid);
      border-radius:12px;
      background:var(--item-bg);
      font-size:12px;
    }
    .plan-list li span{
      font-weight:700;
      color:var(--accent-2);
    }
    .support-list{
      display:grid;
      gap:10px;
    }
    .support-item{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:8px;
      padding:10px;
      border:1px solid var(--grid);
      border-radius:14px;
      background:var(--item-bg);
    }
    .support-meta{
      display:grid;
      gap:4px;
      font-size:12px;
    }
    .support-label{
      font-weight:700;
    }
    .support-note{
      font-size:11px;
      color:var(--muted);
    }
    .progress-grid{
      display:grid;
      gap:12px;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .progress-card{
      border:1px solid var(--grid);
      border-radius:16px;
      padding:12px;
      background:var(--surface-2);
      display:grid;
      gap:10px;
    }
    .progress-card.span-2{
      grid-column: span 2;
    }
    .progress-head{
      display:flex;
      justify-content:space-between;
      align-items:center;
      font-size:12px;
      font-weight:600;
      color:var(--text);
    }
    .mini-legend{
      font-size:10px;
      color:var(--muted);
      letter-spacing:0.08em;
      text-transform:uppercase;
    }
    .line-chart{
      width:100%;
      height:120px;
      color:var(--accent);
    }
    .chart-footer{
      display:flex;
      justify-content:space-between;
      font-size:11px;
      color:var(--muted);
    }
    .calendar-grid{
      display:grid;
      grid-template-columns: repeat(7, 1fr);
      gap:6px;
    }
    .calendar-day{
      width:100%;
      aspect-ratio:1 / 1;
      border-radius:8px;
      border:1px solid var(--grid);
      background:var(--surface);
    }
    .calendar-day.clean{
      background:color-mix(in srgb, var(--accent) 24%, var(--surface));
      border-color:color-mix(in srgb, var(--accent) 45%, var(--grid));
    }
    .calendar-day.rest{
      background:var(--surface-3);
    }
    .calendar-legend{
      display:flex;
      gap:12px;
      font-size:11px;
      color:var(--muted);
      align-items:center;
    }
    .legend-dot{
      width:8px;
      height:8px;
      border-radius:50%;
      display:inline-block;
      margin-right:6px;
    }
    .legend-dot.clean{ background:color-mix(in srgb, var(--accent) 60%, #ffffff); }
    .legend-dot.rest{ background:var(--surface-3); border:1px solid var(--grid); }
    .streak-card{
      align-content:start;
    }
    .streak-icon{
      width:40px;
      height:40px;
      border-radius:14px;
      background:color-mix(in srgb, var(--accent) 20%, var(--surface));
      display:grid;
      place-items:center;
      color:var(--accent-2);
    }
    .streak-icon svg{
      width:22px;
      height:22px;
    }
    .streak-value{
      font-size:20px;
      font-weight:700;
    }
    .streak-meta{
      font-size:12px;
      color:var(--muted);
    }
    .relapse-panel{
      padding:0;
    }
    .relapse-panel summary{
      list-style:none;
      padding:12px 14px;
      cursor:pointer;
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
    }
    .relapse-panel summary .panel-title{
      margin:0;
    }
    .relapse-panel summary::-webkit-details-marker{
      display:none;
    }
    .relapse-panel[open] summary{
      border-bottom:1px solid var(--grid);
    }
    .relapse-body{
      padding:12px 14px 14px;
      display:grid;
      gap:12px;
    }
    .relapse-grid{
      display:grid;
      gap:12px;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .relapse-grid .field.full{
      grid-column: 1 / -1;
    }
    .btn.soft{
      background:color-mix(in srgb, var(--accent) 18%, var(--surface-2));
      color:var(--accent-2);
      border-color:color-mix(in srgb, var(--accent) 35%, var(--grid));
    }
    .coach-panel{
      display:grid;
      gap:12px;
    }
    .coach-grid{
      display:grid;
      gap:12px;
      grid-template-columns: minmax(260px, 1.2fr) minmax(220px, 0.8fr);
    }
    .coach-chat{
      border:1px solid var(--grid);
      border-radius:16px;
      padding:12px;
      background:var(--surface-2);
      display:grid;
      gap:10px;
    }
    .coach-thread{
      display:grid;
      gap:10px;
      max-height:280px;
      overflow:auto;
      padding-right:4px;
    }
    .coach-bubble{
      padding:10px 12px;
      border-radius:14px;
      border:1px solid var(--grid);
      background:var(--surface);
      font-size:12px;
      display:grid;
      gap:6px;
      max-width:90%;
    }
    .coach-bubble.user{
      align-self:flex-end;
      background:linear-gradient(135deg, var(--accent), #78c9c3);
      color:#fff;
      border-color:transparent;
    }
    .coach-label{
      font-size:10px;
      letter-spacing:0.12em;
      text-transform:uppercase;
      color:var(--muted);
    }
    .coach-bubble.user .coach-label{
      color:rgba(255, 255, 255, 0.85);
    }
    .coach-text{
      line-height:1.4;
    }
    .coach-input{
      display:flex;
      gap:8px;
    }
    .coach-input .input{
      flex:1 1 auto;
    }
    .coach-insights{
      display:grid;
      gap:10px;
    }
    .insight-card{
      border:1px solid var(--grid);
      border-radius:14px;
      background:var(--item-bg);
      padding:10px;
      display:grid;
      gap:6px;
    }
    .insight-title{
      font-size:11px;
      font-weight:700;
      text-transform:uppercase;
      letter-spacing:0.08em;
      color:var(--muted);
    }
    .insight-text{
      font-size:12px;
      color:var(--text);
    }
    .plan-steps{
      display:grid;
      gap:8px;
    }
    .plan-step{
      display:flex;
      gap:10px;
      align-items:flex-start;
      padding:8px 10px;
      border:1px solid var(--grid);
      border-radius:12px;
      background:var(--item-bg);
      font-size:12px;
    }
    .plan-step span{
      font-weight:700;
    }
    .ai-fab-wrap{
      position:fixed;
      right:24px;
      bottom:24px;
      z-index:55;
      display:flex;
      flex-direction:column;
      align-items:flex-end;
      gap:12px;
      pointer-events:none;
    }
    .ai-fab-wrap .ai-nav-btn,
    .ai-fab-wrap .ai-fab{
      pointer-events:auto;
    }
    .ai-fab-wrap .ai-panel{
      pointer-events:none;
    }
    .ai-fab-wrap .ai-panel.open{
      pointer-events:auto;
    }
    .ai-nav-btn{
      display:flex;
      align-items:center;
      gap:8px;
      padding:8px 12px;
      border-radius:999px;
      border:1px solid color-mix(in srgb, var(--accent) 45%, transparent);
      background:linear-gradient(135deg, var(--accent), #4a84ee);
      color:#fff;
      font-weight:700;
      font-size:11px;
      letter-spacing:0.08em;
      text-transform:uppercase;
      box-shadow:0 12px 24px rgba(47, 111, 228, 0.25);
      cursor:pointer;
      transition:transform 0.2s ease, box-shadow 0.2s ease;
    }
    .ai-nav-btn:hover{
      transform:translateY(-1px);
      box-shadow:0 16px 28px rgba(47, 111, 228, 0.3);
    }
    .ai-nav-btn .ai-fab-icon{
      width:22px;
      height:22px;
      font-size:10px;
    }
    .ai-nav-btn .ai-fab-text{
      font-size:10px;
      letter-spacing:0.16em;
    }
    .ai-fab{
      display:flex;
      align-items:center;
      gap:10px;
      padding:12px 16px;
      border-radius:999px;
      border:1px solid color-mix(in srgb, var(--accent) 40%, transparent);
      background:linear-gradient(135deg, var(--accent), #4a84ee);
      color:#fff;
      font-weight:600;
      font-size:12px;
      letter-spacing:0.04em;
      box-shadow:0 16px 30px rgba(47, 111, 228, 0.3);
      cursor:pointer;
    }
    .ai-fab-icon{
      width:28px;
      height:28px;
      border-radius:50%;
      background:rgba(255, 255, 255, 0.2);
      display:grid;
      place-items:center;
      font-size:11px;
      font-weight:700;
    }
    .ai-fab-text{
      text-transform:uppercase;
      font-size:11px;
    }
    .ai-panel{
      width:min(380px, 92vw);
      background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, var(--accent) 4%), var(--surface-2));
      border:1px solid color-mix(in srgb, var(--grid) 85%, var(--accent) 15%);
      border-radius:20px;
      padding:14px;
      box-shadow:var(--shadow);
      opacity:0;
      transform:translateY(8px) scale(0.98);
      pointer-events:none;
      transition:opacity 0.2s ease, transform 0.2s ease;
    }
    .ai-panel.open{
      opacity:1;
      transform:translateY(0) scale(1);
      pointer-events:auto;
    }
    .ai-panel-head{
      display:flex;
      align-items:flex-start;
      justify-content:space-between;
      gap:12px;
    }
    .ai-panel-actions{
      display:flex;
      gap:8px;
      align-items:center;
    }
    .btn.icon-only{
      width:32px;
      height:32px;
      padding:0;
      display:grid;
      place-items:center;
      font-size:14px;
    }
    .ai-panel-title{
      font-size:15px;
      font-weight:700;
      margin:0;
    }
    .ai-panel-body{
      margin:12px 0;
      display:flex;
      flex-direction:column;
      gap:10px;
      max-height:260px;
      overflow:auto;
      padding-right:4px;
    }
    .ai-bubble{
      padding:10px 12px;
      border-radius:14px;
      border:1px solid var(--grid);
      background:var(--surface-2);
      font-size:12px;
      display:grid;
      gap:6px;
      max-width:85%;
    }
    .ai-bubble.user{
      align-self:flex-end;
      background:linear-gradient(135deg, var(--accent), #4a84ee);
      color:#fff;
      border-color:transparent;
    }
    .ai-label{
      font-size:10px;
      letter-spacing:0.12em;
      text-transform:uppercase;
      color:var(--muted);
    }
    .ai-text{
      line-height:1.4;
    }

    @media (prefers-reduced-motion: reduce){
      .nav-btn,
      .nav-btn::before{
        transition:none;
      }
    }
    .ai-bubble.user .ai-label{
      color:rgba(255, 255, 255, 0.8);
    }
    .ai-panel-input{
      display:flex;
      gap:8px;
      align-items:center;
    }
    .ai-panel-input .input{
      flex:1;
    }
    .theme-toggle.nav-ghost{
      width:36px;
      height:36px;
      border-radius:12px;
      background:transparent;
      border:1px solid transparent;
      box-shadow:none;
    }
    .theme-toggle.nav-ghost:hover{
      background:var(--hover);
      border-color:color-mix(in srgb, var(--grid) 70%, transparent);
      box-shadow:none;
    }
    .ai-modal{
      position:fixed;
      inset:0;
      display:flex;
      align-items:center;
      justify-content:center;
      padding:18px;
      background:var(--overlay);
      opacity:0;
      visibility:hidden;
      pointer-events:none;
      transition:opacity 0.2s ease, visibility 0.2s ease;
      z-index:80;
    }
    .ai-modal.open{
      opacity:1;
      visibility:visible;
      pointer-events:auto;
    }
    .ai-modal-dialog{
      width:min(1200px, 96vw);
      height:min(92vh, 940px);
      background:var(--surface);
      border:1px solid var(--grid);
      border-radius:22px;
      box-shadow:var(--shadow);
      display:flex;
      flex-direction:column;
      padding:16px;
      animation: rise 0.3s ease both;
    }
    .ai-modal-head{
      display:flex;
      align-items:flex-start;
      justify-content:space-between;
      gap:12px;
      margin-bottom:12px;
    }
    .ai-modal-title{
      font-size:18px;
      font-weight:700;
      margin:0;
    }
    .ai-modal-actions{
      display:flex;
      gap:8px;
      align-items:center;
    }
    .ai-modal-body{
      display:grid;
      gap:16px;
      grid-template-columns: minmax(300px, 1.2fr) minmax(240px, 0.8fr);
      flex:1;
      min-height:0;
    }
    .ai-modal-chat{
      display:flex;
      flex-direction:column;
      border:1px solid var(--grid);
      border-radius:18px;
      padding:12px;
      background:var(--surface-2);
      min-height:0;
    }
    .ai-modal-chat-body{
      display:flex;
      flex-direction:column;
      gap:10px;
      flex:1;
      overflow:auto;
      padding-right:4px;
    }
    .ai-modal-side{
      display:grid;
      gap:12px;
      align-content:start;
      min-height:0;
      overflow:auto;
      padding-right:4px;
    }
    .projects{
      margin-top: 26px;
    }
    .views{
      margin-top: 24px;
    }
    .section{
      display:none;
    }
    .section.active{
      display:block;
    }
    .section.projects-section{
      min-height: calc(100vh - 140px);
      flex-direction:column;
      padding-bottom:24px;
    }
    .section.projects-section.active{
      display:flex;
    }
    .section.budget-section{
      min-height: calc(100vh - 140px);
      flex-direction:column;
      padding-bottom:24px;
    }
    .section.budget-section.active{
      display:flex;
    }
    .section.projects-section .table-wrap{
      flex:1;
      min-height:220px;
      display:flex;
      flex-direction:column;
    }
    .views-head{
      display:flex;
      flex-wrap:wrap;
      gap:12px;
      align-items:flex-end;
      justify-content:space-between;
      margin-bottom:12px;
    }
    .planning-bar{
      display:flex;
      flex-wrap:wrap;
      gap:12px;
      align-items:center;
      justify-content:space-between;
      padding:12px 14px;
      background:var(--surface);
      border:1px solid var(--grid);
      border-radius:16px;
      box-shadow:var(--shadow);
      margin-bottom:14px;
    }
    .view-switcher{
      display:flex;
      gap:8px;
      flex-wrap:wrap;
      padding:6px;
      background:var(--surface-2);
      border:1px solid var(--grid);
      border-radius:12px;
    }
    .planning-controls{
      display:flex;
      flex:1 1 360px;
      justify-content:flex-end;
    }
    .controls-panel{
      display:none;
      align-items:end;
      gap:10px 14px;
      flex-wrap:wrap;
    }
    .controls-panel.active{
      display:flex;
    }
    .view-btn{
      padding:6px 12px;
      font-size:12px;
      border-radius:10px;
      background:transparent;
    }
    .view-btn.active{
      background:linear-gradient(135deg, var(--accent), #4a84ee);
      color:#fff;
      border-color:transparent;
    }
    .view-panel{
      display:none;
    }
    .view-panel.active{
      display:block;
    }
    .day-toolbar{
      display:flex;
      flex-wrap:wrap;
      gap:10px 14px;
      align-items:end;
      margin-bottom:12px;
      padding:10px 12px;
      background:var(--surface);
      border:1px solid var(--grid);
      border-radius:14px;
      box-shadow:var(--shadow);
    }
    .day-nav{
      display:flex;
      gap:8px;
      flex-wrap:wrap;
    }
    .day-date{
      display:flex;
      flex-direction:column;
      gap:6px;
      min-width:160px;
    }
    .day-date input[type="date"]{
      padding:8px 10px;
      border:1px solid var(--grid);
      border-radius:10px;
      background:var(--surface-2);
      color:var(--text);
      font-size:13px;
    }
    .day-layout{
      display:flex;
      flex-direction:column;
      gap:12px;
      align-items:stretch;
    }
    .day-panels{
      display:grid;
      gap:12px;
      grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
      align-items:start;
    }
    .day-form{
      display:grid;
      gap:10px;
      grid-template-columns: repeat(2, minmax(120px, 1fr));
      align-items:end;
    }
    .day-form button{
      grid-column: 1 / -1;
      justify-self:flex-start;
    }
    .time-row{
      display:grid;
      gap:10px;
      grid-template-columns: repeat(2, minmax(120px, 1fr));
      grid-column: 1 / -1;
    }
    #taskPick{
      display:none;
    }
    #datesPick,
    #rangePick,
    #rangePickEnd{
      display:none;
    }
    .timeline{
      position:relative;
      height: 960px;
      border:1px dashed var(--grid);
      border-radius:14px;
      background:var(--surface-2);
      overflow:hidden;
    }
    .timeline-hour{
      position:absolute;
      left:0;
      right:0;
      height:40px;
      border-top:1px solid var(--grid);
      padding-left:44px;
      font-size:11px;
      color:var(--muted);
      display:flex;
      align-items:flex-start;
    }
    .timeline-hour span{
      position:absolute;
      left:8px;
      top:4px;
    }
    .timeline-block{
      position:absolute;
      border-radius:10px;
      padding:6px 8px;
      background:var(--item-bg);
      border:1px solid var(--grid);
      box-shadow:var(--shadow);
      font-size:12px;
    }
    .timeline-block.habit{
      border-left:4px solid var(--accent);
    }
    .timeline-block.task{
      border-left:4px solid #f08c00;
    }
    [data-theme="dark"] .timeline-block.task{
      border-left-color:#ffb347;
    }
    .timeline-meta{
      font-size:11px;
      color:var(--muted);
    }
    .view-toolbar{
      display:flex;
      flex-wrap:wrap;
      gap:10px 14px;
      align-items:end;
      margin-bottom:12px;
      padding:10px 12px;
      background:var(--surface);
      border:1px solid var(--grid);
      border-radius:14px;
      box-shadow:var(--shadow);
    }
    .view-summary{
      display:grid;
      gap:10px;
      grid-template-columns: repeat(3, minmax(180px, 1fr));
      margin-bottom:12px;
    }
    .week-grid{
      display:grid;
      gap:10px;
      grid-template-columns: repeat(7, minmax(140px, 1fr));
    }
    .table-wrap.week-view{
      padding:12px;
    }
    .habit-week-view{
      --week-days:7;
      display:grid;
      gap:10px;
      min-width: 860px;
    }
    .habit-week-head,
    .habit-week-row{
      display:grid;
      grid-template-columns: minmax(220px, 1.6fr) repeat(var(--week-days), minmax(44px, 1fr));
      gap:6px;
      align-items:center;
    }
    .habit-week-head{
      position:sticky;
      top:0;
      z-index:2;
      padding:8px;
      border-radius:14px;
      background:linear-gradient(180deg, color-mix(in srgb, var(--surface-3) 80%, var(--surface) 20%), var(--surface-3));
      border:1px solid color-mix(in srgb, var(--grid) 70%, var(--surface) 30%);
      box-shadow:0 10px 24px rgba(15, 23, 42, 0.06);
    }
    .habit-week-head-label{
      font-size:11px;
      font-weight:700;
      color:var(--muted);
      text-transform:uppercase;
      letter-spacing:0.16em;
      padding-left:4px;
    }
    .habit-week-head-cell{
      display:flex;
      flex-direction:column;
      align-items:center;
      justify-content:center;
      gap:6px;
      padding:8px 6px 0;
      border-radius:12px;
      border:1px solid color-mix(in srgb, var(--grid) 70%, var(--surface) 30%);
      background:linear-gradient(180deg, var(--surface), var(--surface-2));
      box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--surface) 60%, transparent);
      min-width:0;
      overflow:hidden;
      text-align:center;
    }
    .habit-week-date-line{
      display:flex;
      align-items:center;
      gap:6px;
      font-size:12px;
      font-weight:700;
      text-transform:uppercase;
      letter-spacing:0.12em;
      color:var(--text);
    }
    .habit-week-month{
      font-size:11px;
      color:var(--muted);
      letter-spacing:0.18em;
    }
    .habit-week-day-stats{
      display:grid;
      gap:4px;
      font-size:10px;
      color:var(--muted);
      text-transform:uppercase;
      letter-spacing:0.08em;
    }
    .habit-week-day-stats strong{
      font-weight:700;
      color:var(--text);
      margin-left:4px;
      font-size:10px;
      text-transform:none;
      letter-spacing:0;
    }
    .habit-week-day-inline{
      display:flex;
      gap:12px;
      align-items:center;
      justify-content:space-between;
      text-transform:uppercase;
      width:100%;
      padding:4px 8px;
      border:1px solid var(--grid);
      border-radius:0;
      background:var(--surface-2);
    }
    .habit-week-day-inline span{
      display:inline-flex;
      gap:4px;
      align-items:center;
      white-space:nowrap;
    }
    .habit-week-day-progress{
      display:grid;
      gap:6px;
      align-items:center;
      justify-items:center;
      width:100%;
      margin-top:auto;
    }
    .habit-week-day-progress-label{
      font-size:10px;
      color:var(--muted);
    }
    .habit-week-day-progress-bar{
      height:5px;
      width:100%;
      border-radius:0;
      background:var(--surface-3);
      border:1px solid color-mix(in srgb, var(--grid) 70%, var(--surface) 30%);
      overflow:hidden;
      --progress:0;
      background:linear-gradient(
        90deg,
        var(--accent) 0%,
        var(--accent) calc(var(--progress) * 1%),
        var(--surface-3) calc(var(--progress) * 1%),
        var(--surface-3) 100%
      );
    }
    .habit-week-date{
      font-size:14px;
      font-weight:700;
      color:var(--text);
    }
    .habit-week-select-day{
      width:14px;
      height:14px;
      margin-top:2px;
    }
    .habit-week-body{
      display:grid;
      gap:8px;
    }
    .habit-week-row{
      padding:8px;
      border:1px solid var(--grid);
      border-radius:14px;
      background:var(--surface);
      box-shadow:var(--shadow);
    }
    .habit-week-habit{
      display:flex;
      align-items:center;
      gap:8px;
      min-width:0;
    }
    .habit-week-name{
      font-size:12px;
      font-weight:600;
      overflow:hidden;
      text-overflow:ellipsis;
      white-space:nowrap;
    }
    .habit-week-progress{
      margin-left:auto;
      font-size:11px;
      color:var(--muted);
      border:1px solid var(--grid);
      padding:2px 6px;
      border-radius:999px;
      background:var(--surface-2);
      flex-shrink:0;
    }
    .habit-week-cell{
      display:flex;
      align-items:center;
      justify-content:center;
      padding:6px 4px;
      border-radius:10px;
      background:var(--surface-2);
      border:1px solid transparent;
    }
    .habit-week-cell.is-weekend{
      background:color-mix(in srgb, var(--weekend) 70%, var(--surface) 30%);
    }
    .habit-week-head-cell.is-weekend{
      background:color-mix(in srgb, var(--weekend) 70%, var(--surface) 30%);
    }
    .habit-week-cell.is-today{
      box-shadow: inset 0 0 0 1px var(--today-border);
    }
    .week-card{
      border:1px solid var(--grid);
      border-radius:14px;
      padding:12px;
      background:var(--item-bg);
      display:flex;
      flex-direction:column;
      gap:10px;
      min-height:190px;
      position:relative;
    }
    .week-card h4{
      margin:0;
      font-size:12px;
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:8px;
    }
    .week-card .meta{
      font-size:11px;
      color:var(--muted);
    }
    .week-card .meta strong{
      color:var(--text);
      font-weight:700;
    }
    .week-card .stats{
      display:grid;
      gap:6px;
      grid-template-columns: repeat(2, minmax(80px, 1fr));
    }
    .week-top{
      display:grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      border:1px solid var(--grid);
      border-radius:0;
      overflow:hidden;
      background:var(--surface-2);
    }
    .week-top-cell{
      padding:8px 10px;
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:8px;
      font-size:12px;
      background:transparent;
      border:0;
      border-right:1px solid var(--grid);
      color:var(--text);
    }
    .week-top-cell:last-child{
      border-right:0;
    }
    .week-top-cell strong{
      font-size:12px;
    }
    .week-top-cell.week-habits{
      cursor:pointer;
    }
    .week-progress{
      position:relative;
      display:flex;
      align-items:center;
      gap:8px;
      flex-direction:column;
      align-items:stretch;
      margin-top:-4px;
      padding-top:8px;
    }
    .week-progress-pill{
      font-size:11px;
      padding:2px 10px;
      border-radius:999px;
      border:1px solid var(--grid);
      background:var(--surface-2);
      color:var(--muted);
      position:absolute;
      top:-2px;
      left:50%;
      transform:translateX(-50%);
      z-index:2;
    }
    .week-progress-bar{
      /* flex:1; */
      height: 3px;
    margin-top: -1px;
      border-radius:999px;
      background:var(--surface-3);
      border:1px solid var(--grid);
      overflow:hidden;
      width:100%;
      z-index:1;
      position:relative;
      --progress:0;
      background:linear-gradient(
        90deg,
        var(--accent) 0%,
        var(--accent) calc(var(--progress) * 1%),
        var(--surface-3) calc(var(--progress) * 1%),
        var(--surface-3) 100%
      );
    }
    .week-tasks{
      display:flex;
      margin-top: 20px;
      flex-direction:column;
      gap:6px;
    }
    span.week-task-time {
   margin-top: -15px;
    font-weight: 300;
    border-radius: 10px;
    background: #b1b1b138;
    padding: 0px 10px;
    font-size: 10px;
}
    .week-tasks-title{
      font-size:11px; 
     margin-top: -20px;
      text-transform:uppercase;
      letter-spacing:0.12em;
      color:var(--muted);
    }
    .week-task-list{
      display:grid;
      gap:6px;
    }
    .week-task{
     margin-top: 10px;
    font-weight: 600;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    padding: 6px 8px;
    border: 1px solid var(--grid);
    border-radius: 3px;
    background: var(--surface-2);
    font-size: 11px;
    }
    .week-task-time{
      /* font-weight:700; */
      color:var(--accent-2);
      white-space:nowrap;
    }
    .week-task.empty{
      justify-content:center;
      color:var(--muted);
      font-style:italic;
    }
    .stat-pill{
      border:1px solid var(--grid);
      border-radius:10px;
      padding:6px 8px;
      font-size:11px;
      background:var(--surface-2);
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:6px;
    }
    .stat-pill strong{
      color:var(--text);
    }
    .task-chip{
      display:inline-flex;
      align-items:center;
      gap:6px;
      padding:4px 6px;
      border-radius:999px;
      border:1px solid var(--grid);
      background:var(--surface-2);
      font-size:10px;
      margin:2px 4px 0 0;
    }
    .week-card .card-actions{
      display:flex;
      gap:6px;
      flex-wrap:wrap;
      margin-top:auto;
      padding-top:6px;
      border-top:1px dashed var(--grid);
    }
    .habit-toggle{
      padding:4px 8px;
      font-size:11px;
      border-radius:8px;
      background:var(--surface-2);
    }
    .week-footer{
      margin-top:auto;
      padding-top:6px;
      border-top:1px dashed var(--grid);
    }
    .week-add{
      width:100%;
      padding:8px 10px;
      border-radius:0;
      border:0;
      background:transparent;
      font-weight:300;
      cursor:pointer;
      color:var(--accent);
      margin-bottom: -6px;
    }
    .week-add:hover{
      color:var(--accent-2);
      background:rgba(47, 111, 228, 0.08);
    }
    .habit-popover{
      position:fixed;
      max-width:360px;
      width: min(360px, 90vw);
      padding:10px;
      border:1px solid var(--grid);
      border-radius:12px;
      background:var(--surface-3);
      box-shadow:var(--shadow);
      display:none;
      z-index:80;
    }
    .habit-popover.show{
      display:grid;
      grid-template-columns: repeat(2, minmax(140px, 1fr));
      gap:6px;
    }
    .habit-pill{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:8px;
      font-size:11px;
      padding:4px 6px;
      border-radius:8px;
      background:var(--surface);
      border:1px solid var(--grid);
      min-height:28px;
    }
    .habit-pill span{
      display:flex;
      align-items:center;
      gap:6px;
    }
    .habit-status{
      width:18px;
      height:18px;
      border-radius:6px;
      display:inline-flex;
      align-items:center;
      justify-content:center;
      font-size:11px;
      font-weight:700;
      border:1px solid var(--grid);
      background:var(--surface-2);
    }
    .habit-status svg{
      width:12px;
      height:12px;
      display:block;
    }
    .habit-status.done{
      color:#1b7a3c;
      border-color:rgba(43, 154, 77, 0.45);
      background:rgba(43, 154, 77, 0.16);
    }
    .habit-status.miss{
      color:var(--danger-text);
      border-color:var(--danger-border);
      background:rgba(181, 71, 71, 0.08);
    }
    .habit-pill.done{
      border-color:rgba(47, 111, 228, 0.4);
      background:rgba(47, 111, 228, 0.08);
    }
    [data-theme="dark"] .habit-pill.done{
      border-color:rgba(91, 140, 255, 0.45);
      background:rgba(91, 140, 255, 0.18);
    }
    .calendar{
      display:grid;
      gap:8px;
      grid-template-columns: repeat(7, minmax(120px, 1fr));
    }
    .calendar .day-card{
      border:1px solid var(--grid);
      border-radius:12px;
      padding:8px;
      background:var(--item-bg);
      min-height:90px;
    }
    .calendar .day-title{
      font-weight:700;
      font-size:12px;
    }
    .calendar .day-meta{
      font-size:11px;
      color:var(--muted);
      margin-top:4px;
    }
    .long-grid{
      display:grid;
      gap:10px;
      grid-template-columns: repeat(3, minmax(200px, 1fr));
    }
    .long-card{
      border:1px solid var(--grid);
      border-radius:14px;
      padding:12px;
      background:var(--item-bg);
    }
    .long-card h4{
      margin:0 0 6px;
      font-size:13px;
    }
    .long-card .meta{
      font-size:11px;
      color:var(--muted);
    }
    .year-goals{
      display:grid;
      gap:12px;
      grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
      margin-top:12px;
    }
    .goal-box{
      border:1px solid var(--grid);
      border-radius:14px;
      padding:12px;
      background:var(--item-bg);
    }
    .goal-box h4{
      margin:0 0 6px;
      font-size:13px;
    }
    .goal-box textarea{
      width:100%;
      min-height:120px;
      resize:vertical;
    }
    .theme-textarea{
      min-height:140px;
    }
    .goal-form{
      display:grid;
      gap:8px;
      margin-bottom:10px;
    }
    .goal-row{
      display:grid;
      gap:8px;
      grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
    .goal-list{
      display:grid;
      gap:8px;
      max-height: 260px;
      overflow:auto;
      padding-right:2px;
    }
    .goal-card{
      border:1px solid var(--grid);
      border-radius:12px;
      padding:8px 10px;
      background:var(--surface-2);
      display:grid;
      gap:6px;
      position:relative;
    }
    .goal-title{
      font-size:12px;
      font-weight:700;
    }
    .goal-desc{
      font-size:11px;
      color:var(--muted);
    }
    .goal-tags{
      display:flex;
      flex-wrap:wrap;
      gap:6px;
      font-size:10px;
      color:var(--muted);
    }
    .goal-tag{
      padding:2px 6px;
      border-radius:999px;
      border:1px solid var(--grid);
      background:var(--surface);
    }
    .goal-remove{
      position:absolute;
      right:8px;
      top:8px;
      border:1px solid var(--grid);
      background:transparent;
      border-radius:8px;
      padding:2px 6px;
      font-size:10px;
      cursor:pointer;
      color:var(--danger-text);
    }
    .goal-remove:hover{
      background:rgba(181, 71, 71, 0.1);
    }
    .goal-empty{
      font-size:11px;
      color:var(--muted);
      padding:6px 0;
    }
    .projects-head{
      display:flex;
      flex-wrap:wrap;
      gap:12px;
      align-items:flex-end;
      justify-content:space-between;
      margin-bottom:12px;
    }
    .projects-summary{
      margin-bottom:12px;
    }
    .project-table th,
    .project-table td{
      font-size:12px;
    }
    .project-tasks-row td{
      padding:12px 16px;
      background:var(--surface-2);
      border-top:1px dashed var(--grid);
    }
    .project-task-list{
      display:grid;
      gap:8px;
    }
    .project-task-item{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      padding:6px 8px;
      border:1px solid var(--grid);
      border-radius:10px;
      background:var(--surface);
      font-size:12px;
    }
    .project-task-item.done{
      opacity:0.7;
      text-decoration:line-through;
    }
    .project-task-actions{
      display:flex;
      gap:8px;
      align-items:center;
    }
    .project-task-manage{
      margin-top:8px;
    }
    .budget-actions{
      display:flex;
      gap:12px;
      align-items:flex-end;
    }
    .budget-actions .field{
      min-width:120px;
    }
    .budget-summary{
      display:flex;
      flex-wrap:wrap;
      gap:12px;
      margin-bottom:16px;
    }
    .budget-summary .card{
      flex:1 1 220px;
      min-width:200px;
    }
    .budget-grid{
      display:grid;
      gap:12px;
      grid-template-columns: repeat(3, minmax(240px, 1fr));
      margin-bottom:16px;
    }
    .budget-panel{
      display:flex;
      flex-direction:column;
      gap:10px;
      min-height:320px;
    }
    .budget-form{
      display:grid;
      gap:8px;
    }
    .budget-row{
      display:grid;
      gap:8px;
      grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
    .budget-panel .goal-list{
      flex:1;
    }
    .budget-toolbar{
      display:flex;
      flex-wrap:wrap;
      gap:12px;
      align-items:center;
      justify-content:space-between;
      padding:10px 12px;
      border:1px solid var(--grid);
      border-radius:14px;
      background:var(--surface);
      box-shadow:var(--shadow);
      margin-bottom:16px;
    }
    .budget-month-bar{
      display:flex;
      flex-wrap:wrap;
      gap:6px;
      padding:6px;
      border:1px solid var(--grid);
      border-radius:12px;
      background:var(--surface-2);
      max-width:100%;
    }
    .budget-month-btn{
      padding:4px 8px;
      font-size:11px;
      border-radius:10px;
      background:transparent;
    }
    .budget-month-btn.active{
      background:linear-gradient(135deg, var(--accent), #4a84ee);
      color:#fff;
      border-color:transparent;
    }
    .budget-nav{
      display:flex;
      align-items:center;
      gap:8px;
      flex-wrap:wrap;
    }
    .icon-btn{
      width:34px;
      height:34px;
      padding:0;
      display:grid;
      place-items:center;
    }
    .budget-month-grid{
      display:grid;
      gap:10px;
      grid-template-columns: repeat(4, minmax(160px, 1fr));
    }
    .budget-month-card{
      border:1px solid var(--grid);
      border-radius:12px;
      padding:10px;
      background:var(--surface-2);
      display:grid;
      gap:6px;
      font-size:12px;
    }
    .budget-month-card strong{
      font-size:13px;
    }
    .budget-filters{
      display:flex;
      flex-wrap:wrap;
      gap:8px;
      align-items:center;
      margin-bottom:10px;
    }
    .budget-table-wrap{
      max-height: 420px;
      overflow:auto;
    }
    .budget-table td,
    .budget-table th{
      font-size:12px;
      white-space:nowrap;
    }
    .budget-table td.note-cell{
      white-space:normal;
      min-width:200px;
    }
    .balance-positive{ color:#1b7a3c; }
    .balance-warning{ color:#c47a12; }
    .balance-negative{ color:#b54747; }
    .budget-progress{
      height:8px;
      border-radius:999px;
      background:var(--surface-3);
      border:1px solid var(--grid);
      overflow:hidden;
    }
    .budget-progress span{
      display:block;
      height:100%;
      width:0%;
      background:linear-gradient(90deg, var(--accent), #59a0ff);
    }
    .budget-progress.warn span{
      background:linear-gradient(90deg, #f0ad4e, #f7c46a);
    }
    .budget-progress.over span{
      background:linear-gradient(90deg, #e05a5a, #f28b82);
    }
    .budget-category-row{
      display:grid;
      gap:6px;
    }
    .budget-category-top{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:8px;
      font-size:12px;
      font-weight:600;
    }
    .budget-category-meta{
      font-size:11px;
      color:var(--muted);
      display:flex;
      gap:8px;
      align-items:center;
      flex-wrap:wrap;
    }
    .project-table th:first-child,
    .project-table td:first-child{
      text-align:left;
      min-width: 220px;
    }
    .project-meta{
      font-size:11px;
      color:var(--muted);
    }
    .badge{
      display:inline-flex;
      align-items:center;
      justify-content:center;
      padding:4px 8px;
      border-radius:999px;
      font-size:11px;
      font-weight:600;
      border:1px solid transparent;
    }
    .status-active{
      background:var(--status-active-bg);
      color:var(--status-active-text);
      border-color:var(--status-active-border);
    }
    .status-paused{
      background:var(--status-paused-bg);
      color:var(--status-paused-text);
      border-color:var(--status-paused-border);
    }
    .status-completed{
      background:var(--status-completed-bg);
      color:var(--status-completed-text);
      border-color:var(--status-completed-border);
    }
    .priority-low{
      background:var(--priority-low-bg);
      color:var(--priority-low-text);
      border-color:var(--priority-low-border);
    }
    .priority-medium{
      background:var(--priority-medium-bg);
      color:var(--priority-medium-text);
      border-color:var(--priority-medium-border);
    }
    .priority-high{
      background:var(--priority-high-bg);
      color:var(--priority-high-text);
      border-color:var(--priority-high-border);
    }
    .progress-mini{
      height:6px;
      border-radius:999px;
      background:var(--surface-3);
      overflow:hidden;
      margin-top:6px;
    }
    .progress-mini span{
      display:block;
      height:100%;
      background:linear-gradient(90deg, var(--accent), #59a0ff);
    }
    .overdue{
      color:var(--danger-text);
      font-weight:600;
    }
    .project-manager,
    .task-manager{
      display:grid;
      gap:12px;
    }
    .form-grid{
      display:grid;
      gap:10px 12px;
      grid-template-columns: repeat(3, minmax(140px, 1fr));
      margin-bottom:12px;
    }
    .input,
    .select,
    .textarea{
      padding:8px 10px;
      border:1px solid var(--grid);
      border-radius:10px;
      background:var(--surface-2);
      color:var(--text);
      font-family:inherit;
      font-size:13px;
      width:100%;
    }
    .field label{
      font-size:12px;
      color:var(--muted);
      font-weight:600;
      letter-spacing:0.02em;
    }
    .project-list,
    .task-list{
      display:flex;
      flex-direction:column;
      gap:10px;
      max-height: 360px;
      overflow:auto;
      padding-right:2px;
    }
    .project-item,
    .task-item{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      padding:10px 12px;
      border:1px solid var(--grid);
      border-radius:14px;
      background:var(--item-bg);
    }
    .project-actions,
    .task-actions{
      display:flex;
      gap:6px;
      flex-shrink:0;
      flex-wrap:wrap;
      justify-content:flex-end;
    }
    .task-item label{
      display:flex;
      align-items:center;
      gap:8px;
      font-size:13px;
      font-weight:600;
    }

    .table-wrap{
      border:1px solid var(--grid);
      border-radius:18px;
      overflow:auto;
      background:var(--surface);
      box-shadow:var(--shadow);
      min-height: 180px;
      -webkit-overflow-scrolling: touch;
    }
    .empty-state{
      padding:26px 20px;
      text-align:center;
      color:var(--muted);
      font-size:13px;
    }
    table{
      border-collapse: collapse;
      min-width: 1000px;
      width: 100%;
    }
    th, td{
      border:1px solid var(--grid);
      padding: 6px;
      text-align: center;
      white-space: nowrap;
      font-size: 12px;
    }
    thead th{
      position: sticky;
      top: 0;
      background: var(--surface-3);
      z-index: 3;
    }
    .habit-col{
      position: sticky;
      left: 0;
      z-index: 4;
      background: var(--surface-3);
      text-align: left;
      min-width: 240px;
      font-weight: 600;
    }
    tbody td.habit-col{
      font-weight: 500;
    }
    .month-row th{
      background:var(--surface-3);
      font-weight:700;
      z-index: 5;
    }
    .subhead{
      background:var(--surface-2);
      font-weight:600;
    }
    .cell{
      width: 28px;
      height: 28px;
    }
    .select-row th{
      background:var(--surface-2);
      font-size:11px;
      padding:4px 6px;
    }
    .select-label{
      font-weight:600;
      color:var(--muted);
    }
    .select-all{
      display:flex;
      align-items:center;
      justify-content:center;
    }
    .select-all input{
      width:14px;
      height:14px;
    }
    tfoot th,
    tfoot td{
      background:var(--surface-2);
      font-weight:600;
    }
    tfoot td.footer-cell{
      font-weight:500;
    }
    tbody tr:hover td{
      background:var(--hover);
    }
    input[type="checkbox"]{
      width: 16px;
      height: 16px;
      accent-color: var(--accent);
      cursor: pointer;
    }
    input[type="checkbox"]:disabled{
      cursor:not-allowed;
      opacity:0.6;
    }
    .habit-table input[type="checkbox"],
    .habit-week-view input[type="checkbox"]{
      -webkit-appearance:none;
      appearance:none;
      width:16px;
      height:16px;
      border-radius:4px;
      border:2px solid var(--grid);
      background:var(--surface-2);
      display:grid;
      place-items:center;
      cursor:pointer;
      transition:border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
    }
    .habit-table input[type="checkbox"]::after,
    .habit-week-view input[type="checkbox"]::after{
      content:"";
      width:2px;
      height:6px;
      border:2px solid transparent;
      border-top:0;
      border-left:0;
      transform:rotate(45deg) scale(0);
      transition: transform 0.12s ease;
    }
    .habit-table input[type="checkbox"]:checked,
    .habit-week-view input[type="checkbox"]:checked{
      background:linear-gradient(135deg, var(--accent-2), #6cc6ff);
      border-color:var(--accent-2);
      box-shadow:0 0 0 2px rgba(74, 132, 238, 0.2);
    }
    .habit-table input[type="checkbox"]:checked::after,
    .habit-week-view input[type="checkbox"]:checked::after{
      border-color:#ffffff;
      transform:rotate(45deg) scale(1);
    }
    .habit-table input[type="checkbox"]:disabled,
    .habit-week-view input[type="checkbox"]:disabled{
      opacity:1;
      cursor:not-allowed;
    }
    .habit-table input[type="checkbox"]:disabled:checked,
    .habit-week-view input[type="checkbox"]:disabled:checked{
      opacity:1;
      background:linear-gradient(135deg, var(--accent-2), #6cc6ff) !important;
      border-color:var(--accent-2) !important;
      box-shadow:0 0 0 2px rgba(74, 132, 238, 0.2);
    }
    .habit-table input[type="checkbox"]:disabled:checked::after,
    .habit-week-view input[type="checkbox"]:disabled:checked::after{
      border-color:#ffffff !important;
      transform:rotate(45deg) scale(1);
    }
    .habit-table input.today-checkbox,
    .habit-week-view input.today-checkbox{
      -webkit-appearance:none;
      appearance:none;
      width:16px;
      height:16px;
      border-radius:4px;
      border:2px solid color-mix(in srgb, var(--today-check) 55%, var(--grid));
      background:linear-gradient(180deg, color-mix(in srgb, var(--today-check) 10%, var(--surface-2)), var(--surface-2));
      display:grid;
      place-items:center;
      outline:2px solid color-mix(in srgb, var(--today-check) 35%, transparent);
      outline-offset:2px;
      box-shadow:0 6px 12px rgba(239, 68, 68, 0.08);
      transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.05s ease;
    }
    .habit-table input.today-checkbox:hover,
    .habit-week-view input.today-checkbox:hover{
      box-shadow:0 0 0 2px var(--today-check-glow), 0 8px 16px rgba(239, 68, 68, 0.15);
    }
    .habit-table input.today-checkbox::after,
    .habit-week-view input.today-checkbox::after{
      content:"";
      width:2px;
      height:6px;
      border:2px solid transparent;
      border-top:0;
      border-left:0;
      transform:rotate(45deg) scale(0);
      transition: transform 0.12s ease;
    }
    .habit-table input.today-checkbox:checked,
    .habit-week-view input.today-checkbox:checked{
      border-color:var(--today-accent);
      background:linear-gradient(135deg, color-mix(in srgb, var(--today-accent) 75%, #3dd68c), var(--today-accent));
      box-shadow:0 0 0 3px color-mix(in srgb, var(--today-accent) 45%, transparent), 0 10px 18px rgba(34, 197, 94, 0.22);
    }
    .habit-table input.today-checkbox:checked::after,
    .habit-week-view input.today-checkbox:checked::after{
      border-color:#ffffff;
      transform:rotate(45deg) scale(1);
    }
    .habit-table input.today-checkbox:disabled,
    .habit-week-view input.today-checkbox:disabled{
      border-color:color-mix(in srgb, var(--today-check) 45%, var(--grid));
      background:var(--today-check-soft);
      box-shadow:none;
    }
    .habit-table input.today-checkbox:disabled:checked,
    .habit-week-view input.today-checkbox:disabled:checked{
      background:linear-gradient(135deg, color-mix(in srgb, var(--today-accent) 75%, #3dd68c), var(--today-accent)) !important;
      border-color:var(--today-accent) !important;
      box-shadow:0 0 0 3px color-mix(in srgb, var(--today-accent) 45%, transparent) !important;
    }
    .habit-table input.today-checkbox:disabled:checked::after,
    .habit-week-view input.today-checkbox:disabled:checked::after{
      border-color:#ffffff !important;
    }
    .is-weekend{
      background:var(--weekend);
    }
    .habit-table td.is-weekend,
    .habit-table th.is-weekend{
      background:color-mix(in srgb, var(--weekend) 70%, var(--surface) 30%);
    }
    .is-locked{
      background:var(--surface-2);
      color:var(--muted);
    }
    .is-today{
      background:var(--today) !important;
      border-color:var(--today-border) !important;
      box-shadow: inset 0 0 0 1px var(--today-border), 0 0 12px rgba(34, 197, 94, 0.25);
    }
    thead th.is-today{
      background:var(--today) !important;
      border-color:var(--today-border) !important;
      box-shadow: inset 0 0 0 1px var(--today-border), 0 0 12px rgba(34, 197, 94, 0.3);
    }
    tbody td.is-today{
      background:var(--today) !important;
      box-shadow: inset 0 0 0 1px var(--today-border), 0 0 12px rgba(34, 197, 94, 0.25);
    }
    tbody tr:hover td.is-today{
      background:var(--today) !important;
    }

    .summary{
      margin-top: 16px;
      display:grid;
      grid-template-columns: repeat(4, minmax(160px, 1fr));
      gap: 12px;
    }
    .summary.budget-summary{
      display:flex;
      flex-wrap:wrap;
      gap:12px;
    }
    .card{
      border:1px solid var(--grid);
      border-radius:18px;
      padding: 12px 14px;
      background:var(--surface);
      box-shadow:var(--shadow);
    }
    .card .k{ font-size:12px; color:var(--muted); }
    .card .v{ font-size:20px; font-weight:700; margin-top:6px; }
    .range-card{
      display:flex;
      flex-direction:column;
      gap:8px;
      grid-column: span 3;
    }
    .range-sub{
      font-size:11px;
      color:var(--muted);
    }
    .range-stats{
      display:flex;
      flex-wrap:wrap;
      gap:6px;
    }
    .range-stats .stat-pill{
      background:var(--surface-2);
    }
    .progressbar{
      height:10px;
      border-radius:999px;
      background:var(--surface-3);
      overflow:hidden;
      margin-top:10px;
    }
    .progressbar > div{
      height:100%;
      width:0%;
      background:linear-gradient(90deg, var(--accent), #59a0ff);
      transition: width 0.3s ease;
    }

    .footer-table{
      margin-top: 14px;
      border: 1px solid var(--grid);
      border-radius: 18px;
      overflow:auto;
      background:var(--surface);
      box-shadow:var(--shadow);
    }
    .footer-table:empty{
      display:none;
    }
    .footer-table table{ min-width: 1000px; }
    .row-label{
      position: sticky;
      left: 0;
      background: var(--surface-3);
      z-index: 2;
      text-align:left;
      font-weight:700;
    }
    .modal{
      position:fixed;
      inset:0;
      display:flex;
      align-items:center;
      justify-content:center;
      padding:20px;
      background:var(--overlay);
      opacity:0;
      visibility:hidden;
      pointer-events:none;
      transition:opacity 0.2s ease;
      z-index:60;
    }
    .modal.open{
      opacity:1;
      visibility:visible;
      pointer-events:auto;
    }
    .modal-dialog{
      background:var(--surface);
      border:1px solid var(--grid);
      border-radius:20px;
      box-shadow:var(--shadow);
      width:min(980px, 100%);
      max-height:90vh;
      overflow:auto;
      padding:16px 18px 18px;
      animation: rise 0.3s ease both;
    }
    .modal-head{
      display:flex;
      justify-content:space-between;
      align-items:flex-start;
      gap:12px;
      margin-bottom:12px;
    }
    body.modal-open{
      overflow:hidden;
    }
    @keyframes rise{
      from{ opacity:0; transform: translateY(10px); }
      to{ opacity:1; transform: translateY(0); }
    }
    .hero,
    .toolbar,
    .manage,
    .table-wrap,
    .projects,
    .footer-table{
      animation: rise 0.6s ease both;
    }
    .summary .card{
      animation: rise 0.6s ease both;
    }
    .hero{ animation-delay: 0.02s; }
    .toolbar{ animation-delay: 0.06s; }
    .table-wrap{ animation-delay: 0.1s; }
    .summary .card:nth-child(1){ animation-delay: 0.14s; }
    .summary .card:nth-child(2){ animation-delay: 0.18s; }
    .summary .card:nth-child(3){ animation-delay: 0.22s; }
    .summary .card:nth-child(4){ animation-delay: 0.26s; }
    .footer-table{ animation-delay: 0.3s; }
    @media (max-width: 980px){
      .main-nav{ grid-template-columns: 1fr; }
      .brand{ min-width:0; }
      .summary{ grid-template-columns: repeat(2, minmax(160px, 1fr)); }
      .summary .range-card{ grid-column: 1 / -1; }
      .budget-summary{ display:flex; }
      .habit-col{ min-width: 200px; }
      .habit-week-view{ min-width: 760px; }
      .habit-week-head,
      .habit-week-row{
        grid-template-columns: minmax(180px, 1.4fr) repeat(var(--week-days), minmax(50px, 1fr));
      }
      .habit-week-head-cell{ padding:6px 4px 0; }
      .habit-week-date-line{ font-size:11px; }
      .habit-week-day-inline{ padding:4px 6px; gap:8px; }
      .habit-week-day-progress-bar{ height:4px; }
      .manage-grid{ grid-template-columns: 1fr; }
      .form-grid{ grid-template-columns: repeat(2, minmax(140px, 1fr)); }
      .day-layout{ flex-direction:column; }
      .day-panels{ grid-template-columns: 1fr; }
      .calendar{ grid-template-columns: repeat(2, minmax(140px, 1fr)); }
      .long-grid{ grid-template-columns: repeat(2, minmax(180px, 1fr)); }
      .week-grid{ grid-template-columns: repeat(2, minmax(160px, 1fr)); }
      .view-summary{ grid-template-columns: repeat(2, minmax(160px, 1fr)); }
      .year-goals{ grid-template-columns: 1fr; }
      .addiction-grid{ grid-template-columns: repeat(6, minmax(0, 1fr)); }
      .addiction-grid .span-12,
      .addiction-grid .span-8,
      .addiction-grid .span-7,
      .addiction-grid .span-5,
      .addiction-grid .span-4{ grid-column: span 6; }
      .progress-grid{ grid-template-columns: 1fr; }
      .progress-card.span-2{ grid-column: span 1; }
      .coach-grid{ grid-template-columns: 1fr; }
      .agent-grid{ grid-template-columns: repeat(2, minmax(220px, 1fr)); }
      .ai-modal-body{ grid-template-columns: 1fr; }
      .ai-modal-dialog{ height:min(92vh, 980px); }
      .nav-switcher{ width:100%; }
      .nav-actions{
        width:100%;
        justify-content:flex-start;
        flex-direction:column;
        align-items:stretch;
        gap:10px;
      }
      .nav-actions .ai-nav-btn{
        align-self:flex-end;
      }
      .nav-toggle{
        display:flex;
      }
      .nav-switcher{
        display:grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap:8px;
        overflow:visible;
      }
      .main-nav:not(.nav-open) .nav-switcher{
        background:transparent;
        border:none;
        padding:0;
        box-shadow:none;
      }
      .main-nav:not(.nav-open) .nav-switcher{
        display:none;
      }
      .main-nav.nav-open .nav-switcher{
        background:var(--surface);
        border:1px solid var(--grid);
        border-radius:16px;
        padding:10px;
        box-shadow:var(--shadow);
      }
      .nav-switcher .nav-btn{
        display:none;
      }
      .main-nav.nav-open .nav-switcher .nav-btn{
        display:flex;
      }
      .nav-btn{
        width:100%;
        display:flex;
        align-items:center;
        justify-content:center;
      }
      .main-nav.nav-open .nav-btn{
        border:none;
        background:transparent;
        box-shadow:none;
      }
      .nav-tool{
        margin-left:0;
        justify-self:end;
        grid-column: 1 / -1;
      }
      .main-nav.nav-open .nav-tool{
        border:1px solid var(--grid);
        background:var(--surface-2);
        border-radius:12px;
        padding:6px;
        justify-self:stretch;
        display:flex;
        align-items:center;
        justify-content:center;
      }
      .main-nav.nav-open .nav-btn.active{
        background:linear-gradient(180deg, color-mix(in srgb, var(--accent) 18%, transparent), var(--surface));
        border:1px solid color-mix(in srgb, var(--accent) 35%, var(--grid));
        box-shadow:0 8px 16px rgba(47, 111, 228, 0.08);
      }
      .habit-mini.show{ grid-template-columns: 1fr; }
      .budget-grid{ grid-template-columns: repeat(2, minmax(220px, 1fr)); }
      .budget-month-grid{ grid-template-columns: repeat(2, minmax(160px, 1fr)); }
    }
    @media (max-width: 820px){
      .habit-col,
      .row-label{
        position: static;
        left: auto;
        z-index: 1;
        background: var(--surface);
      }
      thead th{
        position: static;
      }
      table{
        min-width: 720px;
      }
      .footer-table table{
        min-width: 720px;
      }
      .habit-week-head,
      .habit-week-row{
        grid-template-columns: minmax(170px, 1.3fr) repeat(var(--week-days), minmax(56px, 1fr));
      }
      .habit-week-head-cell{
        gap:4px;
        padding:6px 5px 6px;
      }
      .habit-week-date-line{
        flex-direction:column;
        gap:2px;
        line-height:1;
        letter-spacing:0.08em;
      }
      .habit-week-day-stats{
        gap:3px;
        width:100%;
      }
      .habit-week-day-inline{
        display:grid;
        grid-template-columns:1fr;
        gap:2px;
        padding:2px 4px;
      }
      .habit-week-day-inline span{
        justify-content:center;
        font-size:0;
      }
      .habit-week-day-inline span strong{
        font-size:9px;
      }
      .habit-week-day-inline span:first-child::before{
        content:"D";
        font-size:9px;
        color:var(--muted);
        margin-right:2px;
      }
      .habit-week-day-inline span:last-child::before{
        content:"N";
        font-size:9px;
        color:var(--muted);
        margin-right:2px;
      }
      .habit-week-day-progress-label{ display:none; }
    }
    @media (max-width: 620px){
      .summary{ grid-template-columns: 1fr; }
      .summary .range-card{ grid-column: 1 / -1; }
      .budget-summary{ display:flex; }
      .toolbar{ gap:10px; }
      .habit-col{ min-width: 160px; }
      .toolbar-group.actions{ width:100%; justify-content:flex-start; }
      .field{ width:100%; }
      .toolbar input[type="date"]{ width:100%; }
      .range-buttons{
        width:100%;
        flex-direction:column;
        align-items:stretch;
      }
      .range-group{
        width:100%;
      }
      .range-group .range-btn{
        flex:1 1 0;
      }
      .range-btn[data-preset="this-month"]{
        width:100%;
      }
      .range-btn{ flex:1 1 auto; }
      .chip{ width:100%; text-align:center; }
      .form-grid{ grid-template-columns: 1fr; }
      .project-item,
      .task-item{
        align-items:flex-start;
        flex-direction:column;
      }
      .day-form{ grid-template-columns: 1fr; }
      .calendar{ grid-template-columns: 1fr; }
      .long-grid{ grid-template-columns: 1fr; }
      .week-grid{ grid-template-columns: 1fr; }
      .habit-week-view{ min-width: 600px; }
      .habit-week-head,
      .habit-week-row{
        grid-template-columns: minmax(160px, 1.2fr) repeat(var(--week-days), minmax(56px, 1fr));
      }
      .habit-week-head{ padding:6px; }
      .habit-week-head-cell{
        gap:6px;
        padding:6px 6px 8px;
        position:static;
      }
      .habit-week-date-line{ font-size:9px; letter-spacing:0.06em; white-space:nowrap; }
      .habit-week-month{ font-size:9px; letter-spacing:0.12em; }
      .habit-week-select-day{
        position:static;
        margin-top:4px;
      }
      .habit-week-day-stats{ gap:4px; width:100%; }
      .habit-week-day-inline{
        font-size:9px;
        gap:2px;
        padding:0;
        display:grid;
        grid-template-columns: 1fr;
        align-items:center;
        justify-items:center;
        border:none;
        background:transparent;
        line-height:1.1;
      }
      .habit-week-day-inline span{
        display:flex;
        gap:3px;
        align-items:center;
        justify-content:center;
      }
      .habit-week-day-inline span{
        font-size:0;
      }
      .habit-week-day-inline span strong{
        font-size:9px;
      }
      .habit-week-day-inline span:first-child::before{
        content:"D";
        font-size:9px;
        color:var(--muted);
        margin-right:2px;
      }
      .habit-week-day-inline span:last-child::before{
        content:"N";
        font-size:9px;
        color:var(--muted);
        margin-right:2px;
      }
      .habit-week-day-progress{
        gap:4px;
        width:100%;
      }
      .habit-week-day-progress-label{ display:none; }
      .habit-week-day-progress-bar{ height:4px; }
      .habit-week-name{ font-size:11px; }
      .habit-week-progress{ font-size:10px; }
      .view-summary{ grid-template-columns: 1fr; }
      .addiction-grid{ grid-template-columns: 1fr; }
      .addiction-grid .span-12,
      .addiction-grid .span-8,
      .addiction-grid .span-7,
      .addiction-grid .span-5,
      .addiction-grid .span-4{ grid-column: 1 / -1; }
      .checkin-grid,
      .relapse-grid{ grid-template-columns: 1fr; }
      .coach-grid{ grid-template-columns: 1fr; }
      .addiction-section .hero-actions{
        align-items:flex-start;
        text-align:left;
        width:100%;
      }
      .hero-note{ max-width:100%; }
      .agent-grid{ grid-template-columns: 1fr; }
    .main-nav{ gap:10px; }
    .main-nav{
      grid-template-columns: 1fr auto auto;
      grid-template-rows: auto auto;
      align-items:center;
    }
    .brand{
      grid-column: 1;
      grid-row: 1;
    }
    .nav-actions{ display:contents; }
    .nav-toggle{
      grid-column: 3;
      grid-row: 1;
      justify-self:end;
      padding:8px;
      width:40px;
      height:40px;
      border-radius:12px;
      gap:0;
    }
    .nav-toggle-text{
      display:none;
    }
    .nav-switcher{
      grid-column: 1 / -1;
      grid-row: 2;
      width:100%;
    }
    .ai-nav-btn{
      grid-column: 2;
      grid-row: 1;
      justify-self:end;
      align-self:center;
      margin:0;
    }
      .nav-switcher{
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
      .nav-btn{
        flex:0 0 auto;
        font-size:11px;
        padding:8px 10px;
      }
      .theme-toggle{ width:40px; height:40px; }
      .ai-nav-btn .ai-fab-text{
        display:none;
      }
      .ai-fab-wrap{
        right:16px;
        bottom:16px;
      }
      .ai-panel{
        width:min(94vw, 360px);
      }
      .ai-modal{
        padding:12px;
      }
      .ai-modal-dialog{
        height:92vh;
        padding:12px;
      }
      .budget-grid{ grid-template-columns: 1fr; }
      .budget-month-grid{ grid-template-columns: 1fr; }
      .budget-toolbar{
        flex-direction:column;
        align-items:stretch;
      }
      .budget-nav{
        justify-content:space-between;
        width:100%;
      }
      .budget-month-bar{
        width:100%;
        justify-content:center;
      }
    .budget-month-btn{
      flex:1 1 auto;
      text-align:center;
    }
  }
  @media (max-width: 420px){
    .nav-switcher{
      grid-template-columns: 1fr;
    }
    .nav-tool{
      justify-self:start;
    }
    .habit-week-view{ min-width: 560px; }
    .habit-week-head,
    .habit-week-row{
      grid-template-columns: minmax(150px, 1.1fr) repeat(var(--week-days), minmax(52px, 1fr));
    }
    .range-buttons{
      flex-direction:column;
      align-items:stretch;
    }
    .range-group{
      width:100%;
    }
    .habit-week-head-cell{
      padding:6px 4px 6px;
    }
    .habit-week-date-line{
      font-size:9px;
      letter-spacing:0.08em;
    }
    .habit-week-day-inline span strong{
      font-size:8px;
    }
    .habit-week-day-progress-bar{
      height:3px;
    }
  }
  /* Addiction path redesign */
  .addiction-section .hero-panel{
    text-align:start;
    max-width:320px;
  }
  .addiction-section .hero-panel .hero-note{
    max-width:none;
  }
  .hero-badges{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin-top:8px;
  }
  .path-choice{
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap:16px;
    margin:18px 0 6px;
  }
  .path-choice.discipline-columns{
    align-items:start;
  }
  .discipline-column{
    display:flex;
    flex-direction:column;
    gap:16px;
    min-width:0;
  }
  .discipline-column.is-hidden{
    display:none;
  }
  .discipline-progress{
    margin-top:0;
  }
  .path-card{
    position:relative;
    padding:18px;
    border-radius:22px;
    border:1px solid var(--grid);
    background:linear-gradient(135deg, color-mix(in srgb, var(--surface) 88%, var(--accent) 8%), var(--surface));
    box-shadow:var(--shadow);
    display:flex;
    flex-direction:column;
    gap:10px;
    overflow:hidden;
  }
  .path-card.is-hidden{
    display:none;
  }
  .path-choice.single{
    grid-template-columns: 1fr;
  }
  .path-hide{
    position:absolute;
    top:12px;
    right:12px;
    padding:4px 8px;
    border-radius:999px;
    border:1px solid var(--grid);
    background:var(--surface);
    color:var(--muted);
    font-size:10px;
    letter-spacing:0.12em;
    text-transform:uppercase;
    cursor:pointer;
    z-index:2;
  }
  .path-hide:hover{
    border-color:var(--accent);
    color:var(--accent-2);
    background:color-mix(in srgb, var(--surface) 92%, var(--accent) 8%);
  }
  .path-card::after{
    content:"";
    position:absolute;
    inset:auto -60px -60px auto;
    width:180px;
    height:180px;
    border-radius:50%;
    background:color-mix(in srgb, var(--path-accent) 18%, transparent);
    opacity:0.8;
    pointer-events:none;
  }
  .path-card h2{
    font-size:20px;
    margin:0;
  }
  .path-card .sub{
    margin:0;
  }
  .path-card.break{ --path-accent:#e2a56b; }
  .path-card.build{ --path-accent:#4aa8a1; }
  .path-badge{
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:0.14em;
    font-weight:700;
    color:var(--path-accent);
  }
  .path-list{
    list-style:none;
    margin:0;
    padding:0;
    display:grid;
    gap:6px;
    font-size:12px;
    color:var(--muted);
  }
  .path-list li{
    display:flex;
    gap:8px;
    align-items:flex-start;
  }
  .path-list li::before{
    content:"-";
    color:var(--path-accent);
    font-weight:700;
  }
  .path-actions{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    margin-top:auto;
  }
  .path-actions .btn{
    text-decoration:none;
    display:inline-flex;
    align-items:center;
    justify-content:center;
  }
  .path-restore{
    display:none;
    gap:8px;
    flex-wrap:wrap;
    margin:8px 0 18px;
  }
  .path-restore.show{
    display:flex;
  }
  .path-restore .path-show{
    display:inline-flex;
    align-items:center;
    justify-content:center;
  }
  .example-tabs{
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap:16px;
    margin:18px 0;
  }
  .example-column{
    border:1px solid var(--grid);
    border-radius:20px;
    padding:14px;
    background:var(--surface);
    box-shadow:var(--shadow);
    display:grid;
    gap:12px;
  }
  .example-head h2{
    margin:0;
    font-size:18px;
  }
  .example-cards{
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap:8px;
  }
  .example-card{
    border:1px solid var(--grid);
    background:var(--surface-2);
    border-radius:12px;
    padding:8px 10px;
    font-size:12px;
    text-align:left;
    cursor:pointer;
    transition:transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  }
  .example-card:hover{
    background:var(--hover);
    border-color:color-mix(in srgb, var(--accent) 40%, var(--grid));
  }
  .example-card.active{
    background:linear-gradient(135deg, var(--accent), #4a84ee);
    color:#fff;
    border-color:transparent;
    box-shadow:0 12px 24px rgba(47, 111, 228, 0.2);
    transform:translateY(-1px);
  }
  .example-panel{
    border:1px dashed var(--grid);
    border-radius:14px;
    padding:10px 12px;
    background:var(--surface-2);
    min-height:84px;
    display:grid;
    gap:4px;
  }
  .example-panel-title{
    font-size:13px;
    font-weight:700;
  }
  .example-panel-text{
    margin:0;
  }
  .example-actions{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    flex-wrap:wrap;
  }
  .example-actions .btn{
    white-space:nowrap;
  }
  .example-empty{
    border:1px dashed var(--grid);
    border-radius:14px;
    padding:12px;
    background:var(--surface-2);
    gap:6px;
  }
  .example-empty:not([hidden]){
    display:grid;
  }
  .example-empty[hidden]{
    display:none !important;
  }
  .example-empty .empty-title{
    font-weight:600;
    font-size:13px;
  }
  .case-overview{
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap:8px;
  }
  .case-overview-card{
    border:1px solid var(--grid);
    border-radius:12px;
    padding:8px 10px;
    background:var(--surface);
    display:grid;
    gap:4px;
  }
  .case-overview-label{
    font-size:10px;
    text-transform:uppercase;
    letter-spacing:0.12em;
    color:var(--muted);
  }
  .case-overview-value{
    font-size:12px;
    font-weight:600;
  }
  .case-overview-note{
    font-size:12px;
    color:var(--muted);
  }
  .case-form{
    display:grid;
    gap:10px;
  }
  .case-form-row{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    align-items:center;
  }
  .case-form-grid{
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap:8px;
  }
  .case-form-grid .field.full{
    grid-column: 1 / -1;
  }
  .case-check{
    display:flex;
    align-items:center;
    gap:8px;
    padding:6px 10px;
    border-radius:999px;
    border:1px solid var(--grid);
    background:var(--surface-2);
    font-size:12px;
  }
  .case-form-actions{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
  }
  .case-checkboxes{
    display:grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap:8px;
  }
  @media (max-width: 820px){
    .case-checkboxes{
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }
  @media (max-width: 540px){
    .case-checkboxes{
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
  .case-checkbox{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:8px 12px;
    border-radius:12px;
    border:1px solid var(--grid);
    background:var(--surface);
    font-size:12px;
  }
  .case-checkbox input{
    accent-color: var(--accent);
    transform: scale(1.05);
  }
  .case-log{
    border:1px dashed var(--grid);
    border-radius:14px;
    padding:10px;
    background:var(--surface-2);
    display:grid;
    gap:8px;
  }
  .case-log-row{
    display:grid;
    grid-template-columns: 110px 120px 1fr;
    gap:8px;
    font-size:12px;
  }
  .case-log-row.header{
    font-size:10px;
    text-transform:uppercase;
    letter-spacing:0.1em;
    color:var(--muted);
  }
  .case-log-row span{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .case-overview-section{
    margin:22px 0 12px;
    display:grid;
    gap:14px;
  }
  .case-overview-block{
    border:1px solid var(--grid);
    border-radius:18px;
    padding:14px;
    background:var(--surface);
    box-shadow:var(--shadow);
    display:grid;
    gap:12px;
  }
  .case-overview-title{
    font-size:13px;
    font-weight:700;
  }
  .case-overview-grid{
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap:10px;
  }
  .case-summary-card{
    border:1px solid var(--grid);
    border-radius:14px;
    padding:10px 12px;
    background:var(--surface-2);
    display:grid;
    gap:8px;
  }
  .case-summary-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
  }
  .case-summary-title{
    font-size:13px;
    font-weight:700;
  }
  .case-summary-tag{
    font-size:10px;
    text-transform:uppercase;
    letter-spacing:0.08em;
    padding:2px 6px;
    border-radius:999px;
    border:1px solid var(--grid);
    background:var(--surface-3);
    color:var(--muted);
  }
  .case-summary-stats{
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap:6px;
  }
  .case-summary-stat{
    border:1px dashed var(--grid);
    border-radius:10px;
    padding:6px 8px;
    background:var(--surface);
    display:grid;
    gap:2px;
  }
  .case-summary-stat span{
    font-size:10px;
    text-transform:uppercase;
    letter-spacing:0.08em;
    color:var(--muted);
  }
  .case-summary-stat strong{
    font-size:12px;
  }
  .case-overview-scroll{
    margin-top:8px;
    border:1px dashed var(--grid);
    border-radius:12px;
    background:var(--surface-2);
    max-height:260px;
    overflow:auto;
  }
  .case-overview-details{
    border-top:1px dashed var(--grid);
    padding-top:8px;
  }
  .case-overview-details > summary{
    display:none;
  }
  .case-overview-table{
    width:100%;
    border-collapse:collapse;
    font-size:12px;
  }
  .case-overview-table th,
  .case-overview-table td{
    padding:6px 8px;
    border-bottom:1px dashed var(--grid);
    text-align:left;
    vertical-align:top;
  }
  .case-overview-table th{
    font-size:10px;
    text-transform:uppercase;
    letter-spacing:0.08em;
    color:var(--muted);
    background:var(--surface);
    position:sticky;
    top:0;
    z-index:1;
  }
  .case-overview-table td{
    color:var(--text);
    white-space:normal;
  }
  .case-library,
  .case-list{
    display:flex;
    flex-direction:column;
    gap:8px;
    max-height:260px;
    overflow:auto;
    padding-right:2px;
  }
  .case-item{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:8px 10px;
    border:1px solid var(--grid);
    border-radius:12px;
    background:var(--item-bg);
  }
  .case-info{
    display:flex;
    align-items:center;
    gap:8px;
    min-width:0;
  }
  .case-name{
    font-size:13px;
    font-weight:600;
    color:var(--text);
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .case-meta{
    font-size:11px;
    color:var(--muted);
  }
  .case-actions{
    display:flex;
    gap:6px;
    flex-shrink:0;
  }
  .case-chip{
    font-size:10px;
    text-transform:uppercase;
    letter-spacing:0.08em;
    padding:2px 6px;
    border-radius:999px;
    border:1px solid var(--grid);
    background:var(--surface-3);
    color:var(--muted);
  }
  /* Bloc Note */
  .notes-section{
    position:relative;
  }
  .notes-section > *{
    position:relative;
    z-index:1;
  }
  .notes-section::before{
    content:"";
    position:absolute;
    inset:0;
    background:
      radial-gradient(500px 240px at 15% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
      radial-gradient(420px 240px at 90% 0%, color-mix(in srgb, var(--accent-2) 14%, transparent), transparent 70%);
    opacity:0.6;
    pointer-events:none;
  }
  .notes-hero{
    align-items:flex-end;
  }
  .notes-hero-actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
  }
  .notes-layout{
    display:grid;
    grid-template-columns: minmax(220px, 0.85fr) minmax(0, 2.15fr);
    gap:16px;
    align-items:start;
  }
  .notes-sidebar{
    display:grid;
    gap:12px;
    position:sticky;
    top:20px;
  }
  .notes-filters{
    display:grid;
    gap:8px;
  }
  .filter-btn{
    border:1px solid var(--grid);
    border-radius:12px;
    padding:8px 10px;
    background:var(--surface-2);
    color:var(--text);
    font-size:12px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    cursor:pointer;
  }
  .filter-btn strong{
    font-size:12px;
  }
  .filter-btn.active{
    background:linear-gradient(135deg, var(--accent), #4a84ee);
    color:#fff;
    border-color:transparent;
  }
  .notes-stats{
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap:10px;
    padding:10px;
    border:1px dashed var(--grid);
    border-radius:14px;
    background:var(--surface-2);
  }
  .notes-stats .k{
    font-size:11px;
    color:var(--muted);
  }
  .notes-stats .v{
    font-size:16px;
    font-weight:700;
  }
  .notes-templates{
    display:grid;
    gap:8px;
  }
  .template-card{
    border:1px solid var(--grid);
    border-radius:12px;
    padding:8px 10px;
    background:var(--surface);
    font-size:12px;
    text-align:left;
    cursor:pointer;
    transition:transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
  }
  .template-card:hover{
    background:var(--hover);
    box-shadow:0 8px 16px rgba(15, 23, 42, 0.08);
  }
  .notes-work{
    display:grid;
    gap:12px;
  }
  .notes-toolbar{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    align-items:center;
    justify-content:space-between;
  }
  .notes-search{
    flex:1 1 260px;
    min-width:220px;
  }
  .notes-controls{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    align-items:center;
  }
  .notes-view-toggle{
    display:flex;
    gap:6px;
  }
  .notes-view-btn.active{
    background:linear-gradient(135deg, var(--accent), #4a84ee);
    color:#fff;
    border-color:transparent;
  }
  .notes-split{
    display:grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
    gap:12px;
    align-items:start;
  }
  .notes-list-panel{
    display:flex;
    flex-direction:column;
    gap:10px;
    min-height:0;
  }
  .notes-list-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
  }
  .notes-list-title{
    font-size:16px;
    font-weight:700;
  }
  .notes-list{
    display:grid;
    gap:10px;
    min-height:120px;
  }
  .notes-list[data-view="grid"]{
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  .notes-list[data-view="list"]{
    grid-template-columns: 1fr;
  }
  .note-card{
    text-align:left;
    border:1px solid var(--grid);
    border-radius:14px;
    padding:10px 12px;
    background:var(--surface);
    cursor:pointer;
    display:grid;
    gap:8px;
    position:relative;
    overflow:hidden;
    transition:border-color 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
  }
  .note-card::before{
    content:"";
    position:absolute;
    inset:10px auto 10px 0;
    width:4px;
    border-radius:999px;
    background:var(--note-accent, var(--accent));
    opacity:0.85;
  }
  .note-card:hover{
    transform:translateY(-1px);
    box-shadow:0 10px 18px rgba(15, 23, 42, 0.08);
  }
  .note-card.active{
    border-color:color-mix(in srgb, var(--note-accent, var(--accent)) 70%, var(--grid));
    box-shadow:0 12px 22px rgba(15, 23, 42, 0.12);
  }
  .note-card-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:8px;
  }
  .note-card-title{
    font-size:13px;
    font-weight:700;
  }
  .note-badges{
    display:flex;
    gap:6px;
    flex-wrap:wrap;
  }
  .note-badge{
    font-size:9px;
    text-transform:uppercase;
    letter-spacing:0.1em;
    padding:2px 6px;
    border-radius:999px;
    border:1px solid var(--grid);
    color:var(--muted);
    background:var(--surface-2);
  }
  .note-card-body{
    font-size:11px;
    color:var(--muted);
    line-height:1.4;
    max-height:44px;
    overflow:hidden;
  }
  .note-card-meta{
    display:flex;
    align-items:center;
    justify-content:space-between;
    font-size:10px;
    color:var(--muted);
  }
  .note-tags{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
  }
  .note-tag{
    font-size:10px;
    border-radius:999px;
    padding:2px 6px;
    border:1px solid var(--grid);
    background:var(--surface-2);
    color:var(--muted);
  }
  .notes-empty{
    text-align:center;
    font-size:12px;
    color:var(--muted);
    padding:10px 0;
  }
  .note-editor{
    display:grid;
    gap:12px;
    position:relative;
    min-height:380px;
  }
  .note-editor.is-empty .note-fields,
  .note-editor.is-empty .note-options,
  .note-editor.is-empty .note-body,
  .note-editor.is-empty .note-footer{
    opacity:0.35;
    pointer-events:none;
  }
  .note-editor-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
  }
  .note-editor-actions{
    display:flex;
    gap:6px;
    flex-wrap:wrap;
  }
  .note-fields{
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap:10px;
  }
  .note-options{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    gap:10px;
  }
  .note-toggles{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
  }
  .toggle-pill{
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:6px 10px;
    border-radius:999px;
    border:1px solid var(--grid);
    background:var(--surface-2);
    font-size:11px;
    color:var(--text);
  }
  .note-colors{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    align-items:center;
  }
  .note-color{
    width:22px;
    height:22px;
    border-radius:50%;
    border:2px solid transparent;
    background:var(--note-color, var(--accent));
    cursor:pointer;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  }
  .note-color.active{
    border-color:var(--text);
    box-shadow:0 0 0 2px color-mix(in srgb, var(--note-color, var(--accent)) 50%, transparent);
  }
  .note-body .textarea{
    min-height:220px;
    resize:vertical;
  }
  .note-footer{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    flex-wrap:wrap;
  }
  .note-stats{
    display:flex;
    gap:12px;
    font-size:11px;
    color:var(--muted);
  }
  .note-editor-empty{
    display:none;
    border:1px dashed var(--grid);
    border-radius:14px;
    padding:14px;
    text-align:center;
    background:var(--surface-2);
    gap:6px;
  }
  .note-editor.is-empty .note-editor-empty{
    display:grid;
  }
  .note-editor-empty .empty-title{
    font-weight:700;
  }
  /* Auth & Account */
  .auth-section{
    display:flex;
    justify-content:center;
    padding:24px 0 40px;
  }
  .auth-card{
    width:min(480px, 100%);
    display:grid;
    gap:16px;
  }
  .auth-head h1{
    margin:4px 0 0;
  }
  .auth-form{
    display:grid;
    gap:10px;
  }
  .auth-message{
    min-height:18px;
    font-size:12px;
    color:var(--muted);
  }
  .auth-message.error{
    color:var(--danger-text);
  }
  .auth-message.success{
    color:var(--accent-2);
  }
  .auth-footer{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
  }
  .account-grid{
    display:grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap:12px;
  }
  .account-card{
    display:grid;
    gap:12px;
  }
  .account-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
  }
  .account-form{
    display:grid;
    gap:10px;
  }
  .dashboard-intro{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin:18px 0 8px;
  }
  .treatment-grid{ margin-top:12px; }
  .addiction-grid .span-6{ grid-column: span 6; }
  .track-panel{
    display:grid;
    gap:12px;
  }
  .track-header{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
  }
  .track-header h3{
    margin:0 0 4px;
    font-size:18px;
    text-transform:none;
    letter-spacing:0;
    color:var(--text);
  }
  .track-label{
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:0.16em;
    color:var(--muted);
  }
  .track-sub{
    margin:4px 0 0;
    font-size:12px;
    color:var(--muted);
  }
  .track-block{
    border:1px solid var(--grid);
    border-radius:16px;
    padding:12px;
    background:var(--surface-2);
    display:grid;
    gap:10px;
  }
  .track-block-title{
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:0.12em;
    color:var(--muted);
  }
  .track-block-title .progress-example{
    text-transform:none;
    letter-spacing:0.02em;
    color:var(--text);
    font-weight:700;
  }
  .track-block .panel-sub{
    margin:0;
  }
  .summary.compact{
    margin-top:8px;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .momentum-row{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    flex-wrap:wrap;
    gap:6px 12px;
  }
  .prescription-grid{
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap:10px;
  }
  .prescription-item{
    border:1px solid var(--grid);
    border-radius:14px;
    padding:10px;
    background:var(--surface);
    display:grid;
    gap:6px;
  }
  .prescription-label{
    font-size:10px;
    text-transform:uppercase;
    letter-spacing:0.12em;
    color:var(--muted);
  }
  .prescription-value{
    font-weight:700;
    font-size:13px;
  }
  .prescription-note{
    font-size:11px;
    color:var(--muted);
  }
  .habit-tags{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
  }
  .habit-tags .tag{
    cursor:default;
  }
  @media (max-width: 980px){
    .path-choice{ grid-template-columns: 1fr; }
    .addiction-grid .span-6{ grid-column: span 6; }
    .prescription-grid{ grid-template-columns: 1fr; }
    .example-tabs{ grid-template-columns: 1fr; }
  }
  @media (max-width: 620px){
    .dashboard-intro{ flex-direction:column; align-items:flex-start; }
    .path-actions{ width:100%; }
    .path-actions .btn{ flex:1 1 auto; }
    .summary.compact{ grid-template-columns: 1fr; }
    .addiction-grid .span-6{ grid-column: 1 / -1; }
    .example-cards{
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
  }
  @media (max-width: 980px){
    .notes-layout{
      grid-template-columns: 1fr;
    }
    .notes-sidebar{
      position:static;
    }
    .notes-split{
      grid-template-columns: 1fr;
    }
    .note-fields{
      grid-template-columns: 1fr;
    }
    .account-grid{
      grid-template-columns: 1fr;
    }
  }
  @media (max-width: 620px){
    .notes-toolbar{
      flex-direction:column;
      align-items:stretch;
    }
    .notes-controls{
      width:100%;
      justify-content:space-between;
    }
    .notes-view-toggle{
      width:100%;
    }
    .notes-view-btn{
      flex:1 1 0;
    }
    .notes-hero-actions{
      width:100%;
    }
    .notes-hero-actions .btn{
      flex:1 1 auto;
    }
  }

.controls-shell{
  margin:8px 0 18px;
  border:1px solid var(--grid);
  border-radius:24px;
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 86%, var(--surface) 14%), var(--surface));
  box-shadow:var(--shadow);
  overflow:hidden;
}
.controls-shell > summary{
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:18px 20px;
  cursor:pointer;
}
.controls-shell > summary::-webkit-details-marker{
  display:none;
}
.controls-shell > summary::after{
  content:"+";
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--grid) 80%, var(--surface) 20%);
  background:var(--surface);
  color:var(--text);
  font-size:22px;
  line-height:1;
  flex:0 0 auto;
}
.controls-shell[open] > summary{
  border-bottom:1px solid color-mix(in srgb, var(--grid) 82%, var(--surface) 18%);
  background:color-mix(in srgb, var(--surface-2) 92%, var(--surface) 8%);
}
.controls-shell[open] > summary::after{
  content:"-";
}
.controls-summary-copy{
  display:grid;
  gap:4px;
}
.controls-summary-title{
  font-size:18px;
  font-weight:700;
  color:var(--text);
}
.controls-summary-side{
  display:flex;
  align-items:center;
  gap:12px;
}
.controls-summary-badge{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  background:var(--surface);
  border:1px solid color-mix(in srgb, var(--today-accent) 26%, var(--grid));
  color:var(--today-accent);
  font-size:11px;
  font-weight:700;
  letter-spacing:0.14em;
  text-transform:uppercase;
}
.controls-shell .toolbar{
  margin:0;
  padding:18px 20px 20px;
  border:0;
  border-radius:0;
  box-shadow:none;
  background:transparent;
}
.controls-shell .toolbar-group.actions{
  align-self:flex-end;
}
.range-buttons > .range-btn[data-preset="today"]{
  min-width:88px;
}
.table-wrap.today-view{
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
  overflow:visible;
}
.habit-today-wrap{
  display:grid;
  gap:16px;
}
.habit-today-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
  padding:18px 20px;
  border:1px solid var(--grid);
  border-radius:24px;
  background:linear-gradient(135deg, color-mix(in srgb, var(--today) 70%, var(--surface) 30%), var(--surface));
  box-shadow:var(--shadow);
}
.habit-today-heading{
  margin:4px 0 0;
  font-size:22px;
  line-height:1.1;
  color:var(--text);
}
.habit-today-select{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 14px;
  border-radius:999px;
  background:var(--surface);
  border:1px solid color-mix(in srgb, var(--grid) 78%, var(--surface) 22%);
}
.habit-today-select-copy{
  font-size:11px;
  font-weight:700;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--muted);
}
.habit-today-select input{
  margin:0;
}
.habit-today-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(260px, 1fr));
  gap:14px;
}
.habit-today-card{
  display:grid;
  gap:16px;
  padding:18px;
  border:1px solid color-mix(in srgb, var(--grid) 78%, var(--surface) 22%);
  border-radius:24px;
  background:linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface-2) 78%, var(--surface) 22%));
  box-shadow:var(--shadow);
  cursor:pointer;
  transition:transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.habit-today-card:hover{
  transform:translateY(-2px);
  box-shadow:0 18px 34px rgba(15, 23, 42, 0.08);
}
.habit-today-card.is-checked{
  border-color:color-mix(in srgb, var(--today-accent) 55%, var(--grid));
  background:linear-gradient(180deg, color-mix(in srgb, var(--today) 78%, var(--surface) 22%), color-mix(in srgb, var(--surface) 82%, var(--today) 18%));
}
.habit-today-card.is-locked{
  opacity:0.72;
  cursor:not-allowed;
}
.habit-today-main{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:14px;
  align-items:start;
}
.habit-today-body{
  display:grid;
  gap:12px;
  min-width:0;
}
.habit-today-title-row{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
}
.habit-today-name{
  font-size:18px;
  font-weight:700;
  color:var(--text);
}
.habit-today-category{
  padding:5px 10px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  background:var(--surface-2);
  font-size:11px;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:var(--muted);
}
.habit-today-meta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.habit-today-meta span{
  padding:7px 10px;
  border-radius:12px;
  background:var(--surface-2);
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  font-size:12px;
  color:var(--muted);
}
.habit-today-check-wrap{
  display:grid;
  justify-items:center;
  gap:8px;
}
.habit-today-check-text{
  font-size:11px;
  font-weight:700;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--muted);
}
.habit-today-card.is-checked .habit-today-check-text{
  color:var(--today-accent);
}
.habit-today-checkbox{
  appearance:none;
  width:30px;
  height:30px;
  margin:0;
  border-radius:10px;
  border:2px solid color-mix(in srgb, var(--today-check) 55%, var(--grid));
  background:linear-gradient(180deg, color-mix(in srgb, var(--today-check) 10%, var(--surface-2)), var(--surface-2));
  position:relative;
  cursor:pointer;
  outline:2px solid color-mix(in srgb, var(--today-check) 35%, transparent);
  outline-offset:2px;
  transition:transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.habit-today-checkbox::after{
  content:"";
  position:absolute;
  left:9px;
  top:5px;
  width:7px;
  height:13px;
  border-right:3px solid transparent;
  border-bottom:3px solid transparent;
  transform:rotate(45deg) scale(0.7);
  opacity:0;
  transition:opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.habit-today-checkbox:hover{
  box-shadow:0 0 0 2px var(--today-check-glow), 0 8px 16px rgba(239, 68, 68, 0.15);
  transform:translateY(-1px);
}
.habit-today-checkbox:checked{
  border-color:var(--today-accent);
  background:linear-gradient(135deg, color-mix(in srgb, var(--today-accent) 75%, #3dd68c), var(--today-accent));
  box-shadow:0 0 0 3px color-mix(in srgb, var(--today-accent) 45%, transparent), 0 10px 18px rgba(34, 197, 94, 0.22);
}
.habit-today-checkbox:checked::after{
  opacity:1;
  border-color:#fff;
  transform:rotate(45deg) scale(1);
}
.habit-today-checkbox:disabled{
  opacity:0.7;
  cursor:not-allowed;
}
.habit-today-footer{
  padding-top:2px;
  border-top:1px solid color-mix(in srgb, var(--grid) 75%, var(--surface) 25%);
  font-size:12px;
  color:var(--muted);
}

.habit-dashboard{
  margin-top:24px;
  display:grid;
  gap:18px;
}
.habit-dashboard-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:18px;
}
.habit-dashboard-head h2{
  margin:4px 0 0;
  font-size:28px;
  line-height:1.05;
}
.habit-dashboard-badge,
.summary-hero-pill,
.summary-stat-chip{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  background:var(--surface-2);
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  font-size:11px;
  font-weight:700;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--accent-2);
}
.summary-grid{
  display:grid;
  grid-template-columns:repeat(12, minmax(0, 1fr));
  gap:14px;
}
.summary-card{
  display:grid;
  gap:14px;
  padding:18px;
  border-radius:22px;
}
.summary-card-hero{
  grid-column:span 6;
  background:linear-gradient(140deg, color-mix(in srgb, var(--today) 62%, var(--surface) 38%), var(--surface));
}
.summary-card-spotlight,
.summary-card-list{
  grid-column:span 6;
}
.summary-grid > .summary-card:not(.summary-card-hero):not(.summary-card-spotlight):not(.summary-card-list){
  grid-column:span 3;
}
.summary-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.summary-mini-grid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:10px;
}
.summary-mini-card,
.summary-split > div,
.summary-duo-block,
.habit-leaderboard-item,
.habit-insight-item{
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  background:var(--surface-2);
  border-radius:16px;
}
.summary-mini-card{
  display:grid;
  gap:6px;
  padding:12px;
}
.summary-mini-card span,
.summary-split span,
.summary-duo-block span{
  font-size:11px;
  color:var(--muted);
  letter-spacing:0.12em;
  text-transform:uppercase;
}
.summary-mini-card strong{
  font-size:20px;
  color:var(--text);
}
.summary-split,
.summary-duo{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}
.summary-split > div,
.summary-duo-block{
  display:grid;
  gap:8px;
  padding:14px;
}
.summary-split strong,
.summary-duo-block strong{
  font-size:24px;
  line-height:1;
  color:var(--text);
}
.summary-note{
  font-size:13px;
  line-height:1.5;
  color:var(--muted);
}
.summary-empty{
  padding:14px;
  border-radius:16px;
  border:1px dashed color-mix(in srgb, var(--grid) 82%, var(--surface) 18%);
  background:var(--surface-2);
  color:var(--muted);
}
.habit-leaderboard,
.habit-insight-list{
  display:grid;
  gap:10px;
}
.habit-leaderboard-item,
.habit-insight-item{
  padding:14px;
}
.habit-leaderboard-item{
  display:grid;
  gap:10px;
}
.habit-leaderboard-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.habit-leaderboard-name{
  font-weight:700;
  color:var(--text);
}
.habit-leaderboard-meta{
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
}
.habit-leaderboard-rate{
  font-size:20px;
  font-weight:700;
  color:var(--today-accent);
  white-space:nowrap;
}
.habit-leaderboard-bar{
  height:8px;
  border-radius:999px;
  background:var(--surface-3);
  overflow:hidden;
}
.habit-leaderboard-bar span{
  display:block;
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg, var(--today-accent), var(--accent));
}
.habit-insight-item{
  display:grid;
  gap:6px;
}
.habit-insight-item strong{
  font-size:11px;
  font-weight:700;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--muted);
}
.habit-insight-item span{
  font-size:14px;
  line-height:1.5;
  color:var(--text);
}
.page-note{
  display:flex;
  justify-content:flex-end;
  margin-top:18px;
}
.page-note-chip{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  background:color-mix(in srgb, var(--surface-2) 88%, transparent);
  border:1px solid color-mix(in srgb, var(--grid) 78%, var(--surface) 22%);
  font-size:10px;
  letter-spacing:0.16em;
  text-transform:uppercase;
  color:var(--muted);
}
@media (max-width: 980px){
  .controls-shell > summary,
  .habit-dashboard-head{
    align-items:flex-start;
  }
  .summary-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  .summary-card-hero,
  .summary-card-spotlight,
  .summary-card-list{
    grid-column:span 2;
  }
  .summary-grid > .summary-card:not(.summary-card-hero):not(.summary-card-spotlight):not(.summary-card-list){
    grid-column:span 1;
  }
}
@media (max-width: 720px){
  .controls-shell > summary,
  .habit-today-head,
  .habit-dashboard-head,
  .habit-leaderboard-top{
    flex-direction:column;
    align-items:flex-start;
  }
  .controls-summary-side,
  .page-note{
    width:100%;
    justify-content:flex-start;
  }
  .summary-grid,
  .summary-mini-grid,
  .summary-split,
  .summary-duo,
  .habit-today-grid{
    grid-template-columns:1fr;
  }
  .summary-card-hero,
  .summary-card-spotlight,
  .summary-card-list,
  .summary-grid > .summary-card:not(.summary-card-hero):not(.summary-card-spotlight):not(.summary-card-list){
    grid-column:span 1;
  }
  .habit-today-main{
    grid-template-columns:auto 1fr;
  }
  .habit-today-check-wrap{
    grid-column:1 / -1;
    justify-items:flex-start;
  }
  .controls-shell .toolbar{
    padding:16px;
  }
}
.habit-dashboard{
  grid-template-columns:1fr;
}
.summary-card-hero .v{
  font-size:34px;
}

/* Habit Tracker polish overrides */
.controls-shell{
  margin:12px 0 18px;
  border:0;
  background:transparent;
  box-shadow:none;
  overflow:visible;
}
.controls-shell > summary{
  display:inline-flex;
  align-items:center;
  gap:0;
  padding:0;
}
.controls-shell > summary::after{
  content:none;
}
.controls-shell[open] > summary{
  margin-bottom:14px;
  border:0;
  background:transparent;
}
.controls-toggle-pill{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:12px 16px;
  border-radius:18px;
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  background:linear-gradient(135deg, color-mix(in srgb, var(--surface-2) 84%, var(--surface) 16%), var(--surface));
  box-shadow:0 12px 24px rgba(15, 23, 42, 0.08);
  transition:transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  overflow:hidden;
}
.controls-toggle-pill::before{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(120deg, transparent 20%, color-mix(in srgb, var(--today-accent) 12%, transparent), transparent 78%);
  opacity:0.7;
  pointer-events:none;
}
.controls-toggle-pill:hover{
  transform:translateY(-2px);
  border-color:color-mix(in srgb, var(--today-accent) 42%, var(--grid));
  box-shadow:0 18px 30px rgba(15, 23, 42, 0.12);
}
.controls-shell[open] .controls-toggle-pill{
  background:linear-gradient(135deg, color-mix(in srgb, var(--today) 66%, var(--surface) 34%), var(--surface));
  border-color:color-mix(in srgb, var(--today-accent) 46%, var(--grid));
}
.controls-toggle-icon{
  position:relative;
  width:22px;
  height:22px;
  border-radius:10px;
  background:linear-gradient(135deg, color-mix(in srgb, var(--today-accent) 18%, var(--surface)), var(--surface-2));
  border:1px solid color-mix(in srgb, var(--today-accent) 34%, var(--grid));
  flex:0 0 auto;
  transition:transform 0.22s ease;
}
.controls-toggle-icon::before,
.controls-toggle-icon::after{
  content:"";
  position:absolute;
  left:5px;
  right:5px;
  height:2px;
  border-radius:999px;
  background:var(--today-accent);
}
.controls-toggle-icon::before{
  top:7px;
  box-shadow:0 6px 0 var(--today-accent);
}
.controls-toggle-icon::after{
  top:10px;
  left:8px;
  right:8px;
}
.controls-shell[open] .controls-toggle-icon{
  transform:rotate(90deg);
}
.controls-toggle-text{
  position:relative;
  z-index:1;
  font-size:11px;
  font-weight:700;
  letter-spacing:0.16em;
  text-transform:uppercase;
  color:var(--text);
}
.controls-shell .toolbar{
  position:relative;
  margin-top:0;
  padding:20px 22px 22px;
  border:1px solid color-mix(in srgb, var(--grid) 74%, var(--surface) 26%);
  border-radius:26px;
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 88%, var(--surface) 12%), var(--surface));
  box-shadow:0 24px 50px rgba(15, 23, 42, 0.1);
  overflow:hidden;
}
.controls-shell .toolbar::before{
  content:"";
  position:absolute;
  inset:0 0 auto;
  height:120px;
 background: radial-gradient(circle at top left, 
color-mix(in srgb, rgba
#5cc3bb61
(92, 195, 187, 0.38) 70%, transparent), rgb(92 195 187 / 27%) 111%);
 pointer-events:none;
}
.controls-shell .toolbar > *{
  position:relative;
  z-index:1;
}
.range-buttons{
  gap:8px;
  padding:8px;
  border-radius:18px;
  background:color-mix(in srgb, var(--surface-2) 84%, var(--surface) 16%);
}
.range-group{
  border-radius:14px;
  padding:5px;
}
.range-btn{
  border-radius:12px;
}
.range-btn[data-preset="today"]{
  min-width:104px;
  background:linear-gradient(135deg, color-mix(in srgb, var(--today) 72%, var(--surface) 28%), var(--surface));
  border-color:color-mix(in srgb, var(--today-accent) 38%, var(--grid));
  color:var(--today-accent);
}
.range-btn[data-preset="today"].active{
  background:linear-gradient(135deg, var(--today-accent), color-mix(in srgb, var(--accent) 78%, #ffffff 22%));
  color:#fff;
}
.table-wrap.today-view{
  position:relative;
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
  overflow:visible;
}
.habit-today-wrap{
  position:relative;
  display:grid;
  gap:18px;
  padding:6px 0 10px;
}
.habit-today-wrap::before{
  content:"";
  position:absolute;
  inset:10px 0 auto;
  height:240px;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--today-accent) 18%, transparent), transparent 48%),
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 14%, transparent), transparent 44%);
  filter:blur(20px);
  opacity:0.9;
  pointer-events:none;
}
.habit-today-head,
.habit-today-grid{
  position:relative;
  z-index:1;
}
.habit-today-head{
  align-items:center;
  padding:26px 28px;
  border:1px solid color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  border-radius:30px;
  background:linear-gradient(135deg, color-mix(in srgb, var(--today) 72%, var(--surface) 28%), color-mix(in srgb, var(--surface) 90%, var(--surface-2) 10%));
  box-shadow:0 28px 60px rgba(15, 23, 42, 0.12);
  overflow:hidden;
}
.habit-today-head::after{
  content:"";
  position:absolute;
  inset:auto -50px -70px auto;
  width:220px;
  height:220px;
  border-radius:50%;
  background:radial-gradient(circle, color-mix(in srgb, var(--today-accent) 16%, transparent), transparent 66%);
  pointer-events:none;
}
.habit-today-heading{
  font-size:28px;
  letter-spacing:-0.02em;
}
.habit-today-head .sub{
  max-width:560px;
}
.habit-today-select{
  padding:12px 16px;
  border-radius:18px;
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow:inset 0 1px 0 color-mix(in srgb, #fff 26%, transparent);
}
.habit-today-grid{
  grid-template-columns:repeat(auto-fit, minmax(280px, 1fr));
  gap:16px;
}
.habit-today-card{
  position:relative;
  min-height:216px;
  padding:20px;
  border-radius:28px;
  border:1px solid color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 95%, transparent), color-mix(in srgb, var(--surface-2) 80%, var(--surface) 20%));
  box-shadow:0 20px 40px rgba(15, 23, 42, 0.08);
  overflow:hidden;
}
.habit-today-card::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--today-accent) 14%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 0%, transparent), transparent 62%);
  opacity:0.95;
  pointer-events:none;
}
.habit-today-card > *{
  position:relative;
  z-index:1;
}
.habit-today-card:hover{
  transform:translateY(-4px) scale(1.01);
  box-shadow:0 28px 52px rgba(15, 23, 42, 0.13);
}
.habit-today-card.is-checked{
  border-color:color-mix(in srgb, var(--today-accent) 55%, var(--grid));
  background:linear-gradient(180deg, color-mix(in srgb, var(--today) 82%, var(--surface) 18%), color-mix(in srgb, var(--surface) 75%, var(--today) 25%));
  box-shadow:0 26px 50px rgba(34, 197, 94, 0.16);
}
.habit-today-main{
  grid-template-columns:auto 1fr auto;
  gap:16px;
}
.habit-today-name{
  font-size:20px;
  letter-spacing:-0.02em;
}
.habit-today-category{
  padding:6px 11px;
  background:color-mix(in srgb, var(--surface) 88%, transparent);
}
.habit-today-meta span{
  padding:8px 11px;
  border-radius:14px;
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter:blur(6px);
}
.habit-today-check-wrap{
  align-content:start;
  justify-items:end;
  gap:10px;
  padding:10px 12px;
  border-radius:18px;
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
}
.habit-today-footer{
  padding-top:10px;
  font-size:12px;
}
.habit-dashboard{
  position:relative;
  gap:22px;
}
.habit-dashboard::before{
  content:"";
  position:absolute;
  inset:14px 0 auto;
  height:260px;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--today-accent) 14%, transparent), transparent 50%),
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 12%, transparent), transparent 46%);
  filter:blur(26px);
  opacity:0.85;
  pointer-events:none;
}
.habit-dashboard-head,
.summary-grid{
  position:relative;
  z-index:1;
}
.habit-dashboard-head{
  align-items:center;
  padding:22px 24px;
  border-radius:28px;
  border:1px solid color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  background:linear-gradient(135deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 82%, var(--surface) 18%));
  box-shadow:0 24px 50px rgba(15, 23, 42, 0.1);
}
.habit-dashboard-copy{
  display:grid;
  gap:6px;
  max-width:760px;
}
.habit-dashboard-head h2{
  font-size:30px;
  letter-spacing:-0.03em;
}
.habit-dashboard-badge,
.summary-hero-pill,
.summary-stat-chip{
  padding:9px 13px;
  border-radius:16px;
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  border:1px solid color-mix(in srgb, var(--grid) 74%, var(--surface) 26%);
  color:var(--today-accent);
  box-shadow:inset 0 1px 0 color-mix(in srgb, #fff 20%, transparent);
}
.summary-grid{
  gap:16px;
}
.summary-card{
  position:relative;
  min-height:100%;
  padding:20px;
  border:1px solid color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  border-radius:26px;
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 82%, var(--surface) 18%));
  box-shadow:0 18px 42px rgba(15, 23, 42, 0.09);
  overflow:hidden;
}
.summary-card::before{
  content:"";
  position:absolute;
  left:-48px;
  top:-54px;
  width:180px;
  height:180px;
  border-radius:50%;
  background:radial-gradient(circle, color-mix(in srgb, var(--today-accent) 12%, transparent), transparent 68%);
  pointer-events:none;
}
.summary-card > *{
  position:relative;
  z-index:1;
}
.summary-card-hero{
  grid-column:span 7;
  background:linear-gradient(135deg, color-mix(in srgb, var(--today) 76%, var(--surface) 24%), color-mix(in srgb, var(--surface) 84%, var(--today) 16%));
}
.summary-card-focus{
  grid-column:span 5;
}
.summary-card-spotlight,
.summary-card-list{
  grid-column:span 6;
}
.summary-card-head{
  align-items:center;
}
.summary-title-wrap{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}
.summary-title-wrap-hero{
  gap:14px;
}
.summary-title-text{
  display:grid;
  gap:4px;
}
.summary-title-text .k{
  margin:0;
}
.summary-icon{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  border-radius:15px;
  border:1px solid color-mix(in srgb, var(--today-accent) 30%, var(--grid));
  background:linear-gradient(135deg, color-mix(in srgb, var(--today-accent) 16%, var(--surface)), color-mix(in srgb, var(--surface) 96%, transparent));
  color:var(--today-accent);
  font-size:18px;
  box-shadow:0 10px 20px rgba(15, 23, 42, 0.08);
}
.summary-card-hero .summary-icon{
  width:52px;
  height:52px;
  border-radius:18px;
  font-size:22px;
}
.summary-card-hero .v{
  font-size:42px;
  line-height:0.95;
}
.summary-mini-grid{
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}
.summary-mini-card,
.summary-split > div,
.summary-duo-block,
.habit-leaderboard-item,
.habit-insight-item{
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  border:1px solid color-mix(in srgb, var(--grid) 74%, var(--surface) 26%);
  box-shadow:inset 0 1px 0 color-mix(in srgb, #fff 18%, transparent);
}
.summary-mini-label{
  display:flex;
  align-items:center;
  gap:8px;
}
.summary-mini-icon{
  width:22px;
  height:22px;
  display:grid;
  place-items:center;
  border-radius:10px;
  background:color-mix(in srgb, var(--today-accent) 14%, var(--surface));
  color:var(--today-accent);
  font-size:12px;
}
.summary-split strong,
.summary-duo-block strong{
  font-size:28px;
}
.summary-note{
  font-size:13px;
  line-height:1.55;
}
.habit-leaderboard-item,
.habit-insight-item{
  padding:16px;
  border-radius:18px;
}
.habit-leaderboard-rate{
  font-size:22px;
}
.page-note{
  margin-top:12px;
}
.page-note-chip{
  gap:8px;
  padding:6px 12px;
  border-radius:999px;
  background:linear-gradient(135deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface-2) 84%, var(--surface) 16%));
  transition:transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.page-note-chip:hover{
  transform:translateY(-1px);
  border-color:color-mix(in srgb, var(--today-accent) 42%, var(--grid));
  box-shadow:0 10px 18px rgba(15, 23, 42, 0.08);
}
.page-note-dot{
  width:7px;
  height:7px;
  border-radius:999px;
  background:var(--today-accent);
  box-shadow:0 0 0 0 color-mix(in srgb, var(--today-accent) 38%, transparent);
  animation:pageNotePulse 2.6s ease-in-out infinite;
}
@keyframes pageNotePulse{
  0%, 100%{ box-shadow:0 0 0 0 color-mix(in srgb, var(--today-accent) 32%, transparent); opacity:0.9; }
  50%{ box-shadow:0 0 0 6px color-mix(in srgb, var(--today-accent) 0%, transparent); opacity:1; }
}
@media (max-width: 980px){
  .summary-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  .summary-card-hero,
  .summary-card-focus,
  .summary-card-spotlight,
  .summary-card-list{
    grid-column:span 2;
  }
}
@media (max-width: 720px){
  .controls-shell > summary,
  .habit-today-head,
  .habit-dashboard-head,
  .habit-leaderboard-top{
    flex-direction:column;
    align-items:flex-start;
  }
  .controls-shell[open] > summary{
    margin-bottom:12px;
  }
  .summary-grid,
  .summary-mini-grid,
  .summary-split,
  .summary-duo,
  .habit-today-grid{
    grid-template-columns:1fr;
  }
  .summary-card-hero,
  .summary-card-focus,
  .summary-card-spotlight,
  .summary-card-list{
    grid-column:span 1;
  }
  .habit-today-head,
  .habit-dashboard-head,
  .controls-shell .toolbar{
    padding:18px;
  }
}

/* Habit tracker fixes */
.controls-shell{
  display:block;
}
.controls-shell > summary.controls-summary{
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  padding:0;
  list-style:none;
  cursor:pointer;
}
.controls-shell > summary.controls-summary::marker,
.controls-shell > summary.controls-summary::-webkit-details-marker{
  display:none;
  content:"";
}
.controls-toggle-pill{
  min-height:46px;
}
.controls-shell .toolbar{
  margin-top:12px;
}

.habit-dashboard{
  display:block;
  margin-top:26px;
}
.habit-dashboard-head{
  margin-bottom:16px;
}
.summary-grid{
  display:grid;
  grid-template-columns:repeat(12, minmax(0, 1fr));
  gap:16px;
}
.summary-card-hero{
  grid-column:span 6;
}
.summary-card-focus{
  grid-column:span 3;
}
.summary-card-spotlight,
.summary-card-list{
  grid-column:span 6;
}
.summary-card{
  align-content:start;
}
.summary-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
}
.summary-title-text{
  min-width:0;
}
.summary-note strong{
  color:var(--text);
}

.table-wrap.today-view{
  margin-top:10px;
}
.habit-today-stage{
  position:relative;
  display:grid;
  gap:18px;
}
.habit-today-date-panel{
  position:relative;
  display:grid;
  gap:12px;
  padding:26px 28px;
  border-radius:32px;
  border:1px solid color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--today-accent) 14%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--today) 72%, var(--surface) 28%), color-mix(in srgb, var(--surface) 90%, var(--surface-2) 10%));
  box-shadow:0 28px 60px rgba(15, 23, 42, 0.12);
  overflow:hidden;
}
.habit-today-date-label{
  font-size:11px;
  font-weight:700;
  letter-spacing:0.2em;
  text-transform:uppercase;
  color:var(--today-accent);
}
.habit-today-date-main{
  display:flex;
  align-items:flex-end;
  gap:16px;
}
.habit-today-date-number{
  font-size:72px;
  line-height:0.9;
  font-weight:800;
  letter-spacing:-0.06em;
  color:var(--text);
}
.habit-today-date-copy{
  display:grid;
  gap:4px;
  padding-bottom:8px;
}
.habit-today-date-day{
  font-size:28px;
  line-height:1;
  font-weight:700;
  letter-spacing:-0.03em;
  color:var(--text);
}
.habit-today-date-full{
  font-size:14px;
  color:var(--muted);
}
.habit-today-grid{
  grid-template-columns:repeat(auto-fit, minmax(280px, 1fr));
  gap:16px;
}
.habit-today-card{
  position:relative;
  display:grid;
  gap:16px;
  min-height:240px;
  padding:20px;
  border-radius:28px;
  border:1px solid color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--today-accent) 10%, transparent), transparent 30%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 82%, var(--surface) 18%));
  box-shadow:0 20px 40px rgba(15, 23, 42, 0.08);
  overflow:hidden;
}
.habit-today-card:hover{
  transform:translateY(-4px);
  box-shadow:0 30px 56px rgba(15, 23, 42, 0.14);
}
.habit-today-card.is-checked{
  border-color:color-mix(in srgb, var(--today-accent) 58%, var(--grid));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--today-accent) 16%, transparent), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--today) 82%, var(--surface) 18%), color-mix(in srgb, var(--surface) 76%, var(--today) 24%));
}
.habit-today-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.habit-today-category,
.habit-today-state{
  display:inline-flex;
  align-items:center;
  min-height:34px;
  padding:7px 12px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  font-size:11px;
  font-weight:700;
  letter-spacing:0.12em;
  text-transform:uppercase;
}
.habit-today-category{
  color:var(--muted);
}
.habit-today-state{
  color:var(--today-accent);
}
.habit-today-body{
  display:grid;
  gap:14px;
  align-content:start;
}
.habit-today-icon{
  width:54px;
  height:54px;
  display:grid;
  place-items:center;
  font-size:24px;
  border-radius:18px;
  background:color-mix(in srgb, var(--surface) 90%, transparent);
  border:1px solid color-mix(in srgb, var(--grid) 74%, var(--surface) 26%);
  box-shadow:0 12px 20px rgba(15, 23, 42, 0.06);
}
.habit-today-name{
  font-size:22px;
  line-height:1.05;
  font-weight:750;
  letter-spacing:-0.03em;
  color:var(--text);
}
.habit-today-streak{
  font-size:14px;
  font-weight:600;
  color:var(--today-accent);
}
.habit-today-meta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.habit-today-meta span{
  padding:8px 10px;
  border-radius:14px;
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  border:1px solid color-mix(in srgb, var(--grid) 74%, var(--surface) 26%);
  font-size:12px;
  color:var(--muted);
}
.habit-today-check-wrap{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border-radius:18px;
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  border:1px solid color-mix(in srgb, var(--grid) 74%, var(--surface) 26%);
}
.habit-today-switch{
  position:relative;
  width:58px;
  height:32px;
  flex:0 0 auto;
  border-radius:999px;
  background:color-mix(in srgb, var(--surface-3) 88%, var(--surface) 12%);
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  transition:background 0.2s ease, border-color 0.2s ease;
}
.habit-today-switch-dot{
  position:absolute;
  top:3px;
  left:4px;
  width:24px;
  height:24px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 8px 16px rgba(15, 23, 42, 0.18);
  transition:transform 0.2s ease;
}
.habit-today-card.is-checked .habit-today-switch{
  background:linear-gradient(135deg, var(--today-accent), color-mix(in srgb, var(--accent) 76%, #ffffff 24%));
  border-color:transparent;
}
.habit-today-card.is-checked .habit-today-switch-dot{
  transform:translateX(25px);
}
.habit-today-checkbox{
  position:absolute;
  opacity:0;
  pointer-events:none;
  width:1px;
  height:1px;
}
.habit-today-footer{
  margin-top:auto;
  padding-top:4px;
  font-size:12px;
  color:var(--muted);
}

@media (max-width: 980px){
  .summary-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  .summary-card-hero,
  .summary-card-focus,
  .summary-card-spotlight,
  .summary-card-list{
    grid-column:span 2;
  }
}
@media (max-width: 720px){
  .habit-today-date-main{
    align-items:flex-start;
    flex-direction:column;
    gap:10px;
  }
  .habit-today-date-copy{
    padding-bottom:0;
  }
  .summary-grid{
    grid-template-columns:1fr;
  }
  .summary-card-hero,
  .summary-card-focus,
  .summary-card-spotlight,
  .summary-card-list{
    grid-column:span 1;
  }
  .habit-today-top,
  .habit-today-check-wrap{
    flex-direction:column;
    align-items:flex-start;
  }
}

/* Today focus view */
.table-wrap.today-view{
  position:relative;
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
  overflow:visible;
}
.today-focus-view{
  display:grid;
  gap:20px;
  padding:8px 0 2px;
}
.today-focus-date-card{
  position:relative;
  display:grid;
  gap:14px;
  padding:28px 30px;
  --today-focus-ghost-size:clamp(84px, 18vw, 185px);
  --today-focus-ghost-eyebrow-size:clamp(78px, 16vw, 170px);
  --today-focus-ghost-top:clamp(-56px, calc(var(--today-focus-ghost-size) * -0.5), -42px);
  --today-focus-ghost-eyebrow-top:clamp(0, calc(var(--today-focus-ghost-eyebrow-size) * -0.24), -544px);
  --today-focus-ghost-opacity:0.1;
  --today-focus-ghost-eyebrow-left:0;
  --today-focus-ghost-month-right:clamp(4px, 1.2vw, 10px);
  --today-focus-ghost-number-left:min(350px, 50%);
  border-radius:34px;
  border:1px solid color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--today-accent) 18%, transparent), transparent 32%),
    radial-gradient(circle at bottom left, color-mix(in srgb, var(--accent) 12%, transparent), transparent 38%),
    linear-gradient(135deg, color-mix(in srgb, var(--today) 76%, var(--surface) 24%), color-mix(in srgb, var(--surface) 88%, var(--surface-2) 12%));
  box-shadow:0 26px 56px rgba(15, 23, 42, 0.14);
  overflow:hidden;
  isolation:isolate;
}
.today-focus-date-card::after{
  content:"";
  position:absolute;
  inset:auto -54px -76px auto;
  width:220px;
  height:220px;
  border-radius:50%;
  background:radial-gradient(circle, color-mix(in srgb, var(--today-accent) 18%, transparent), transparent 66%);
  pointer-events:none;
}
.today-focus-date-eyebrow,
.today-focus-date-main{
  position:relative;
  z-index:1;
}
.today-focus-date-eyebrow{
  font-size:12px;
  font-weight:800;
  letter-spacing:0.24em;
  text-transform:uppercase;
  color:var(--today-accent);
}
.today-focus-date-main{
  display:flex;
  align-items:flex-end;
  gap:18px;
}


.today-focus-date-eyebrow-left{
  position:absolute;
  left:var(--today-focus-ghost-eyebrow-left);
  top:var(--today-focus-ghost-eyebrow-top);
  z-index:0;
  font-family:"Sora", "Space Grotesk", "Segoe UI", "Trebuchet MS", sans-serif;
  font-size:var(--today-focus-ghost-eyebrow-size);
  font-weight:600;
  line-height:0.82;
  letter-spacing:-0.04em;
  color:var(--text);
  opacity:var(--today-focus-ghost-opacity);
  text-transform:uppercase;
  pointer-events:none;
  user-select:none;
  white-space:nowrap;
}
.today-focus-date-month-right{
  position:absolute;
  right:var(--today-focus-ghost-month-right);
  top:var(--today-focus-ghost-top);
  z-index:0;
  font-family:"Sora", "Space Grotesk", "Segoe UI", "Trebuchet MS", sans-serif;
  font-size:var(--today-focus-ghost-size);
  font-weight:600;
  line-height:0.82;
  letter-spacing:-0.04em;
  color:var(--text);
  text-transform:uppercase;
  opacity:var(--today-focus-ghost-opacity);
  pointer-events:none;
  user-select:none;
  white-space:nowrap;
}
.today-focus-date-number-left{ 
  position:absolute;
  left:var(--today-focus-ghost-number-left);
  top:var(--today-focus-ghost-top);
  z-index:0;
  font-family:"Sora", "Space Grotesk", "Segoe UI", "Trebuchet MS", sans-serif;
  font-size:var(--today-focus-ghost-size);
  font-weight:600;
  line-height:0.82;
  letter-spacing:-0.04em;
  color:var(--text);
  opacity:var(--today-focus-ghost-opacity);
  pointer-events:none;
  user-select:none;
  white-space:nowrap;
}

.today-focus-date-number{
  font-size:clamp(62px, 10vw, 88px);
  line-height:0.86;
  font-weight:800;
  letter-spacing:-0.08em;
  color:var(--text);
}
.today-focus-date-copy{
  display:grid;
  gap:6px;
  padding-bottom:10px;
}
.today-focus-date-month{
  font-size:clamp(22px, 4vw, 30px);
  line-height:1;
  font-weight:760;
  letter-spacing:-0.03em;
  color:var(--text);
}
.today-focus-date-full{
  font-size:14px;
  color:var(--muted);
}
.today-focus-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(300px, 1fr));
  gap:18px;
}
.today-focus-card{
  position:relative;
  display:grid;
  gap:18px;
  min-height:268px;
  padding:22px;
  border-radius:30px;
  border:1px solid color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--today-accent) 12%, transparent), transparent 28%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 97%, transparent), color-mix(in srgb, var(--surface-2) 82%, var(--surface) 18%));
  box-shadow:0 22px 44px rgba(15, 23, 42, 0.1);
  cursor:pointer;
  overflow:hidden;
  transition:transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}
.today-focus-card::before{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(140deg, color-mix(in srgb, #ffffff 10%, transparent), transparent 52%);
  pointer-events:none;
}
.today-focus-card > *{
  position:relative;
  z-index:1;
}
.today-focus-card:hover{
  transform:translateY(-5px);
  box-shadow:0 30px 58px rgba(15, 23, 42, 0.15);
}
.today-focus-card.is-checked{
  border-color:color-mix(in srgb, var(--today-accent) 58%, var(--grid));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--today-accent) 16%, transparent), transparent 32%),
    linear-gradient(180deg, color-mix(in srgb, var(--today) 84%, var(--surface) 16%), color-mix(in srgb, var(--surface) 74%, var(--today) 26%));
  box-shadow:0 28px 54px rgba(34, 197, 94, 0.16);
}
.today-focus-card.is-locked{
  opacity:0.72;
  cursor:not-allowed;
}
.today-focus-card-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.today-focus-card-badge,
.today-focus-card-status{
  display:inline-flex;
  align-items:center;
  min-height:35px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  font-size:11px;
  font-weight:800;
  letter-spacing:0.14em;
  text-transform:uppercase;
}
.today-focus-card-badge{
  color:var(--muted);
}
.today-focus-card-status{
  color:var(--today-accent);
}
.today-focus-card-body{
  display:grid;
  gap:14px;
  align-content:start;
}
.today-focus-icon{
  width:58px;
  height:58px;
  display:grid;
  place-items:center;
  font-size:26px;
  border-radius:20px;
  border:1px solid color-mix(in srgb, var(--grid) 74%, var(--surface) 26%);
  background:color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow:0 14px 24px rgba(15, 23, 42, 0.08);
}
.today-focus-name{
  font-size:23px;
  line-height:1.08;
  font-weight:780;
  letter-spacing:-0.03em;
  color:var(--text);
}
.today-focus-streak{
  font-size:14px;
  font-weight:650;
  color:var(--today-accent);
}
.today-focus-stats{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.today-focus-stats span{
  padding:8px 11px;
  border-radius:14px;
  border:1px solid color-mix(in srgb, var(--grid) 74%, var(--surface) 26%);
  background:color-mix(in srgb, var(--surface) 92%, transparent);
  font-size:12px;
  color:var(--muted);
}
.today-focus-action{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-top:auto;
  padding:14px 16px;
  border-radius:20px;
  border:1px solid color-mix(in srgb, var(--grid) 74%, var(--surface) 26%);
  background:color-mix(in srgb, var(--surface) 92%, transparent);
}
.today-focus-action-label{
  font-size:12px;
  font-weight:800;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:var(--muted);
}
.today-focus-card.is-checked .today-focus-action-label{
  color:var(--today-accent);
}
.today-focus-toggle{
  position:relative;
  width:62px;
  height:34px;
  flex:0 0 auto;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  background:color-mix(in srgb, var(--surface-3) 88%, var(--surface) 12%);
  transition:background 0.2s ease, border-color 0.2s ease;
}
.today-focus-toggle-dot{
  position:absolute;
  top:3px;
  left:4px;
  width:26px;
  height:26px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 8px 16px rgba(15, 23, 42, 0.18);
  transition:transform 0.2s ease;
}
.today-focus-card.is-checked .today-focus-toggle{
  border-color:transparent;
  background:linear-gradient(135deg, var(--today-accent), color-mix(in srgb, var(--accent) 76%, #ffffff 24%));
}
.today-focus-card.is-checked .today-focus-toggle-dot{
  transform:translateX(28px);
}
.today-focus-checkbox{
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  pointer-events:none;
}
.today-focus-card:focus-within{
  outline:3px solid color-mix(in srgb, var(--today-accent) 42%, transparent);
  outline-offset:4px;
}
@media (max-width: 720px){
  .today-focus-date-card{
    padding:24px 22px;
    border-radius:28px;
    --today-focus-ghost-size:clamp(72px, 24vw, 122px);
    --today-focus-ghost-eyebrow-size:clamp(60px, 18vw, 100px);
    --today-focus-ghost-eyebrow-left:-2px;
    --today-focus-ghost-number-left:40%;
    --today-focus-ghost-month-right:0;
  }
  .today-focus-date-main{
    flex-direction:column;
    align-items:flex-start;
    gap:12px;
  }
  .today-focus-date-number{
    font-size:72px;
  }
  .today-focus-date-copy{
    padding-bottom:0;
  }
  .today-focus-grid{
    grid-template-columns:1fr;
  }
  .today-focus-card{
    min-height:244px;
    padding:20px;
  }
  .today-focus-card-top,
  .today-focus-action{
    flex-direction:column;
    align-items:flex-start;
  }
}

/* Habit tracker typography refinement */
.controls-shell{
  margin:10px 0 16px;
}
.controls-toggle-pill{
  gap:9px;
  padding:10px 14px;
  border-radius:16px;
  box-shadow:0 10px 20px rgba(15, 23, 42, 0.06);
}
.controls-toggle-text{
  font-size:10px;
  letter-spacing:0.14em;
}
.controls-toggle-icon{
  width:20px;
  height:20px;
  border-radius:9px;
}
.controls-shell .toolbar{
  padding:18px 20px 20px;
  border-radius:22px;
}
.range-buttons{
  gap:6px;
  padding:6px;
  border-radius:16px;
}
.range-group{
  padding:4px;
  border-radius:12px;
}
.range-btn{
  min-height:40px;
  padding:7px 10px;
  border-radius:10px;
  font-size:10px;
  letter-spacing:0.1em;
}
.range-btn[data-preset="today"]{
  min-width:88px;
}
.toolbar label,
.toolbar .field label,
.past-edit-title,
.past-edit-sub{
  font-size:11px;
}
.habit-dashboard{
  margin-top:22px;
}
.habit-dashboard-head{
  padding:18px 20px;
  border-radius:24px;
}
.habit-dashboard-copy{
  gap:4px;
  max-width:680px;
}
.habit-dashboard-head .eyebrow{
  font-size:10px;
  letter-spacing:0.16em;
}
.habit-dashboard-head h2{
  font-size:24px;
  line-height:1.05;
}
.habit-dashboard-head .sub{
  font-size:13px;
  line-height:1.5;
}
.habit-dashboard-badge,
.summary-hero-pill,
.summary-stat-chip{
  padding:7px 11px;
  border-radius:14px;
  font-size:10px;
  letter-spacing:0.12em;
  text-transform:uppercase;
}
.summary-grid{
  gap:14px;
}
.summary-card-hero{
  grid-column:span 7;
}
.summary-card-focus{
  grid-column:span 5;
}
.summary-card{
  padding:18px;
  border-radius:22px;
  box-shadow:0 14px 32px rgba(15, 23, 42, 0.08);
}
.summary-card-head{
  gap:12px;
}
.summary-title-wrap{
  gap:10px;
}
.summary-title-wrap-hero{
  gap:12px;
}
.summary-title-text .k{
  font-size:11px;
  letter-spacing:0.12em;
  text-transform:uppercase;
}
.summary-icon{
  width:38px;
  height:38px;
  border-radius:13px;
  font-size:15px;
}
.summary-card-hero .summary-icon{
  width:46px;
  height:46px;
  border-radius:16px;
  font-size:18px;
}
.summary-card-hero .v{
  font-size:34px;
  line-height:0.94;
}
.range-sub{
  font-size:12px;
}
.summary-mini-grid{
  gap:10px;
}
.summary-mini-card,
.summary-split > div,
.summary-duo-block,
.habit-leaderboard-item,
.habit-insight-item{
  border-radius:16px;
}
.summary-mini-card{
  padding:12px;
}
.summary-mini-label,
.summary-split span,
.summary-duo-block span,
.habit-leaderboard-meta,
.habit-insight-item span{
  font-size:12px;
}
.summary-mini-card strong{
  font-size:22px;
}
.summary-split strong,
.summary-duo-block strong{
  font-size:22px;
}
.summary-note{
  font-size:12px;
  line-height:1.5;
}
.habit-leaderboard-item,
.habit-insight-item{
  padding:14px;
}
.habit-leaderboard-name{
  font-size:14px;
}
.habit-leaderboard-rate{
  font-size:18px;
}
.habit-insight-item strong{
  font-size:12px;
  letter-spacing:0.08em;
  text-transform:uppercase;
}
.page-note{
  margin-top:10px;
}
.page-note-chip{
  padding:5px 10px;
  font-size:10px;
  letter-spacing:0.08em;
}
.today-focus-view{
  gap:16px;
  padding-top:6px;
}
.today-focus-date-card{
  gap:10px;
  padding:22px 24px;
  border-radius:28px;
  box-shadow:0 18px 40px rgba(15, 23, 42, 0.1);
}
.today-focus-date-eyebrow{
  font-size:10px;
  letter-spacing:0.18em;
}
.today-focus-date-main{
  gap:14px;
}
.today-focus-date-number{
  font-size:68px;
  line-height:0.88;
}
.today-focus-date-month{
  font-size:22px;
}
.today-focus-date-full{
  font-size:12px;
}
.today-focus-grid{
  grid-template-columns:repeat(auto-fit, minmax(270px, 1fr));
  gap:14px;
}
.today-focus-card{
  gap:14px;
  min-height:228px;
  padding:18px;
  border-radius:24px;
  box-shadow:0 16px 34px rgba(15, 23, 42, 0.08);
}
.today-focus-card:hover{
  transform:translateY(-3px);
  box-shadow:0 22px 42px rgba(15, 23, 42, 0.12);
}
.today-focus-card-top{
  gap:10px;
}
.today-focus-card-badge,
.today-focus-card-status{
  min-height:31px;
  padding:6px 10px;
  font-size:10px;
  letter-spacing:0.12em;
}
.today-focus-card-body{
  gap:12px;
}
.today-focus-icon{
  width:48px;
  height:48px;
  border-radius:16px;
  font-size:22px;
}
.today-focus-name{
  font-size:19px;
  line-height:1.1;
}
.today-focus-streak{
  font-size:12px;
}
.today-focus-stats{
  gap:6px;
}
.today-focus-stats span{
  padding:7px 9px;
  border-radius:12px;
  font-size:11px;
}
.today-focus-action{
  gap:10px;
  padding:11px 13px;
  border-radius:16px;
}
.today-focus-action-label{
  font-size:10px;
  letter-spacing:0.12em;
}
.today-focus-toggle{
  width:56px;
  height:30px;
}
.today-focus-toggle-dot{
  top:3px;
  left:3px;
  width:22px;
  height:22px;
}
.today-focus-card.is-checked .today-focus-toggle-dot{
  transform:translateX(26px);
}
@media (max-width: 980px){
  .summary-card-hero,
  .summary-card-focus,
  .summary-card-spotlight,
  .summary-card-list{
    grid-column:span 2;
  }
}
@media (max-width: 720px){
  .controls-shell .toolbar,
  .habit-dashboard-head{
    padding:16px;
  }
  .today-focus-date-card{
    padding:18px 18px;
  }
  .today-focus-date-number{
    font-size:56px;
  }
  .today-focus-date-month{
    font-size:18px;
  }
  .today-focus-card{
    min-height:210px;
    padding:16px;
  }
}

/* Habit tracker final layout polish */
.habit-hero{
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  align-items:start;
  gap:16px 22px;
  margin-bottom:14px;
}
.habit-hero-copy{
  min-width:0;
}
.habit-hero .controls-shell{
  margin:0 0 0 auto;
  width:max-content;
  display:grid;
  justify-self:end;
  align-self:start;
}
.habit-hero .controls-shell > summary.controls-summary{
  justify-self:end;
}
.habit-hero .controls-shell[open]{
  grid-column:1 / -1;
  width:100%;
  margin-top  : -75px;
}
.habit-hero .controls-shell[open] > summary.controls-summary{
  justify-self:end;
}
.habit-hero .controls-shell .toolbar{
  width:100%;
  margin-top:14px;
}
.habit-toolbar-main{
  display:grid;
  gap:12px;
  align-items:start;
}
.habit-filter-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px 12px;
}
.range-field{
  min-width:0;
}
.compact-field{
  min-width:176px;
  flex:1 1 176px;
}
.toolbar select,
.toolbar input[type="date"]{
  min-height:42px;
  padding:9px 11px;
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  border-radius:12px;
  background:color-mix(in srgb, var(--surface-2) 88%, var(--surface) 12%);
  color:var(--text);
  font:inherit;
  box-shadow:inset 0 1px 0 color-mix(in srgb, #ffffff 18%, transparent);
}
.toolbar select:focus,
.toolbar input[type="date"]:focus{
  outline:2px solid color-mix(in srgb, var(--today-accent) 30%, transparent);
  outline-offset:2px;
}
.toolbar-group.actions{
  align-items:flex-start;
}
.past-edit-toggle{
  min-height:42px;
  padding:8px 12px;
  border-radius:14px;
}
.habit-dashboard-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
}
.habit-dashboard-copy .eyebrow{
  margin-bottom:2px;
}
.habit-dashboard-badge{
  flex:0 0 auto;
}
.summary-card-head{
  align-items:flex-start;
}
.summary-card-hero .v{
  font-size:32px;
}
.summary-hero-pill strong,
.summary-mini-card strong,
.summary-split strong,
.summary-duo-block strong{
  letter-spacing:-0.02em;
}

.today-focus-card{
  --habit-accent: var(--today-accent);
  border-color:color-mix(in srgb, var(--habit-accent) 28%, var(--grid));
  box-shadow:
    inset 4px 0 0 color-mix(in srgb, var(--habit-accent) 74%, transparent),
    0 16px 34px rgba(15, 23, 42, 0.08);
}
.today-focus-card::after{
  content:"";
  position:absolute;
  inset:18px 18px auto auto;
  width:10px;
  height:10px;
  border-radius:999px;
  background:color-mix(in srgb, var(--habit-accent) 88%, #ffffff 12%);
  box-shadow:0 0 0 6px color-mix(in srgb, var(--habit-accent) 10%, transparent);
}
.today-focus-card:hover{
  border-color:color-mix(in srgb, var(--habit-accent) 46%, var(--grid));
}
.today-focus-card.is-checked{
  border-color:color-mix(in srgb, var(--habit-accent) 44%, var(--today-accent));
  box-shadow:
    inset 4px 0 0 color-mix(in srgb, var(--habit-accent) 80%, transparent),
    0 22px 42px rgba(15, 23, 42, 0.12);
}
.today-focus-card-badge{
  border-color:color-mix(in srgb, var(--habit-accent) 38%, var(--grid));
  background:color-mix(in srgb, var(--habit-accent) 12%, var(--surface));
  color:color-mix(in srgb, var(--habit-accent) 82%, var(--text));
}
.today-focus-card-status{
  background:color-mix(in srgb, var(--today-accent) 10%, var(--surface));
}
.today-focus-icon{
  border-color:color-mix(in srgb, var(--habit-accent) 34%, var(--grid));
  background:
    radial-gradient(circle at top left, color-mix(in srgb, #ffffff 30%, transparent), transparent 54%),
    linear-gradient(135deg, color-mix(in srgb, var(--habit-accent) 20%, var(--surface)), color-mix(in srgb, var(--habit-accent) 8%, var(--surface-2)));
  color:color-mix(in srgb, var(--habit-accent) 86%, var(--text));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 24%, transparent),
    0 12px 24px color-mix(in srgb, var(--habit-accent) 12%, rgba(15, 23, 42, 0.08));
}
.today-focus-stats span{
  border-color:color-mix(in srgb, var(--habit-accent) 20%, var(--grid));
}
.today-focus-checkbox{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  opacity:0;
  pointer-events:none;
}

@media (max-width: 980px){
  .habit-hero{
    grid-template-columns:1fr;
  }
  .habit-hero .controls-shell,
  .habit-hero .controls-shell > summary.controls-summary,
  .habit-hero .controls-shell[open] > summary.controls-summary{
    justify-self:end;
  }
}
@media (max-width: 720px){
  .habit-hero{
    gap:14px;
  }
  .habit-hero .controls-shell,
  .habit-hero .controls-shell[open]{
    width:100%;margin-top:0;
  }
  .habit-hero .controls-shell > summary.controls-summary,
  .habit-hero .controls-shell[open] > summary.controls-summary{
    justify-self:end;
  }
  .habit-filter-row{
    flex-direction:column;
  }
  .compact-field{
    min-width:0;
  }
  .habit-dashboard-head{
    flex-direction:column;
    align-items:flex-start;
  }
}

/* Habit tracker filter chips + stats layout */
.habit-toolbar-main{
  grid-template-columns:minmax(0, 1fr);
}
.range-field{
  grid-column:1 / -1;
}
.habit-filter-row{
  grid-column:1 / -1;
  display:grid;
  grid-template-columns:minmax(0, 1fr) 168px;
  gap:12px 14px;
  align-items:end;
}
.habit-category-field{
  min-width:0;
}
.habit-category-filter{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.habit-category-chip{
  --chip-accent: var(--accent);
  display:inline-flex;
  align-items:center;
  gap:7px;
  min-height:36px;
  padding:7px 10px;
  border-radius:14px;
  border:1px solid color-mix(in srgb, var(--chip-accent) 28%, var(--grid));
  background:color-mix(in srgb, var(--chip-accent) 10%, var(--surface));
  color:color-mix(in srgb, var(--chip-accent) 82%, var(--text));
  font:inherit;
  font-size:11px;
  font-weight:700;
  letter-spacing:0.02em;
  cursor:pointer;
  transition:transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.habit-category-chip:hover{
  transform:translateY(-1px);
  border-color:color-mix(in srgb, var(--chip-accent) 46%, var(--grid));
  box-shadow:0 8px 18px color-mix(in srgb, var(--chip-accent) 10%, rgba(15, 23, 42, 0.08));
}
.habit-category-chip.active{
  background:color-mix(in srgb, var(--chip-accent) 18%, var(--surface));
  border-color:color-mix(in srgb, var(--chip-accent) 56%, var(--grid));
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--chip-accent) 16%, transparent);
}
.habit-category-chip-icon{
  width:18px;
  height:18px;
  display:grid;
  place-items:center;
  border-radius:999px;
  background:color-mix(in srgb, var(--chip-accent) 16%, var(--surface));
  font-size:10px;
  line-height:1;
  flex:0 0 auto;
}
.habit-category-chip-label{
  white-space:nowrap;
}
.sort-field{
  min-width:168px;
}
.custom-range{
  grid-column:1 / -1;
  display:none;
  grid-template-columns:repeat(2, minmax(160px, 1fr));
  gap:10px 12px;
}
.custom-range.show{
  display:grid;
}

.today-focus-view{
  justify-items:start;
}
.today-focus-view > .today-focus-date-card{
  justify-self:start;
  width:min(100%, 390px);
  max-width:390px;
}
.today-focus-view > .today-focus-grid{
  width:100%;
}

.habit-dashboard .summary-grid{
  grid-template-columns:minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 0.96fr);
  grid-template-areas:
    "hero hero snapshot"
    "hero hero streaks"
    "spotlight spotlight leaderboard"
    "spotlight spotlight insights";
  grid-auto-rows:minmax(158px, auto);
  align-items:start;
}
.summary-card{
  display:grid;
  gap:14px;
  align-content:start;
}
.summary-card-hero{
  grid-area:hero;
}
.summary-card-snapshot{
  grid-area:snapshot;
}
.summary-card-streaks{
  grid-area:streaks;
}
.summary-card-spotlight{
  grid-area:spotlight;
}
.summary-card-leaderboard{
  grid-area:leaderboard;
}
.summary-card-insights{
  grid-area:insights;
}
.summary-card-snapshot,
.summary-card-streaks,
.summary-card-leaderboard,
.summary-card-insights{
  min-height:0;
}
.summary-card-snapshot .summary-card-head,
.summary-card-streaks .summary-card-head,
.summary-card-leaderboard .summary-card-head,
.summary-card-insights .summary-card-head{
  margin-bottom:2px;
}
.summary-card-snapshot .summary-split,
.summary-card-streaks .summary-split{
  gap:10px;
}
.summary-card-snapshot .summary-note,
.summary-card-streaks .summary-note{
  margin-top:auto;
}
.summary-card-spotlight .summary-duo{
  gap:12px;
}
.habit-leaderboard,
.habit-insight-list{
  display:grid;
  gap:10px;
}

@media (max-width: 1100px){
  .habit-dashboard .summary-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "hero hero"
      "snapshot streaks"
      "spotlight spotlight"
      "leaderboard insights";
    grid-auto-rows:auto;
  }
}
@media (max-width: 820px){
  .habit-filter-row{
    grid-template-columns:1fr;
  }
  .sort-field{
    min-width:0;
    max-width:220px;
  }
  .today-focus-view > .today-focus-date-card{
    width:min(100%, 340px);
  }
  .habit-dashboard .summary-grid{
    grid-template-columns:1fr;
    grid-template-areas:
      "hero"
      "snapshot"
      "streaks"
      "spotlight"
      "leaderboard"
      "insights";
  }
}

/* Compact desktop layout for today habit cards */
.today-focus-view > .today-focus-grid{
  display:grid;
  grid-template-columns:repeat(6, minmax(0, 1fr));
  gap:12px;
  align-items:stretch;
}
.today-focus-card{
  gap:12px;
  min-height:170px;
  padding:14px 14px 13px;
  border-radius:20px;
  box-shadow:
    inset 2px 0 0 color-mix(in srgb, var(--habit-accent) 74%, transparent),
    0 14px 28px rgba(15, 23, 42, 0.08);
}
.today-focus-card::after{
  inset:8px -250px auto auto;
  width:500px;
  height:300px;
  box-shadow:0 0 0 4px color-mix(in srgb, var(--habit-accent) 10%, transparent);
  opacity:0.3;
}
.today-focus-card:hover{
  transform:translateY(-2px);
  box-shadow:
    inset 2px 0 0 color-mix(in srgb, var(--habit-accent) 76%, transparent),
    0 18px 30px rgba(15, 23, 42, 0.11);
}
.today-focus-card.is-checked{
  box-shadow:
    inset 2px 0 0 color-mix(in srgb, var(--habit-accent) 82%, transparent),
    0 18px 30px rgba(15, 23, 42, 0.12);
}
.today-focus-card-top{
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  gap:8px;
  align-items:start;
}
.today-focus-card-badge,
.today-focus-card-status{
  min-height:26px;
  padding:5px 8px;
  font-size:9px;
  letter-spacing:0.11em;
}
.today-focus-card-badge{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.today-focus-card-body{
  display:grid;
  grid-template-columns:40px minmax(0, 1fr);
  grid-template-areas:
    "icon name"
    "icon streak"
    "stats stats";
  gap:6px 10px;
  align-content:start;
}
.today-focus-icon{
  grid-area:icon;
  width:40px;
  height:40px;
  border-radius:14px;
  font-size:18px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #ffffff 20%, transparent),
    0 8px 18px color-mix(in srgb, var(--habit-accent) 10%, rgba(15, 23, 42, 0.07));
}
.today-focus-name{
  grid-area:name;
  align-self:end;
  font-size:15px;
  line-height:1.14;
  letter-spacing:-0.02em;
}
.today-focus-streak{
  grid-area:streak;
  font-size:11px;
  line-height:1.35;
}
.today-focus-stats{
  grid-area:stats;
  gap:5px;
}
.today-focus-stats span{
  min-height:24px;
  padding:5px 7px;
  border-radius:10px;
  font-size:10px;
  line-height:1.2;
}

@media (max-width: 1600px){
  .today-focus-view > .today-focus-grid{
    grid-template-columns:repeat(5, minmax(0, 1fr));
  }
}
@media (max-width: 1360px){
  .today-focus-view > .today-focus-grid{
    grid-template-columns:repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1120px){
  .today-focus-view > .today-focus-grid{
    grid-template-columns:repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 820px){
  .today-focus-view > .today-focus-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  .today-focus-card{
    min-height:164px;
  }
}
@media (max-width: 560px){
  .today-focus-view > .today-focus-grid{
    grid-template-columns:1fr;
  }
}

/* Today view: completed board + actions */
.today-focus-view > .today-focus-date-card{
  width:100%;
  max-width:none;
  justify-self:stretch;
  text-align:center;
}
.today-focus-date-eyebrow{
  justify-self:center;
}
.today-focus-date-main{
  justify-content:center;
}
.today-focus-date-copy{
  justify-items:center;
  padding-bottom:4px;
}
.today-focus-completed-board{
  width:100%;
  border-radius:22px;
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 92%, transparent)),
    radial-gradient(circle at top right, color-mix(in srgb, var(--today-accent) 8%, transparent), transparent 42%);
  box-shadow:0 14px 30px rgba(15, 23, 42, 0.08);
  overflow:hidden;
}
.today-focus-completed-board > summary{
  list-style:none;
}
.today-focus-completed-board > summary::-webkit-details-marker{
  display:none;
}
.today-focus-completed-summary{
  display:grid;
  grid-template-columns:40px minmax(0, 1fr) auto;
  gap:12px;
  align-items:center;
  padding:14px 16px;
  cursor:pointer;
}
.today-focus-completed-icon{
  width:40px;
  height:40px;
  display:grid;
  place-items:center;
  border-radius:14px;
  border:1px solid color-mix(in srgb, var(--today-accent) 28%, var(--grid));
  background:color-mix(in srgb, var(--today-accent) 10%, var(--surface));
  color:var(--today-accent);
  font-size:17px;
  font-weight:800;
}
.today-focus-completed-copy{
  min-width:0;
  display:grid;
  gap:2px;
}
.today-focus-completed-copy strong{
  font-size:14px;
  line-height:1.2;
  font-weight:760;
  color:var(--text);
}
.today-focus-completed-copy span{
  font-size:11px;
  color:var(--muted);
}
.today-focus-completed-meta{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--today-accent) 24%, var(--grid));
  background:color-mix(in srgb, var(--today-accent) 10%, var(--surface));
  color:var(--today-accent);
  font-size:10px;
  font-weight:800;
  letter-spacing:0.12em;
  text-transform:uppercase;
}
.today-focus-completed-body{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:10px;
  padding:0 16px 16px;
}
.today-focus-completed-actions{
  display:flex;
  justify-content:flex-end;
  padding:0 16px 12px;
}
.today-focus-completed-actions:empty{
  display:none;
}
.today-focus-completed-hint{
  padding:0 16px 10px;
  font-size:10px;
  line-height:1.5;
  color:var(--muted);
}
.today-focus-completed-hint:empty{
  display:none;
}
.today-focus-completed-hide-all{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:30px;
  padding:6px 12px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--today-accent) 28%, var(--grid));
  background:color-mix(in srgb, var(--today-accent) 12%, var(--surface));
  color:var(--today-accent);
  font:inherit;
  font-size:10px;
  font-weight:800;
  letter-spacing:0.12em;
  text-transform:uppercase;
  cursor:pointer;
  transition:transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}
.today-focus-completed-hide-all:hover:not(:disabled){
  transform:translateY(-1px);
  border-color:color-mix(in srgb, var(--today-accent) 42%, var(--grid));
  background:color-mix(in srgb, var(--today-accent) 16%, var(--surface));
}
.today-focus-completed-hide-all:disabled{
  opacity:0.45;
  cursor:not-allowed;
}
.today-focus-completed-item,
.today-focus-completed-empty{
  min-height:56px;
  border-radius:14px;
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  background:color-mix(in srgb, var(--surface) 92%, transparent);
}
.today-focus-completed-item{
  --habit-accent: var(--today-accent);
  display:grid;
  grid-template-columns:28px minmax(0, 1fr);
  gap:8px;
  align-items:center;
  padding:10px 11px;
  text-align:left;
  cursor:pointer;
  transition:transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.today-focus-completed-item:hover{
  transform:translateY(-1px);
  border-color:color-mix(in srgb, var(--habit-accent) 42%, var(--grid));
  background:color-mix(in srgb, var(--habit-accent) 8%, var(--surface));
}
.today-focus-completed-item.is-hidden{
  border-style:dashed;
}
.today-focus-completed-item-icon{
  width:28px;
  height:28px;
  display:grid;
  place-items:center;
  border-radius:10px;
  background:color-mix(in srgb, var(--habit-accent) 12%, var(--surface));
  color:color-mix(in srgb, var(--habit-accent) 86%, var(--text));
  font-size:13px;
}
.today-focus-completed-item-text{
  min-width:0;
  display:block;
}
.today-focus-completed-item-text strong{
  display:block;
  font-size:12px;
  line-height:1.35;
  font-weight:760;
  color:var(--text);
}
.today-focus-completed-item-text span,
.today-focus-completed-empty{
  font-size:11px;
  line-height:1.45;
  color:var(--muted);
}
.today-focus-completed-empty{
  display:grid;
  place-items:center;
  padding:14px;
}
.today-focus-card{
  grid-template-rows:auto 1fr;
}
.today-focus-card-top{
  grid-template-columns:minmax(0, 1fr) auto auto;
}
.today-focus-card:focus-visible{
  outline:none;
  border-color:color-mix(in srgb, var(--habit-accent) 56%, var(--grid));
  box-shadow:
    inset 2px 0 0 color-mix(in srgb, var(--habit-accent) 82%, transparent),
    0 0 0 3px color-mix(in srgb, var(--habit-accent) 16%, transparent),
    0 18px 30px rgba(15, 23, 42, 0.11);
}
.today-focus-card.is-checked{
  border-color:color-mix(in srgb, var(--habit-accent) 52%, var(--today-accent));
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--habit-accent) 18%, transparent), transparent 38%),
    linear-gradient(180deg, color-mix(in srgb, var(--habit-accent) 12%, var(--surface)), color-mix(in srgb, var(--today) 16%, var(--surface-2)));
  box-shadow:
    inset 2px 0 0 color-mix(in srgb, var(--habit-accent) 84%, transparent),
    0 18px 32px color-mix(in srgb, var(--habit-accent) 14%, rgba(15, 23, 42, 0.12));
}
.today-focus-card.is-checked .today-focus-card-status{
  border-color:color-mix(in srgb, var(--habit-accent) 34%, var(--grid));
  background:color-mix(in srgb, var(--habit-accent) 16%, var(--surface));
  color:color-mix(in srgb, var(--habit-accent) 86%, var(--text));
}
.today-focus-card.is-checked .today-focus-hide-btn{
  border-color:color-mix(in srgb, #ef4444 42%, var(--grid));
  background:color-mix(in srgb, #ef4444 14%, var(--surface));
}
.today-focus-hide-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:26px;
  padding:5px 8px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, #ef4444 30%, var(--grid));
  background:color-mix(in srgb, #ef4444 10%, var(--surface));
  color:#fca5a5;
  font:inherit;
  font-size:9px;
  font-weight:800;
  letter-spacing:0.11em;
  text-transform:uppercase;
  cursor:pointer;
  transition:transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.today-focus-hide-btn[hidden]{
  display:none !important;
}
.today-focus-hide-btn:hover{
  transform:translateY(-1px);
  border-color:color-mix(in srgb, #ef4444 46%, var(--grid));
  background:color-mix(in srgb, #ef4444 14%, var(--surface));
}
.today-focus-copy{
  grid-area:copy;
  min-width:0;
  display:grid;
  gap:4px;
  align-content:start;
}
.today-focus-copy > .today-focus-name,
.today-focus-copy > .today-focus-streak{
  grid-area:auto;
  align-self:auto;
}
.today-focus-card-body{
  grid-template-columns:40px minmax(0, 1fr);
  grid-template-areas:
    "icon copy"
    "stats stats";
  grid-template-rows:1fr auto;
  gap:10px;
  min-height:0;
}
.today-focus-stats{
  grid-area:stats;
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:6px;
  align-self:end;
  margin-top:auto;
}
.today-focus-stats span{
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
}
.today-focus-empty-state{
  grid-column:1 / -1;
  min-height:140px;
  display:grid;
  place-items:center;
  padding:18px;
  border-radius:20px;
  border:1px dashed color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  background:color-mix(in srgb, var(--surface) 90%, transparent);
  font-size:12px;
  line-height:1.6;
  color:var(--muted);
  text-align:center;
}

@media (max-width: 820px){
  .today-focus-completed-summary{
    grid-template-columns:32px minmax(0, 1fr) auto;
    gap:10px;
    padding:12px 14px;
  }
  .today-focus-completed-meta{
    grid-column:auto;
    justify-self:end;
    min-height:24px;
    padding:5px 8px;
    font-size:9px;
  }
  .today-focus-completed-actions{
    justify-content:flex-end;
    padding:0 14px 8px;
  }
  .today-focus-completed-hide-all{
    min-height:27px;
    padding:5px 10px;
    font-size:9px;
  }
  .today-focus-completed-hint{
    padding:0 14px 8px;
  }
  .today-focus-completed-body{
    grid-template-columns:1fr;
    gap:8px;
    padding:0 14px 14px;
  }
  .today-focus-completed-item{
    min-height:52px;
  }
}

@media (max-width: 560px){
  .today-focus-view > .today-focus-date-card{
    padding:20px 16px;
    border-radius:24px;
    --today-focus-ghost-size:clamp(60px, 24vw, 90px);
    --today-focus-ghost-eyebrow-size:clamp(46px, 16vw, 72px);
   --today-focus-ghost-top: 44px;
        --today-focus-ghost-eyebrow-top: 38px;
        --today-focus-ghost-eyebrow-left: 0px;
        --today-focus-ghost-number-left: -4%;
        --today-focus-ghost-month-right: -6px;
  }
  .today-focus-card::after{
    inset:8px -150px auto auto;
  }
  .today-focus-date-main{
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:8px;
  }
  .today-focus-date-number{
    font-size:62px;
    line-height:0.92;
  }
  .today-focus-date-copy{
    gap:4px;
    justify-items:center;
  }
  .today-focus-date-month{
    font-size:22px;
  }
  .today-focus-date-full{
    font-size:12px;
    display: none;
  }
  .today-focus-completed-summary{
    grid-template-columns:28px minmax(0, 1fr) auto;
    gap:8px;
  }
  .today-focus-completed-icon{
    width:28px;
    height:28px;
    border-radius:10px;
    font-size:11px;
  }
  .today-focus-completed-copy strong{
    font-size:12px;
  }
  .today-focus-completed-copy span{
    font-size:10px;
  }
  .habit-hero .controls-shell > summary.controls-summary,
  .habit-hero .controls-shell[open] > summary.controls-summary{
    justify-self:stretch;
  }
  .controls-toggle-pill{
    width:100%;
    min-height:40px;
    justify-content:center;
    gap:8px;
    padding:8px 12px;
    border-radius:14px;
  }
  .controls-toggle-icon{
    width:18px;
    height:18px;
    border-radius:8px;
  }
  .controls-toggle-icon::before,
  .controls-toggle-icon::after{
    left:4px;
    right:4px;
  }
  .controls-toggle-icon::before{
    top:5px;
    box-shadow:0 5px 0 var(--today-accent);
  }
  .controls-toggle-icon::after{
    top:8px;
    left:6px;
    right:6px;
  }
  .controls-toggle-text{
    font-size:10px;
    letter-spacing:0.12em;
  }
}

/* Motion layer: subtle, structured, and reversible */
@keyframes habit-rise-in{
  from{
    opacity:0;
    transform:translateY(14px) scale(0.985);
  }
  to{
    opacity:1;
    transform:translateY(0) scale(1);
  }
}
@keyframes habit-panel-reveal{
  from{
    opacity:0;
    transform:translateY(-8px) scale(0.985);
  }
  to{
    opacity:1;
    transform:translateY(0) scale(1);
  }
}
@keyframes habit-soft-bob{
  0%, 100%{
    transform:translateY(0);
  }
  50%{
    transform:translateY(-2px);
  }
}
@keyframes habit-badge-pop{
  0%{
    transform:scale(0.92);
  }
  70%{
    transform:scale(1.03);
  }
  100%{
    transform:scale(1);
  }
}

.controls-toggle-pill,
.controls-shell .toolbar,
.range-btn,
.habit-category-chip,
.summary-card,
.today-focus-date-card,
.today-focus-card,
.today-focus-completed-board,
.today-focus-completed-item,
.today-focus-hide-btn,
.today-focus-completed-hide-all,
.today-focus-completed-meta,
.today-focus-card-badge,
.today-focus-card-status,
.today-focus-stats span{
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.22s ease,
    background 0.24s ease,
    color 0.22s ease,
    opacity 0.22s ease,
    filter 0.24s ease;
}

.controls-toggle-pill{
  overflow:hidden;
  isolation:isolate;
}
.controls-toggle-pill::after{
  content:"";
  position:absolute;
  top:-30%;
  bottom:-30%;
  left:-18%;
  width:32%;
  background:linear-gradient(90deg, transparent, color-mix(in srgb, #ffffff 28%, transparent), transparent);
  opacity:0;
  transform:translateX(-160%) rotate(16deg);
  transition:
    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
  pointer-events:none;
  z-index:0;
}
.controls-summary:hover .controls-toggle-pill,
.controls-shell[open] .controls-toggle-pill{
  box-shadow:0 20px 34px rgba(15, 23, 42, 0.14);
}
.controls-summary:hover .controls-toggle-pill::after,
.controls-shell[open] .controls-toggle-pill::after{
  opacity:0.8;
  transform:translateX(360%) rotate(16deg);
}
.controls-shell:not([open]) .controls-summary:hover .controls-toggle-icon{
  transform:rotate(8deg) scale(1.05);
}
.controls-shell[open] .controls-summary:hover .controls-toggle-icon{
  transform:rotate(96deg) scale(1.05);
}
.controls-summary:hover .controls-toggle-text{
  color:color-mix(in srgb, var(--today-accent) 58%, var(--text));
  letter-spacing:0.18em;
}
.controls-shell[open] .toolbar{
  animation:habit-panel-reveal 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
  transform-origin:top center;
}

.range-btn:hover,
.habit-category-chip:hover{
  transform:translateY(-2px) scale(1.015);
}
.range-btn:active,
.habit-category-chip:active,
.today-focus-hide-btn:active,
.today-focus-completed-hide-all:active,
.today-focus-completed-item:active{
  transform:translateY(0) scale(0.985);
}
.habit-category-chip-icon,
.today-focus-icon,
.today-focus-completed-item-icon,
.today-focus-completed-meta{
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.24s ease,
    background 0.24s ease,
    border-color 0.24s ease;
}
.habit-category-chip:hover .habit-category-chip-icon{
  transform:rotate(-8deg) scale(1.08);
}
.habit-category-chip.active .habit-category-chip-icon{
  animation:habit-soft-bob 3s ease-in-out infinite;
}

.habit-dashboard .summary-card{
  overflow:hidden;
}
.habit-dashboard .summary-card::before,
.today-focus-card::before{
  transition:
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
}
.habit-dashboard .summary-card:hover::before,
.today-focus-card:hover::before{
  opacity:0.95;
  transform:translate3d(10px, -10px, 0) scale(1.03);
}
.habit-dashboard .summary-card:nth-child(6n + 1){
  animation-delay:0.08s;
}
.habit-dashboard .summary-card:nth-child(6n + 2){
  animation-delay:0.12s;
}
.habit-dashboard .summary-card:nth-child(6n + 3){
  animation-delay:0.16s;
}
.habit-dashboard .summary-card:nth-child(6n + 4){
  animation-delay:0.2s;
}
.habit-dashboard .summary-card:nth-child(6n + 5){
  animation-delay:0.24s;
}
.habit-dashboard .summary-card:nth-child(6n + 6){
  animation-delay:0.28s;
}

.summary-card:hover{
  transform:translateY(-4px);
  box-shadow:0 24px 42px rgba(15, 23, 42, 0.12);
}
.summary-card:hover .summary-icon,
.summary-card:hover .summary-card-badge,
.summary-card:hover .habit-dashboard-badge{
  transform:translateY(-1px) scale(1.04);
}

.today-focus-date-card:hover{
  transform:translateY(-3px);
  box-shadow:0 30px 60px rgba(15, 23, 42, 0.16);
}
.today-focus-date-card:hover::after{
  transform:scale(1.04);
  opacity:0.95;
}
.today-focus-completed-summary{
  transition:background 0.22s ease, transform 0.22s ease;
}
.today-focus-completed-board[open] .today-focus-completed-body,
.today-focus-completed-board[open] .today-focus-completed-actions,
.today-focus-completed-board[open] .today-focus-completed-hint{
  animation:habit-panel-reveal 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.today-focus-completed-summary:hover{
  background:color-mix(in srgb, var(--today-accent) 5%, transparent);
}
.today-focus-completed-summary:hover .today-focus-completed-icon{
  transform:scale(1.06) rotate(-6deg);
}
.today-focus-completed-summary:hover .today-focus-completed-meta{
  transform:translateY(-1px);
}
.today-focus-completed-item:hover{
  transform:translateY(-2px);
  box-shadow:0 14px 24px rgba(15, 23, 42, 0.08);
}
.today-focus-completed-item:hover .today-focus-completed-item-icon{
  transform:scale(1.08) rotate(-7deg);
}
.today-focus-completed-item:hover .today-focus-completed-item-text strong{
  transform:translateX(2px);
}
.today-focus-completed-item-text strong{
  transition:transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}

.today-focus-card{
  transform-origin:center bottom;
}
.today-focus-card:hover{
  transform:translateY(-2px);
}
.today-focus-card:hover .today-focus-icon,
.today-focus-card:focus-visible .today-focus-icon{
  transform:translateY(-1px) scale(1.02);
}
.today-focus-card:hover .today-focus-card-badge,
.today-focus-card:hover .today-focus-card-status,
.today-focus-card:hover .today-focus-hide-btn{
  transform:translateY(-1px);
}
.today-focus-hide-btn:hover,
.today-focus-completed-hide-all:hover{
  filter:brightness(1.04);
}

@media (prefers-reduced-motion: reduce){
  .controls-toggle-pill,
  .controls-shell .toolbar,
  .range-btn,
  .habit-category-chip,
  .summary-card,
  .today-focus-date-card,
  .today-focus-card,
  .today-focus-completed-board,
  .today-focus-completed-item,
  .today-focus-hide-btn,
  .today-focus-completed-hide-all,
  .today-focus-completed-meta,
  .today-focus-card-badge,
  .today-focus-card-status,
  .today-focus-stats span,
  .habit-category-chip-icon,
  .today-focus-icon,
  .today-focus-completed-item-icon{
    animation:none !important;
    transition:none !important;
  }
  .controls-toggle-pill::after,
  .habit-dashboard .summary-card::before,
  .today-focus-card::before{
    transition:none !important;
  }
}


/* Habit details modal + today card extensions */
.today-focus-card{
  grid-template-rows:auto 1fr auto;
}
.today-focus-card-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.today-focus-card-hint{
  font-size:10px;
  line-height:1.45;
  color:var(--muted);
}
.today-focus-details-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:30px;
  padding:6px 12px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--habit-accent) 28%, var(--grid));
  background:color-mix(in srgb, var(--habit-accent) 12%, var(--surface));
  color:color-mix(in srgb, var(--habit-accent) 82%, var(--text));
  font:inherit;
  font-size:10px;
  font-weight:800;
  letter-spacing:0.12em;
  text-transform:uppercase;
  cursor:pointer;
}
.today-focus-details-btn:hover{
  transform:translateY(-1px);
  border-color:color-mix(in srgb, var(--habit-accent) 42%, var(--grid));
  background:color-mix(in srgb, var(--habit-accent) 16%, var(--surface));
}
.habit-details-modal-dialog{
  width:min(1080px, 100%);
}
.habit-details-shell{
  display:grid;
  gap:14px;
}
.habit-details-hero{
  --habit-accent: var(--today-accent);
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  padding:14px;
  border-radius:20px;
  border:1px solid color-mix(in srgb, var(--habit-accent) 28%, var(--grid));
  background:linear-gradient(145deg, color-mix(in srgb, var(--habit-accent) 14%, var(--surface)), color-mix(in srgb, var(--surface-2) 92%, transparent));
}
.habit-details-pill{
  display:inline-flex;
  align-items:center;
  min-height:32px;
  padding:7px 11px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--habit-accent) 26%, var(--grid));
  background:color-mix(in srgb, var(--habit-accent) 10%, var(--surface));
  color:color-mix(in srgb, var(--habit-accent) 82%, var(--text));
  font-size:11px;
  font-weight:700;
}
.habit-details-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}
.habit-details-panel-wide{
  grid-column:1 / -1;
}
.habit-details-section-copy{
  display:grid;
  gap:4px;
  margin-bottom:10px;
  font-size:12px;
  color:var(--muted);
}
.habit-details-section-copy strong{
  color:var(--text);
  font-size:13px;
}
.habit-details-form,
.habit-details-fields{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:10px;
}
.habit-details-field{
  display:grid;
  gap:6px;
  min-width:0;
}
.habit-details-field.is-wide{
  grid-column:1 / -1;
}
.habit-details-label{
  font-size:11px;
  letter-spacing:0.08em;
  text-transform:uppercase;
  color:var(--muted);
}
.habit-details-field input,
.habit-details-field select,
.habit-details-field textarea{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--grid);
  border-radius:12px;
  background:var(--surface-2);
  color:var(--text);
  font:inherit;
}
.habit-details-field textarea{
  min-height:96px;
  resize:vertical;
}
.habit-detail-check{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--grid);
  border-radius:14px;
  background:var(--surface-2);
  font-size:12px;
  color:var(--text);
}
.habit-detail-check input{
  width:18px;
  height:18px;
  accent-color:var(--accent);
}
.habit-details-days{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  grid-column:1 / -1;
}
.habit-day-btn{
  min-width:48px;
  min-height:34px;
  padding:7px 10px;
  border-radius:12px;
  border:1px solid var(--grid);
  background:var(--surface-2);
  color:var(--muted);
  font:inherit;
  font-size:11px;
  font-weight:700;
  cursor:pointer;
}
.habit-day-btn.active{
  border-color:transparent;
  background:linear-gradient(135deg, var(--accent), #4a84ee);
  color:#fff;
}
.habit-details-log-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
  flex-wrap:wrap;
}
.habit-details-date{
  font-size:12px;
  color:var(--muted);
}
.habit-details-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.habit-details-status{
  font-size:11px;
  line-height:1.5;
  color:var(--muted);
}
@media (max-width: 860px){
  .habit-details-grid,
  .habit-details-form,
  .habit-details-fields{
    grid-template-columns:1fr;
  }
}
@media (max-width: 640px){
  .today-focus-card-footer,
  .habit-details-actions,
  .habit-details-log-head{
    flex-direction:column;
    align-items:stretch;
  }
  .today-focus-details-btn,
  .habit-details-actions .btn{
    width:100%;
  }
}

/* Budget today-first view */
.budget-view-switch{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px;
  margin:0 0 16px;
  border:1px solid var(--grid);
  border-radius:18px;
  background:var(--surface);
  box-shadow:var(--shadow);
}
.budget-view-btn{
  min-width:120px;
  font-size:12px;
  border-radius:12px;
}
.budget-view-btn.active{
  background:linear-gradient(135deg, var(--accent), #4a84ee);
  color:#fff;
  border-color:transparent;
}
.budget-view-panel{
  display:grid;
  gap:16px;
}
.budget-view-panel[hidden]{
  display:none !important;
}
.budget-grid .budget-panel-wide,
.budget-today-grid .budget-panel-wide{
  grid-column:1 / -1;
}
.budget-today-hero{
  display:grid;
  grid-template-columns:minmax(260px, 360px) minmax(0, 1fr);
  gap:12px;
  align-items:stretch;
}
.budget-today-date-card{
  position:relative;
  overflow:hidden;
  display:grid;
  gap:14px;
  align-content:space-between;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 22%, transparent), transparent 42%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), color-mix(in srgb, var(--surface) 90%, transparent));
  border-color:color-mix(in srgb, var(--accent) 32%, var(--grid));
}
.budget-today-date-main{
  display:flex;
  align-items:flex-end;
  gap:14px;
}
.budget-today-date-number{
  font-size:76px;
  line-height:0.88;
  font-weight:800;
  color:var(--text);
}
.budget-today-date-side{
  display:grid;
  gap:4px;
}
.budget-today-date-month{
  font-size:24px;
  font-weight:700;
}
.budget-today-date-full,
.budget-today-date-note{
  font-size:12px;
  line-height:1.6;
  color:var(--muted);
}
.budget-today-summary .card{
  min-height:118px;
}
.budget-today-grid{
  display:grid;
  gap:12px;
  grid-template-columns:repeat(12, minmax(0, 1fr));
}
.budget-quick-panel{
  grid-column:span 5;
}
.budget-today-timeline-panel{
  grid-column:span 7;
}
.budget-today-categories-panel{
  grid-column:span 5;
}
.budget-month-pulse-panel{
  grid-column:span 7;
}
.budget-entry-types{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:8px;
}
.budget-entry-type-btn{
  min-height:42px;
  font-size:12px;
}
.budget-entry-type-btn.active{
  background:linear-gradient(135deg, var(--accent), #4a84ee);
  color:#fff;
  border-color:transparent;
}
.budget-field-wide{
  grid-column:1 / -1;
}
.budget-row-advanced[hidden]{
  display:none !important;
}
.budget-quick-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.budget-feed{
  display:grid;
  gap:10px;
}
.budget-feed-item{
  display:grid;
  grid-template-columns:auto minmax(0, 1fr) auto;
  gap:12px;
  align-items:center;
  padding:12px 14px;
  border:1px solid var(--grid);
  border-radius:16px;
  background:var(--surface-2);
}
.budget-feed-item.is-expense{
  box-shadow:inset 4px 0 0 rgba(224, 90, 90, 0.65);
}
.budget-feed-item.is-income,
.budget-feed-item.is-credit{
  box-shadow:inset 4px 0 0 rgba(47, 125, 120, 0.7);
}
.budget-feed-item.is-debt{
  box-shadow:inset 4px 0 0 rgba(240, 173, 78, 0.75);
}
.budget-feed-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:6px 10px;
  border-radius:999px;
  background:var(--surface);
  border:1px solid var(--grid);
  font-size:10px;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:var(--muted);
  font-weight:700;
}
.budget-feed-copy strong{
  display:block;
  font-size:13px;
  font-weight:700;
}
.budget-feed-copy span{
  display:block;
  margin-top:4px;
  font-size:11px;
  line-height:1.5;
  color:var(--muted);
}
.budget-feed-side{
  display:grid;
  gap:8px;
  justify-items:end;
}
.budget-feed-amount{
  font-size:13px;
  font-weight:700;
}
.budget-feed-amount.positive{
  color:#1b7a3c;
}
.budget-feed-amount.negative{
  color:#b54747;
}
.budget-inline-list{
  display:grid;
  gap:10px;
}
.budget-inline-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border:1px solid var(--grid);
  border-radius:14px;
  background:var(--surface-2);
}
.budget-inline-item strong{
  font-size:13px;
}
.budget-inline-item span{
  font-size:12px;
  font-weight:700;
  color:var(--muted);
}
.budget-pulse-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:10px;
}
.budget-pulse-card{
  min-height:110px;
  padding:14px;
  border:1px solid var(--grid);
  border-radius:16px;
  background:var(--surface-2);
  display:grid;
  gap:10px;
  align-content:space-between;
}
.budget-pulse-card span{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.08em;
  color:var(--muted);
}
.budget-pulse-card strong{
  font-size:18px;
  line-height:1.35;
}
.budget-debt-overview{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:10px;
  margin-bottom:12px;
}
.budget-debt-stat{
  padding:12px 14px;
  border:1px solid var(--grid);
  border-radius:14px;
  background:var(--surface-2);
  display:grid;
  gap:6px;
}
.budget-debt-stat span{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.08em;
  color:var(--muted);
}
.budget-debt-stat strong{
  font-size:16px;
  line-height:1.4;
}
.budget-debt-list{
  display:grid;
  gap:10px;
  grid-template-columns:repeat(auto-fit, minmax(230px, 1fr));
}
.budget-debt-card{
  display:grid;
  gap:10px;
}
.budget-debt-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.budget-kind-pill,
.budget-status-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:6px 10px;
  border-radius:999px;
  font-size:10px;
  letter-spacing:0.12em;
  text-transform:uppercase;
  font-weight:700;
}
.budget-kind-pill.is-debt{
  background:rgba(224, 90, 90, 0.12);
  color:#b54747;
  border:1px solid rgba(224, 90, 90, 0.24);
}
.budget-kind-pill.is-credit{
  background:rgba(47, 125, 120, 0.12);
  color:#2f7d78;
  border:1px solid rgba(47, 125, 120, 0.24);
}
.budget-debt-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.budget-status-pill{
  background:var(--surface);
  color:var(--muted);
  border:1px solid var(--grid);
}
.budget-status-pill.is-overdue{
  background:rgba(224, 90, 90, 0.12);
  color:#b54747;
  border-color:rgba(224, 90, 90, 0.24);
}
.budget-status-pill.is-due{
  background:rgba(240, 173, 78, 0.18);
  color:#a06410;
  border-color:rgba(240, 173, 78, 0.28);
}
.budget-status-pill.is-soon{
  background:rgba(74, 168, 161, 0.12);
  color:#2f7d78;
  border-color:rgba(74, 168, 161, 0.24);
}
.budget-status-pill.is-planned{
  background:var(--surface-2);
}
.budget-month-card{
  cursor:pointer;
  text-align:left;
}
.budget-month-card.active{
  border-color:color-mix(in srgb, var(--accent) 52%, var(--grid));
  background:color-mix(in srgb, var(--accent) 10%, var(--surface-2));
}
.budget-month-card:hover{
  transform:translateY(-1px);
}
@media (max-width: 1160px){
  .budget-today-hero{
    grid-template-columns:1fr;
  }
  .budget-quick-panel,
  .budget-today-timeline-panel,
  .budget-today-categories-panel,
  .budget-month-pulse-panel{
    grid-column:1 / -1;
  }
  .budget-debt-overview{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 820px){
  .budget-entry-types,
  .budget-pulse-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  .budget-feed-item{
    grid-template-columns:1fr;
    align-items:flex-start;
  }
  .budget-feed-side{
    justify-items:start;
  }
  .budget-debt-list{
    grid-template-columns:1fr;
  }
}
@media (max-width: 620px){
  .budget-view-switch{
    display:flex;
    width:100%;
  }
  .budget-view-btn{
    flex:1 1 0;
    min-width:0;
  }
  .budget-today-date-main{
    flex-direction:column;
    align-items:flex-start;
    gap:8px;
  }
  .budget-today-date-number{
    font-size:56px;
  }
  .budget-entry-types,
  .budget-pulse-grid,
  .budget-debt-overview{
    grid-template-columns:1fr;
  }
  .budget-quick-footer{
    align-items:stretch;
  }
  .budget-quick-footer .btn{
    width:100%;
  }
}

/* Responsive refinement layer */
@media (max-width: 980px){
  .projects-head,
  .ai-panel-head,
  .ai-modal-head{
    align-items:flex-start;
  }
  .budget-actions{
    width:100%;
    flex-wrap:wrap;
  }
  .budget-actions .field{
    flex:1 1 220px;
    min-width:0;
  }
  .budget-filters{
    align-items:stretch;
  }
  .budget-filters .btn,
  .budget-filters .select{
    flex:1 1 160px;
  }
  .budget-table,
  .project-table{
    min-width:760px;
  }
  .budget-table-wrap,
  .table-wrap,
  .footer-table,
  .ai-modal-chat-body,
  .ai-panel-body{
    -webkit-overflow-scrolling:touch;
  }
  .budget-month-bar{
    flex-wrap:nowrap;
    overflow:auto;
    justify-content:flex-start;
    scrollbar-width:thin;
  }
  .budget-month-btn{
    flex:0 0 auto;
  }
  .project-task-item{
    align-items:flex-start;
    flex-direction:column;
  }
  .project-task-actions{
    width:100%;
    justify-content:flex-end;
    flex-wrap:wrap;
  }
  .ai-modal-actions,
  .ai-panel-actions{
    flex-wrap:wrap;
  }
}

@media (max-width: 720px){
  .wrap{
    padding:16px 12px 28px;
  }
  .panel,
  .card,
  .modal-dialog,
  .ai-modal-dialog{
    border-radius:16px;
  }
  .projects-head{
    align-items:stretch;
  }
  .projects-head > div,
  .budget-actions{
    width:100%;
  }
  .budget-actions{
    flex-direction:column;
    align-items:stretch;
  }
  .budget-actions .field,
  .budget-actions .btn{
    width:100%;
  }
  .budget-filters{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  .budget-filters .select{
    grid-column:1 / -1;
    width:100%;
  }
  .budget-category-top,
  .budget-category-meta,
  .budget-debt-head,
  .budget-debt-footer{
    flex-direction:column;
    align-items:flex-start;
  }
  .budget-feed-side{
    width:100%;
    justify-items:stretch;
  }
  .budget-feed-side .btn,
  .project-task-actions .btn,
  .ai-panel-input .btn{
    width:100%;
  }
  .ai-panel-head,
  .ai-modal-head,
  .ai-panel-input{
    flex-direction:column;
    align-items:stretch;
  }
  .ai-panel-actions,
  .ai-modal-actions{
    width:100%;
    justify-content:stretch;
  }
  .ai-panel-actions .btn,
  .ai-modal-actions .btn{
    flex:1 1 auto;
  }
  .ai-modal-chat .ai-panel-input{
    flex-direction:column;
    align-items:stretch;
  }
  .summary .card,
  .budget-summary .card{
    min-width:0;
  }
  .project-table th:first-child,
  .project-table td:first-child{
    min-width:160px;
  }
}

@media (max-width: 560px){
  .budget-filters{
    grid-template-columns:1fr;
  }
  .budget-filters .btn,
  .budget-filters .select{
    width:100%;
  }
  .budget-table,
  .project-table{
    min-width:640px;
  }
  .project-task-actions{
    justify-content:stretch;
  }
  .project-task-actions .btn{
    flex:1 1 auto;
  }
  .ai-fab-wrap{
    left:12px;
    right:12px;
    bottom:12px;
    align-items:stretch;
  }
  .ai-panel{
    width:100%;
  }
}

/* Shared dashboard layer + budget monthly containment + projects cards view */
.section.active,
.dashboard-shell{
  position:relative;
  min-width:0;
}
.section.active > *,
.dashboard-shell > *{
  min-width:0;
}
.section.active .summary .card,
.section.active .panel,
.section.active .table-wrap:not(.today-view),
.section.active .footer-table{
  border-color:color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--today-accent, var(--accent)) 10%, transparent), transparent 30%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, transparent), color-mix(in srgb, var(--surface-2) 84%, var(--surface) 16%));
  box-shadow:0 22px 48px rgba(15, 23, 42, 0.1);
}
.projects-hero{
  position:relative;
  display:flex;
  flex-wrap:wrap;
  gap:18px;
  align-items:flex-end;
  justify-content:space-between;
  padding:26px 28px;
  margin-bottom:16px;
  border:1px solid color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  border-radius:30px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--today-accent, var(--accent)) 16%, transparent), transparent 32%),
    radial-gradient(circle at bottom left, color-mix(in srgb, var(--accent) 12%, transparent), transparent 36%),
    linear-gradient(135deg, color-mix(in srgb, var(--today) 72%, var(--surface) 28%), color-mix(in srgb, var(--surface) 92%, var(--surface-2) 8%));
  box-shadow:0 26px 56px rgba(15, 23, 42, 0.12);
  overflow:hidden;
  isolation:isolate;
}
.projects-hero::after{
  content:"";
  position:absolute;
  inset:auto -54px -84px auto;
  width:220px;
  height:220px;
  border-radius:50%;
  background:radial-gradient(circle, color-mix(in srgb, var(--today-accent, var(--accent)) 20%, transparent), transparent 68%);
  pointer-events:none;
}
.projects-hero > *{
  position:relative;
  z-index:1;
}
.projects-head-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}
.project-view-switch{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px;
  border:1px solid color-mix(in srgb, var(--grid) 78%, var(--surface) 22%);
  border-radius:18px;
  background:rgba(255, 255, 255, 0.28);
  backdrop-filter:blur(10px);
}
.project-view-btn{
  min-width:96px;
  border-radius:12px;
}
.project-view-btn.active{
  background:linear-gradient(135deg, var(--accent), #4a84ee);
  color:#fff;
  border-color:transparent;
}
.projects-dashboard-summary{
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:14px;
}
.projects-dashboard-summary .card{
  min-height:112px;
}
.project-surface{
  padding:22px;
  border-radius:30px;
  overflow:visible;
}
.project-surface[data-project-view="table"]{
  padding:0;
  overflow:auto;
}
.projects-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(290px, 1fr));
  gap:18px;
}
.project-card{
  position:relative;
  display:grid;
  gap:18px;
  min-height:320px;
  padding:22px;
  border:1px solid color-mix(in srgb, var(--grid) 72%, var(--surface) 28%);
  border-radius:28px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--today-accent, var(--accent)) 14%, transparent), transparent 30%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, transparent), color-mix(in srgb, var(--surface-2) 84%, var(--surface) 16%));
  box-shadow:0 24px 48px rgba(15, 23, 42, 0.1);
  overflow:hidden;
}
.project-card::before{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(145deg, color-mix(in srgb, #ffffff 12%, transparent), transparent 56%);
  pointer-events:none;
}
.project-card > *{
  position:relative;
  z-index:1;
}
.project-card.is-overdue{
  border-color:rgba(224, 90, 90, 0.28);
  box-shadow:0 26px 52px rgba(181, 71, 71, 0.12);
}
.project-card.is-complete{
  background:
    radial-gradient(circle at top right, rgba(47, 125, 120, 0.14), transparent 32%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--today) 34%, var(--surface) 66%));
}
.project-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}
.project-card-copy{
  display:grid;
  gap:8px;
}
.project-card-eyebrow{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.16em;
  color:var(--today-accent, var(--accent));
  font-weight:800;
}
.project-card-title{
  margin:0;
  font-family:"Sora", "Space Grotesk", "Segoe UI", "Trebuchet MS", sans-serif;
  font-size:24px;
  line-height:1.06;
  letter-spacing:-0.03em;
  color:var(--text);
}
.project-card-note{
  margin:0;
  font-size:13px;
  line-height:1.65;
  color:var(--muted);
}
.project-card-badges{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:flex-end;
}
.project-card-stats{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:10px;
}
.project-card-stat{
  display:grid;
  gap:6px;
  min-height:88px;
  padding:12px 14px;
  border:1px solid color-mix(in srgb, var(--grid) 80%, var(--surface) 20%);
  border-radius:16px;
  background:color-mix(in srgb, var(--surface) 72%, var(--surface-2) 28%);
}
.project-card-stat span{
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:0.12em;
  color:var(--muted);
  font-weight:700;
}
.project-card-stat strong{
  font-size:14px;
  line-height:1.45;
  color:var(--text);
}
.project-card-stat.is-overdue strong{
  color:var(--danger-text);
}
.project-card-progress{
  display:grid;
  gap:8px;
}
.project-card-progress-top,
.project-card-task-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.project-card-progress-top span,
.project-card-task-head span{
  font-size:12px;
  color:var(--muted);
}
.project-card-progress-top strong,
.project-card-task-head strong{
  font-size:13px;
  color:var(--text);
}
.project-card-task-block,
.project-card-task-list{
  display:grid;
  gap:10px;
}
.project-card-task{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:11px 12px;
  border:1px solid color-mix(in srgb, var(--grid) 82%, var(--surface) 18%);
  border-radius:14px;
  background:color-mix(in srgb, var(--surface) 72%, var(--surface-2) 28%);
  font-size:12px;
  line-height:1.5;
  color:var(--text);
}
.project-card-task::before{
  content:"";
  width:10px;
  height:10px;
  margin-top:4px;
  border-radius:50%;
  background:var(--today-accent, var(--accent));
  flex:0 0 10px;
  box-shadow:0 0 0 5px rgba(59, 130, 246, 0.1);
}
.project-card-task.is-done{
  opacity:0.72;
}
.project-card-task.is-done::before{
  background:#22c55e;
  box-shadow:0 0 0 5px rgba(34, 197, 94, 0.1);
}
.project-card-empty{
  padding:14px;
  border:1px dashed color-mix(in srgb, var(--grid) 82%, var(--surface) 18%);
  border-radius:14px;
  background:color-mix(in srgb, var(--surface) 64%, var(--surface-2) 36%);
  color:var(--muted);
  font-size:12px;
  line-height:1.55;
}
.project-card-actions,
.project-actions-table{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.project-card-actions{
  margin-top:auto;
}
.project-card-actions .btn,
.project-actions-table .btn{
  flex:1 1 120px;
}

#section-budget{
  overflow-x:hidden;
}
#section-budget .budget-view-panel[data-budget-view-panel="monthly"]{
  min-width:0;
  width:100%;
  overflow-x:hidden;
}
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] > *,
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .panel,
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-toolbar,
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-summary,
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-grid,
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-month-grid,
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-table-wrap,
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .table-wrap{
  min-width:0;
  max-width:100%;
}
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-toolbar{
  overflow:hidden;
}
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-toolbar > *,
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-filters > *{
  min-width:0;
}
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-grid{
  grid-template-columns:repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-month-grid{
  grid-template-columns:repeat(auto-fit, minmax(min(180px, 100%), 1fr));
}
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-row{
  grid-template-columns:repeat(auto-fit, minmax(min(160px, 100%), 1fr));
}
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-month-bar{
  width:100%;
  min-width:0;
  max-width:100%;
  flex-wrap:nowrap;
  justify-content:flex-start;
  overflow-x:auto;
  overflow-y:hidden;
  scrollbar-width:thin;
}
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-month-btn{
  flex:0 0 auto;
}
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-table-wrap,
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .table-wrap{
  width:100%;
  overflow-x:auto;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
}
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-table,
#section-budget .budget-view-panel[data-budget-view-panel="monthly"] .project-table{
  width:max-content;
  min-width:720px;
}

@media (max-width: 980px){
  .projects-hero{
    padding:24px;
  }
  .project-surface{
    padding:18px;
  }
  .project-card-stats{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px){
  .projects-hero{
    padding:20px;
    border-radius:24px;
  }
  .projects-head-actions,
  .project-view-switch,
  .project-view-btn,
  #manageProjectsBtn{
    width:100%;
  }
  .project-view-switch{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  .project-surface{
    padding:16px;
    border-radius:24px;
  }
  .projects-grid,
  .project-card-stats{
    grid-template-columns:1fr;
  }
  .project-card-head,
  .project-card-badges,
  .project-card-progress-top,
  .project-card-task-head{
    flex-direction:column;
    align-items:flex-start;
  }
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-summary{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px){
  .project-card{
    padding:18px;
    border-radius:22px;
  }
  .project-card-actions .btn,
  .project-actions-table .btn{
    flex:1 1 100%;
  }
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-summary,
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-grid,
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-month-grid,
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-filters{
    grid-template-columns:1fr;
  }
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-filters{
    display:grid;
  }
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-filters .btn,
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-filters .select,
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-nav{
    width:100%;
  }
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-toolbar{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .budget-table,
  #section-budget .budget-view-panel[data-budget-view-panel="monthly"] .project-table{
    min-width:640px;
  }
}

/* 2026-04 nav refresh + habit manage UX */
.main-nav{
  position:sticky;
  top:16px;
  z-index:45;
  grid-template-columns:minmax(0, auto) minmax(0, 1fr);
  gap:18px;
  padding:16px 18px;
  margin-bottom:24px;
  border:1px solid color-mix(in srgb, var(--accent) 14%, var(--grid));
  border-radius:28px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 16%, transparent), transparent 38%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 94%, transparent));
  box-shadow:0 24px 50px rgba(15, 23, 42, 0.1);
  backdrop-filter:blur(20px) saturate(160%);
  overflow:visible;
}
.main-nav::before{
  content:"";
  position:absolute;
  inset:1px;
  border-radius:26px;
  background:linear-gradient(135deg, rgba(255,255,255,0.34), transparent 28%, transparent 68%, rgba(255,255,255,0.1));
  pointer-events:none;
}
.main-nav::after{
  left:16px;
  right:16px;
  bottom:-1px;
  height:1px;
  border-radius:999px;
  background:linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 55%, transparent), transparent);
  box-shadow:none;
}
.brand{
  gap:14px;
  min-width:0;
  position:relative;
  z-index:1;
}
.brand > div{
  display:grid;
  gap:3px;
}
.brand .eyebrow{
  font-size:10px;
  font-weight:700;
  letter-spacing:0.26em;
}
.brand-mark{
  width:48px;
  height:48px;
  border-radius:18px;
  background:linear-gradient(145deg, color-mix(in srgb, var(--accent) 88%, white 12%), #4a84ee 62%, #8bd7c4 100%);
  box-shadow:0 18px 30px rgba(47, 111, 228, 0.2);
  overflow:hidden;
  animation:brandPulse 8s ease-in-out infinite;
}
.brand-mark::before{
  content:"";
  position:absolute;
  inset:6px;
  border-radius:12px;
  background:linear-gradient(180deg, rgba(255,255,255,0.45), transparent 68%);
}
.brand-mark::after{
  font-size:17px;
  font-weight:800;
  letter-spacing:0.12em;
  text-shadow:0 10px 24px rgba(9, 23, 50, 0.28);
}
.brand-title{
  font-size:20px;
  letter-spacing:-0.03em;
}
.nav-actions{
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  align-items:center;
  gap:12px;
}
.nav-switcher{
  gap:8px;
  padding:7px;
  border-radius:20px;
  border:1px solid color-mix(in srgb, var(--accent) 10%, var(--grid));
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 76%, transparent), color-mix(in srgb, var(--surface-2) 92%, transparent));
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.38), 0 14px 28px rgba(15, 23, 42, 0.06);
  min-width:0;
  overflow-x:auto;
  overflow-y:hidden;
}
.nav-btn{
  min-height:44px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 16px;
  border-radius:15px;
  border:1px solid transparent;
  background:transparent;
  color:color-mix(in srgb, var(--muted) 90%, var(--text));
  font-size:11px;
  font-weight:700;
  letter-spacing:0.12em;
  text-transform:uppercase;
}
.nav-btn::before{
  inset:0;
  left:0;
  right:0;
  bottom:0;
  height:auto;
  border-radius:inherit;
  background:linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
  opacity:0;
  transform:none;
  transition:opacity 0.2s ease;
}
.nav-btn::after{
  content:"";
  position:absolute;
  left:14px;
  right:14px;
  bottom:8px;
  height:2px;
  border-radius:999px;
  background:linear-gradient(90deg, transparent, rgba(255,255,255,0.92), transparent);
  opacity:0;
  transform:scaleX(0.5);
  transition:opacity 0.2s ease, transform 0.2s ease;
}
.nav-btn:hover,
.nav-btn:focus-visible{
  color:var(--text);
  border-color:color-mix(in srgb, var(--accent) 24%, var(--grid));
  background:color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow:0 12px 24px rgba(15, 23, 42, 0.08);
  transform:translateY(-1px);
}
.nav-btn:hover::before,
.nav-btn:focus-visible::before{
  opacity:1;
}
.nav-btn.active,
.nav-btn[aria-current="page"]{
  color:#fff;
  border-color:transparent;
  background:linear-gradient(135deg, color-mix(in srgb, var(--accent) 84%, white 8%), #4a84ee);
  box-shadow:0 16px 28px rgba(47, 111, 228, 0.22);
}
.nav-btn.active::before,
.nav-btn[aria-current="page"]::before{
  opacity:0.4;
}
.nav-btn.active::after,
.nav-btn[aria-current="page"]::after{
  opacity:1;
  transform:scaleX(1);
}
.nav-tool{
  margin-left:0;
}
.theme-toggle.nav-ghost{
  width:44px;
  height:44px;
  border-radius:15px;
  border-color:color-mix(in srgb, var(--accent) 14%, var(--grid));
  background:color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow:none;
}
.ai-nav-btn{
  min-height:46px;
  padding:10px 14px;
  border-radius:16px;
}
.nav-toggle{
  min-height:44px;
  border-radius:15px;
  border-color:color-mix(in srgb, var(--accent) 14%, var(--grid));
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 78%, transparent), color-mix(in srgb, var(--surface-2) 94%, transparent));
  box-shadow:none;
  font-size:11px;
  font-weight:700;
  letter-spacing:0.14em;
  text-transform:uppercase;
}
.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after{
  width:16px;
}

.habit-hero{
  gap:18px;
}
.habit-hero-top{
  width:100%;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:18px;
}
.habit-hero-actions{
  display:grid;
  justify-items:end;
  gap:10px;
  flex:0 0 auto;
}
.habit-hero-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid color-mix(in srgb, var(--accent) 24%, var(--grid));
  background:color-mix(in srgb, var(--accent) 10%, var(--surface));
  color:color-mix(in srgb, var(--accent-2) 82%, var(--text));
  font-size:11px;
  font-weight:700;
  letter-spacing:0.08em;
  text-transform:uppercase;
}
.habit-hero-chip-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:linear-gradient(135deg, var(--accent), #4a84ee);
  box-shadow:0 0 0 5px color-mix(in srgb, var(--accent) 15%, transparent);
}
.habit-manage-btn{
  min-height:48px;
  padding:12px 18px;
  border-radius:16px;
  font-size:11px;
  font-weight:800;
  letter-spacing:0.12em;
  text-transform:uppercase;
  box-shadow:0 18px 36px rgba(47, 111, 228, 0.24);
}
.habit-manage-btn:hover{
  transform:translateY(-2px);
}

.habit-modal-dialog{
  width:min(1240px, calc(100vw - 32px));
  height:min(90vh, 920px);
  max-height:min(90vh, 920px);
  padding:18px;
  display:grid;
  grid-template-rows:auto 1fr;
  gap:0;
  overflow:hidden;
  border-radius:28px;
  border:1px solid color-mix(in srgb, var(--accent) 14%, var(--grid));
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 98%, transparent), color-mix(in srgb, var(--surface-2) 96%, transparent));
  box-shadow:0 32px 70px rgba(15, 23, 42, 0.16);
}
#habitModal .modal-head{
  position:relative;
  z-index:1;
  margin-bottom:16px;
  padding-bottom:14px;
  border-bottom:1px solid color-mix(in srgb, var(--accent) 12%, var(--grid));
}
.manage{
  display:grid;
  grid-template-rows:auto auto auto 1fr;
  gap:14px;
  min-height:0;
}
.manage-head{
  align-items:start;
  gap:14px 20px;
}
.manage-head > div:first-child{
  max-width:560px;
}
.manage-overview-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
  flex:1 1 560px;
  min-width:min(100%, 420px);
}
.manage-overview-card{
  display:grid;
  gap:6px;
  min-height:120px;
  padding:14px 16px;
  border-radius:20px;
  border:1px solid color-mix(in srgb, var(--accent) 12%, var(--grid));
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 98%, transparent));
}
.manage-overview-card strong{
  font-size:24px;
  line-height:1.08;
  color:var(--text);
}
.manage-overview-label{
  font-size:11px;
  font-weight:700;
  letter-spacing:0.12em;
  text-transform:uppercase;
  color:var(--muted);
}
.manage-overview-note{
  font-size:12px;
  line-height:1.5;
  color:var(--muted);
}
.manage-overview-card-accent{
  border-color:color-mix(in srgb, var(--accent) 34%, var(--grid));
  background:linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--surface)), color-mix(in srgb, #4a84ee 14%, var(--surface)));
}
.manage-composer{
  margin:0;
  padding:16px;
  border-radius:22px;
  border-color:color-mix(in srgb, var(--accent) 18%, var(--grid));
  background:linear-gradient(135deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 94%, transparent));
}
.manage-composer .row{
  align-items:end;
}
.manage-composer #newHabit,
.manage-composer .category-field select,
.manage-composer .btn{
  min-height:48px;
}
.manage-composer #newHabit,
.manage-composer .category-field select{
  width:100%;
  padding:12px 14px;
  border:1px solid color-mix(in srgb, var(--accent) 12%, var(--grid));
  border-radius:14px;
  background:color-mix(in srgb, var(--surface) 84%, transparent);
  color:var(--text);
  font:inherit;
}
.manage-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  padding:6px;
  border:1px solid color-mix(in srgb, var(--accent) 12%, var(--grid));
  border-radius:18px;
  background:color-mix(in srgb, var(--surface) 92%, transparent);
}
.manage-tab{
  flex:1 1 180px;
  min-height:46px;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid transparent;
  background:transparent;
  color:var(--muted);
  font:inherit;
  font-size:11px;
  font-weight:800;
  letter-spacing:0.1em;
  text-transform:uppercase;
  cursor:pointer;
  transition:transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.manage-tab:hover{
  color:var(--text);
  background:color-mix(in srgb, var(--surface) 90%, transparent);
}
.manage-tab.active,
.manage-tab[aria-selected="true"]{
  color:#fff;
  border-color:transparent;
  background:linear-gradient(135deg, color-mix(in srgb, var(--accent) 84%, white 8%), #4a84ee);
  box-shadow:0 14px 24px rgba(47, 111, 228, 0.2);
}
.manage-panels{
  min-height:0;
}
.manage-panel{
  height:100%;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:12px;
  padding:16px;
  border-radius:24px;
  border-color:color-mix(in srgb, var(--accent) 12%, var(--grid));
  background:linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 98%, transparent));
  overflow:hidden;
}
.manage-panel[hidden]{
  display:none !important;
}
.manage-panel .panel-title{
  margin-bottom:0;
}
.manage-panel .habit-list,
.manage-panel .habit-library{
  flex:1 1 auto;
  max-height:none;
  padding-right:6px;
}
.manage-panel .habit-item{
  padding:10px 12px;
  border-radius:16px;
}
.manage-panel .habit-actions .btn{
  border-radius:12px;
}

@media (max-width: 980px){
  .main-nav{
    top:10px;
    padding:14px;
    border-radius:24px;
  }
  .main-nav::before{
    border-radius:22px;
  }
  .nav-actions{
    grid-template-columns:1fr auto;
    align-items:start;
  }
  .nav-toggle{
    display:inline-flex;
    grid-column:1;
    grid-row:1;
    justify-self:start;
  }
  .nav-switcher{
    grid-column:1 / -1;
    grid-row:2;
    display:grid;
    grid-template-columns:1fr;
    gap:8px;
    max-height:0;
    padding:0 8px;
    opacity:0;
    overflow:hidden;
    transform:translateY(-10px);
    transition:max-height 0.28s ease, opacity 0.2s ease, transform 0.28s ease, padding 0.28s ease;
  }
  .main-nav:not(.nav-open) .nav-switcher{
    border-color:transparent;
    background:transparent;
    box-shadow:none;
  }
  .main-nav.nav-open .nav-switcher{
    max-height:75vh;
    padding:10px;
    opacity:1;
    overflow:auto;
    transform:translateY(0);
  }
  .nav-switcher .nav-btn,
  .nav-switcher .theme-toggle{
    width:100%;
  }
  .theme-toggle.nav-ghost{
    width:100%;
  }
  .ai-nav-btn{
    grid-column:2;
    grid-row:1;
    justify-self:end;
    margin:0;
  }
  .habit-hero-top,
  .manage-head{
    flex-direction:column;
    align-items:stretch;
  }
  .habit-hero-actions{
    width:100%;
    justify-items:stretch;
  }
  .habit-manage-btn{
    width:100%;
  }
  .manage-overview-grid{
    grid-template-columns:1fr;
    min-width:0;
  }
}

@media (max-width: 720px){
  #habitModal{
    padding:0;
  }
  .habit-modal-dialog{
    width:100vw;
    height:100dvh;
    max-height:none;
    border-radius:0;
    padding:14px 14px 16px;
  }
  .manage{
    gap:12px;
  }
  .manage-tabs{
    flex-wrap:nowrap;
    overflow:auto;
  }
  .manage-tab{
    flex:0 0 auto;
    min-width:160px;
  }
  .manage-composer .row{
    flex-direction:column;
    align-items:stretch;
  }
  .manage-composer .field,
  .manage-composer .btn{
    width:100%;
  }
  .manage-panel{
    padding:14px;
    border-radius:20px;
  }
}

@media (max-width: 640px){
  .main-nav{
    border-radius:20px;
  }
  .brand-title{
    font-size:18px;
  }
  .nav-toggle-text{
    display:inline;
    font-size:10px;
  }
  .ai-nav-btn .ai-fab-text{
    display:none;
  }
}

@media (prefers-reduced-motion: reduce){
  .main-nav,
  .brand-mark,
  .nav-btn,
  .manage-tab,
  .habit-manage-btn{
    animation:none !important;
    transition:none !important;
  }
}

@keyframes brandPulse{
  0%, 100%{ transform:translateY(0); }
  50%{ transform:translateY(-2px); }
}

/* 2026-04 simple header reset */
.main-nav{
  position:sticky;
  top:12px;
  z-index:45;
  display:grid;
  grid-template-columns:minmax(0, auto) minmax(0, 1fr);
  align-items:center;
  gap:16px;
  padding:14px 16px;
  margin-bottom:20px;
  border:1px solid var(--grid);
  border-radius:18px;
  background:color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow:0 12px 28px rgba(15, 23, 42, 0.08);
  backdrop-filter:blur(10px);
  overflow:visible;
}
.main-nav::before,
.main-nav::after{
  display:none;
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}
.brand > div{
  display:grid;
  gap:2px;
  min-width:0;
}
.brand .eyebrow{
  font-size:10px;
  font-weight:700;
  letter-spacing:0.16em;
}
.brand-mark{
  width:42px;
  height:42px;
  border-radius:12px;
  background:linear-gradient(135deg, var(--accent), #4a84ee);
  box-shadow:0 8px 20px rgba(47, 111, 228, 0.18);
  overflow:hidden;
  animation:none;
  transition:transform 0.2s ease, box-shadow 0.2s ease;
}
.brand:hover .brand-mark{
  transform:translateY(-1px);
  box-shadow:0 12px 24px rgba(47, 111, 228, 0.2);
}
.brand-mark::before{
  display:none;
}
.brand-mark::after{
  font-size:16px;
  font-weight:800;
  text-shadow:none;
}
.brand-title{
  font-size:18px;
  line-height:1.1;
  letter-spacing:-0.02em;
}
.nav-actions{
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}
.nav-switcher{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:8px;
  flex:1 1 auto;
  min-width:0;
  padding:0;
  border:none;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  overflow:visible;
}
.nav-btn{
  min-height:40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:9px 14px;
  border-radius:12px;
  border:1px solid transparent;
  background:transparent;
  color:var(--muted);
  font-size:12px;
  font-weight:600;
  letter-spacing:0.01em;
  text-transform:none;
  box-shadow:none;
}
.nav-btn::before,
.nav-btn::after{
  display:none;
}
.nav-btn:hover,
.nav-btn:focus-visible{
  color:var(--text);
  background:var(--surface-2);
  border-color:var(--grid);
  box-shadow:none;
  transform:translateY(-1px);
}
.nav-btn.active,
.nav-btn[aria-current="page"]{
  color:var(--text);
  border-color:color-mix(in srgb, var(--accent) 30%, var(--grid));
  background:color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow:none;
}
.nav-tool{
  margin-left:0;
}
.theme-toggle.nav-ghost{
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid var(--grid);
  background:var(--surface-2);
}
.ai-nav-btn{
  min-height:40px;
  padding:9px 12px;
  border-radius:12px;
  font-size:11px;
  letter-spacing:0.08em;
  box-shadow:none;
}
.ai-nav-btn:hover{
  box-shadow:none;
}
.nav-toggle{
  min-height:40px;
  padding:8px 12px;
  border-radius:12px;
  border:1px solid var(--grid);
  background:var(--surface-2);
  box-shadow:none;
  font-size:11px;
  font-weight:700;
  letter-spacing:0.04em;
  text-transform:none;
}
.nav-toggle-text{
  display:inline;
}
.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after{
  width:16px;
}

@media (max-width: 980px){
  .main-nav{
    grid-template-columns:minmax(0, 1fr) auto;
    gap:12px;
    padding:12px;
    border-radius:16px;
  }
  .nav-actions{
    display:grid;
    grid-template-columns:auto auto;
    justify-content:end;
    align-items:center;
    gap:8px;
  }
  .nav-toggle{
    display:inline-flex;
    grid-column:1;
    grid-row:1;
  }
  .ai-nav-btn{
    grid-column:2;
    grid-row:1;
    min-width:44px;
    justify-content:center;
  }
  .nav-switcher{
    grid-column:1 / -1;
    grid-row:2;
    flex:none;
    width:min(100%, 320px);
    justify-self:end;
    display:flex;
    flex-direction:column;
    align-items:stretch;
    gap:8px;
    max-height:0;
    margin-top:0;
    padding:0;
    border:0 solid transparent;
    border-radius:16px;
    background:var(--surface);
    box-shadow:none;
    opacity:0;
    overflow:hidden;
    pointer-events:none;
    transform:translateY(-8px);
    transition:max-height 0.22s ease, opacity 0.18s ease, transform 0.22s ease, padding 0.22s ease, border-width 0.22s ease, margin-top 0.22s ease;
  }
  .main-nav.nav-open .nav-switcher{
    max-height:70vh;
    margin-top:8px;
    padding:10px;
    border-width:1px;
    border-color:var(--grid);
    box-shadow:0 16px 28px rgba(15, 23, 42, 0.12);
    opacity:1;
    overflow:auto;
    pointer-events:auto;
    transform:translateY(0);
  }
  .nav-switcher .nav-btn,
  .nav-switcher .theme-toggle{
    width:100%;
  }
  .nav-switcher .nav-btn{
    justify-content:flex-start;
  }
  .theme-toggle.nav-ghost{
    width:100%;
  }
}

@media (max-width: 640px){
  .main-nav{
    top:8px;
  }
  .brand-title{
    font-size:17px;
  }
  .brand .eyebrow{
    letter-spacing:0.12em;
  }
  .nav-toggle-text{
    font-size:11px;
  }
  .ai-nav-btn .ai-fab-text{
    display:none;
  }
  .nav-switcher{
    width:min(100vw - 24px, 320px);
  }
}

@media (prefers-reduced-motion: reduce){
  .brand-mark,
  .nav-switcher,
  .nav-btn,
  .nav-toggle,
  .ai-nav-btn{
    transition:none !important;
    animation:none !important;
  }
}

/* 2026-04 header rebuild v2 + mobile modal fix */
.main-nav{
  position:sticky;
  top:10px;
  z-index:55;
  display:grid;
  grid-template-columns:minmax(0, auto) minmax(0, 1fr);
  align-items:center;
  gap:16px;
  padding:12px 16px;
  margin-bottom:20px;
  border:1px solid var(--grid);
  border-radius:16px;
  background:var(--surface);
  box-shadow:0 10px 24px rgba(15, 23, 42, 0.08);
  backdrop-filter:none;
}
.main-nav::before,
.main-nav::after{
  display:none !important;
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}
.brand > div{
  display:grid;
  gap:2px;
  min-width:0;
}
.brand .eyebrow{
  font-size:10px;
  font-weight:700;
  letter-spacing:0.14em;
  color:var(--muted);
}
.brand-mark{
  width:40px;
  height:40px;
  border-radius:12px;
  background:linear-gradient(135deg, var(--accent), #4a84ee);
  box-shadow:none;
  overflow:hidden;
  animation:none;
  transform:none;
}
.brand:hover .brand-mark{
  transform:none;
  box-shadow:none;
}
.brand-mark::before{
  display:none !important;
}
.brand-mark::after{
  font-size:16px;
  font-weight:800;
  text-shadow:none;
}
.brand-title{
  font-size:18px;
  font-weight:700;
  line-height:1.1;
  letter-spacing:-0.02em;
}
.nav-actions{
  position:relative;
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
}
.nav-switcher{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:8px;
  flex:1 1 auto;
  min-width:0;
  padding:0;
  border:none;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  overflow:visible;
}
.nav-switcher::-webkit-scrollbar{
  display:none;
}
.nav-btn{
  min-height:40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:9px 14px;
  border-radius:12px;
  border:1px solid transparent;
  background:transparent;
  color:var(--muted);
  font-size:12px;
  font-weight:600;
  letter-spacing:0;
  text-transform:none;
  white-space:nowrap;
  box-shadow:none;
}
.nav-btn::before,
.nav-btn::after{
  display:none !important;
}
.nav-btn:hover,
.nav-btn:focus-visible{
  color:var(--text);
  background:var(--surface-2);
  border-color:var(--grid);
  box-shadow:none;
  transform:none;
}
.nav-btn.active,
.nav-btn[aria-current="page"]{
  color:var(--text);
  background:color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-color:color-mix(in srgb, var(--accent) 28%, var(--grid));
  box-shadow:none;
}
.nav-tool{
  margin-left:0;
}
.theme-toggle.nav-ghost,
.ai-nav-btn,
.nav-toggle{
  min-height:40px;
  height:40px;
  border-radius:12px;
  border:1px solid var(--grid);
  box-shadow:none;
}
.theme-toggle.nav-ghost{
  width:40px;
  background:var(--surface-2);
}
.ai-nav-btn{
  min-width:40px;
  padding:0 12px;
  background:linear-gradient(135deg, var(--accent), #4a84ee);
}
.ai-nav-btn:hover{
  transform:none;
  box-shadow:none;
}
.nav-toggle{
  display:none;
  padding:0 12px;
  background:var(--surface-2);
  font-size:12px;
  font-weight:700;
  letter-spacing:0;
  text-transform:none;
}
.nav-toggle-text{
  display:inline;
  font-size:12px;
}
.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after{
  width:16px;
}

.habit-modal-dialog{
  width:min(1120px, calc(100vw - 32px));
  max-height:min(92vh, 920px);
  display:flex;
  flex-direction:column;
  padding:18px;
  border-radius:24px;
  overflow:hidden;
}
#habitModal .modal-head{
  flex:0 0 auto;
  margin-bottom:14px;
  padding-bottom:12px;
  border-bottom:1px solid var(--grid);
}
.manage{
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:14px;
  overflow:hidden;
}
.manage-head,
.manage-composer,
.manage-tabs{
  flex:0 0 auto;
}
.manage-panels{
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
}
.manage-panel{
  height:100%;
  min-height:0;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}
.manage-panel .habit-list,
.manage-panel .habit-library{
  max-height:none;
  overflow:visible;
  padding-right:0;
}

@media (max-width: 980px){
  .main-nav{
    grid-template-columns:minmax(0, 1fr) auto;
    gap:10px;
    padding:10px 12px;
  }
  .brand-title{
    font-size:17px;
  }
  .nav-toggle{
    display:inline-flex;
  }
  .nav-actions{
    gap:8px;
  }
  .nav-switcher{
    position:absolute;
    top:calc(100% + 8px);
    right:0;
    width:min(320px, calc(100vw - 24px));
    display:grid;
    grid-template-columns:1fr;
    gap:8px;
    padding:10px;
    border:1px solid var(--grid);
    border-radius:16px;
    background:var(--surface);
    box-shadow:0 16px 32px rgba(15, 23, 42, 0.12);
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transform:translateY(-6px);
    transition:opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    max-height:calc(100vh - 92px);
    overflow:auto;
  }
  .main-nav.nav-open .nav-switcher{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
    transform:translateY(0);
  }
  .nav-switcher .nav-btn,
  .nav-switcher .theme-toggle{
    width:100%;
  }
  .nav-switcher .nav-btn{
    justify-content:flex-start;
  }
  .theme-toggle.nav-ghost{
    width:100%;
  }
  .manage-overview-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px){
  #habitModal{
    padding:0;
    align-items:stretch;
  }
  .habit-modal-dialog{
    width:100%;
    height:100dvh;
    max-height:none;
    padding:12px;
    border-radius:0;
    overflow:hidden;
  }
  #habitModal .modal-head{
    position:sticky;
    top:0;
    z-index:2;
    background:var(--surface);
  }
  .manage{
    gap:12px;
  }
  .manage-head{
    gap:12px;
  }
  .manage-overview-grid{
    grid-template-columns:1fr;
    gap:10px;
  }
  .manage-overview-card{
    min-height:auto;
    padding:12px 14px;
  }
  .manage-composer{
    padding:14px;
  }
  .manage-composer .row{
    flex-direction:column;
    align-items:stretch;
  }
  .manage-composer .field,
  .manage-composer .btn{
    width:100%;
  }
  .manage-tabs{
    flex-wrap:nowrap;
    overflow:auto;
    padding:4px;
    scrollbar-width:none;
  }
  .manage-tabs::-webkit-scrollbar{
    display:none;
  }
  .manage-tab{
    flex:0 0 auto;
    min-width:148px;
  }
  .manage-panels{
    overflow:hidden;
  }
  .manage-panel{
    padding:12px;
    border-radius:16px;
    touch-action:pan-y;
  }
}

@media (max-width: 640px){
  .main-nav{
    top:8px;
    padding:10px;
  }
  .brand-title{
    font-size:16px;
  }
  .brand .eyebrow{
    letter-spacing:0.1em;
  }
  .nav-switcher{
    width:min(100vw - 20px, 320px);
  }
  .ai-nav-btn{
    min-width:40px;
    padding:0 10px;
  }
  .ai-nav-btn .ai-fab-text{
    display:none;
  }
}

@media (prefers-reduced-motion: reduce){
  .main-nav,
  .nav-switcher,
  .nav-btn,
  .nav-toggle,
  .ai-nav-btn,
  .habit-modal-dialog,
  .manage-panel{
    transition:none !important;
    animation:none !important;
  }
}

/* 2026-04 header rebuild v3 polish */
.brand{
  text-decoration:none;
  color:inherit;
}
.nav-brand-copy{
  display:grid;
  gap:2px;
  min-width:0;
}
.nav-actions-auth{
  justify-content:flex-end;
}
.nav-switcher-auth{
  flex:0 0 auto;
}

@media (max-width: 720px){
  #habitModal{
    overflow:auto;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior:contain;
  }
  .habit-modal-dialog{
    overflow:auto;
    -webkit-overflow-scrolling:touch;
  }
  .manage{
    min-height:auto;
    overflow:visible;
  }
  .manage-panels{
    flex:0 0 auto;
    overflow:visible;
  }
  .manage-panel{
    height:auto;
    max-height:none;
    overflow:visible;
  }
}

/* Habit tracker controls rebuild */
#section-habits .habit-hero{
  display:flex;
  flex-direction:column;
  gap:14px;
  margin-bottom:16px;
}
#section-habits .habit-hero-top{
  width:100%;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:16px;
}
#section-habits .habit-hero-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex:0 0 auto;
}
#section-habits .habit-hero-chip{
  min-height:36px;
  padding:8px 12px;
  border-radius:14px;
  letter-spacing:0;
}
#section-habits .habit-manage-btn{
  width:100%;
  min-height:42px;
  padding:10px 15px;
  border-radius:14px;
  letter-spacing:0;
  white-space:nowrap;
}
#section-habits .habit-controls-panel,
#section-habits .habit-hero .habit-controls-panel,
#section-habits .habit-hero .habit-controls-panel[open]{
  width:100%;
  margin:0;
  display:block;
  justify-self:stretch;
  align-self:stretch;
  grid-column:auto;
}
#section-habits .habit-controls-toolbar,
#section-habits .habit-hero .habit-controls-panel .habit-controls-toolbar{
  width:100%;
  display:block;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  overflow:visible;
}
#section-habits .habit-controls-toolbar::before{
  content:none;
}
#section-habits .habit-controls-grid{
  display:grid;
  grid-template-columns:minmax(360px, 1.08fr) minmax(360px, 0.92fr) minmax(220px, 0.46fr);
  grid-template-areas:
    "range filters side"
    "actions actions actions";
  gap:10px;
  align-items:stretch;
  padding:10px;
  border:1px solid color-mix(in srgb, var(--accent) 16%, var(--grid));
  border-radius:22px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 88%, transparent), color-mix(in srgb, var(--surface) 96%, transparent));
  box-shadow:0 18px 38px rgba(7, 13, 28, 0.18);
}
#section-habits .habit-control-block{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:10px;
  border-radius:16px;
  background:color-mix(in srgb, var(--surface) 62%, var(--surface-2) 38%);
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--grid) 62%, transparent);
  align-self:stretch;
}
#section-habits .habit-range-block{
  grid-area:range;
}
#section-habits .habit-filter-block{
  grid-area:filters;
}
#section-habits .habit-side-block{
  grid-area:side;
  display:flex;
  justify-content:center;
}
#section-habits .habit-side-section{
  min-width:0;
  width:100%;
}
#section-habits .habit-actions-strip{
  grid-area:actions;
  display:grid;
  grid-template-columns:minmax(180px, 1fr) auto auto;
  align-items:center;
  gap:10px;
}
#section-habits .habit-control-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
#section-habits .habit-control-title,
#section-habits .toolbar .field label{
  font-size:11px;
  line-height:1.2;
  font-weight:800;
  color:var(--muted);
  letter-spacing:0;
}
#section-habits .habit-control-note{
  min-width:0;
  font-size:11px;
  line-height:1.3;
  color:color-mix(in srgb, var(--muted) 82%, var(--text));
  text-align:right;
}
#section-habits .range-buttons{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:7px;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
}
#section-habits .range-group{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:4px;
  border:1px solid color-mix(in srgb, var(--grid) 76%, var(--surface) 24%);
  border-radius:12px;
  background:color-mix(in srgb, var(--surface-3) 78%, var(--surface) 22%);
}
#section-habits .range-btn{
  min-width:40px;
  min-height:32px;
  padding:6px 10px;
  border-radius:10px;
  font-size:11px;
  line-height:1;
  letter-spacing:0;
  white-space:nowrap;
}
#section-habits .range-btn[data-preset="today"]{
  min-width:80px;
}
#section-habits .range-btn[data-preset="this-week"],
#section-habits .range-btn[data-preset="this-month"]{
  width:auto;
  min-width:92px;
}
#section-habits .range-btn[data-preset="this-year"],
#section-habits .range-btn[data-preset="custom"]{
  min-width:82px;
}
#section-habits .range-btn.active{
  border-color:transparent;
  background:linear-gradient(135deg, var(--today-accent), color-mix(in srgb, var(--accent) 70%, #4a84ee 30%));
  color:#fff;
  box-shadow:0 10px 18px color-mix(in srgb, var(--today-accent) 24%, transparent);
}
#section-habits .habit-category-field,
#section-habits .sort-field,
#section-habits .compact-field{
  width:100%;
  min-width:0;
}
#section-habits .habit-category-filter{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(104px, 1fr));
  align-items:center;
  gap:6px;
}
#section-habits .habit-category-chip{
  width:100%;
  min-height:34px;
  justify-content:flex-start;
  padding:7px 9px;
  border-radius:12px;
  font-size:10px;
  letter-spacing:0;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--chip-accent) 16%, transparent), transparent 42%),
    color-mix(in srgb, var(--surface-2) 76%, var(--surface) 24%);
  box-shadow:inset 3px 0 0 color-mix(in srgb, var(--chip-accent) 68%, transparent);
}
#section-habits .habit-category-chip.active{
  color:color-mix(in srgb, var(--chip-accent) 88%, #ffffff 12%);
  border-color:color-mix(in srgb, var(--chip-accent) 62%, var(--grid));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--chip-accent) 26%, transparent), color-mix(in srgb, var(--surface) 92%, transparent)),
    color-mix(in srgb, var(--chip-accent) 12%, var(--surface));
  box-shadow:
    inset 3px 0 0 color-mix(in srgb, var(--chip-accent) 90%, transparent),
    0 10px 18px color-mix(in srgb, var(--chip-accent) 10%, transparent);
}
#section-habits .habit-category-chip-icon{
  width:20px;
  height:20px;
  border-radius:8px;
}
#section-habits .habit-category-chip-label{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
}
#section-habits .toolbar select,
#section-habits .toolbar input[type="date"]{
  width:100%;
  min-height:36px;
  padding:8px 10px;
  border-radius:11px;
}
#section-habits .custom-range{
  display:none;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:8px;
  padding-top:2px;
}
#section-habits .custom-range.show{
  display:grid;
}
#section-habits .past-edit-toggle{
  width:auto;
  justify-self:end;
  min-height:40px;
  padding:7px 10px;
  border-radius:12px;
  border-style:solid;
  gap:8px;
  white-space:nowrap;
  background:color-mix(in srgb, var(--surface-2) 84%, var(--surface) 16%);
}
#section-habits .past-edit-checkbox{
  width:20px;
  height:20px;
}
#section-habits .past-edit-copy{
  min-width:0;
}
#section-habits .past-edit-title,
#section-habits .past-edit-sub{
  letter-spacing:0;
}
#section-habits .past-edit-sub{
  display:none;
}
#section-habits #resetBtn{
  min-height:38px;
  padding:8px 12px;
  border-radius:12px;
  letter-spacing:0;
  white-space:nowrap;
}

@media (max-width: 1180px){
  #section-habits .habit-controls-grid{
    grid-template-columns:minmax(0, 1fr) minmax(240px, 0.55fr);
    grid-template-areas:
      "range side"
      "filters filters"
      "actions actions";
  }
  #section-habits .habit-filter-block{
    min-height:0;
  }
}

@media (max-width: 820px){
  #section-habits .habit-hero-top,
  #section-habits .habit-hero-actions{
    align-items:stretch;
  }
  #section-habits .habit-hero-top{
    flex-direction:column;
  }
  #section-habits .habit-hero-actions{
    width:100%;
    justify-content:space-between;
  }
  #section-habits .habit-controls-grid{
    grid-template-columns:1fr;
    grid-template-areas:
      "range"
      "filters"
      "side"
      "actions";
    padding:10px;
  }
  #section-habits .habit-actions-strip{
    grid-template-columns:minmax(0, 1fr) auto auto;
  }
  #section-habits .habit-manage-btn{
    grid-column:auto;
  }
}

@media (max-width: 560px){
  #section-habits .habit-hero{
    gap:12px;
  }
  #section-habits .habit-hero-actions{
    display:grid;
    grid-template-columns:1fr;
  }
  #section-habits .habit-hero-chip,
  #section-habits .habit-manage-btn{
    width:100%;
    justify-content:center;
  }
  #section-habits .habit-controls-grid{
    gap:8px;
    padding:8px;
    border-radius:18px;
  }
  #section-habits .habit-control-block{
    padding:10px;
    border-radius:14px;
  }
  #section-habits .habit-control-head{
    align-items:flex-start;
    flex-direction:column;
    gap:3px;
  }
  #section-habits .habit-control-note{
    text-align:left;
  }
  #section-habits .habit-category-filter{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
  #section-habits .range-buttons{
    display:grid;
    grid-template-columns:repeat(2, minmax(0, 1fr));
    gap:6px;
  }
  #section-habits .range-group{
    width:100%;
    display:grid;
    grid-template-columns:42px minmax(0, 1fr) 42px;
    grid-column:1 / -1;
  }
  #section-habits .range-group .range-btn{
    width:100%;
    min-width:0;
  }
  #section-habits .range-buttons > .range-btn{
    width:100%;
    min-width:0;
  }
  #section-habits .custom-range,
  #section-habits .habit-actions-strip{
    grid-template-columns:1fr auto;
  }
  #section-habits .habit-manage-btn{
    grid-column:1 / -1;
  }
  #section-habits .past-edit-toggle{
    justify-self:stretch;
  }
  #section-habits #resetBtn{
    width:auto;
  }
}

/* Manage Habits modal redesign */
#section-habits .habit-manage-btn{
  width:auto;
  min-width:0;
  min-height:36px;
  justify-self:start;
  padding:8px 12px;
  border-radius:10px;
  font-size:10px;
  line-height:1;
  letter-spacing:0;
  box-shadow:0 10px 18px color-mix(in srgb, var(--accent) 18%, transparent);
}

#section-habits .habit-actions-strip{
  grid-template-columns:minmax(120px, max-content) auto auto;
  justify-content:start;
}

#habitModal{
  padding:12px;
}

#habitModal .habit-modal-dialog{
  width:min(1540px, calc(100vw - 24px));
  height:min(96dvh, 980px);
  max-height:min(96dvh, 980px);
  display:grid;
  grid-template-rows:auto minmax(0, 1fr);
  gap:12px;
  padding:16px;
  border-radius:18px;
  overflow:hidden;
  border:1px solid color-mix(in srgb, var(--accent) 16%, var(--grid));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, var(--surface-2)), var(--surface));
  box-shadow:0 28px 70px rgba(7, 13, 28, 0.22);
}

#habitModal .habit-manage-head{
  min-height:0;
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto auto;
  align-items:center;
  gap:12px;
  margin:0;
  padding:0 0 12px;
  border-bottom:1px solid color-mix(in srgb, var(--grid) 78%, transparent);
}

.habit-manage-title{
  min-width:0;
}

.habit-manage-title h2{
  margin:2px 0 4px;
  font-size:24px;
  line-height:1.05;
  letter-spacing:0;
}

.habit-manage-title .sub{
  max-width:760px;
}

.habit-modal-summary{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px;
  border:1px solid color-mix(in srgb, var(--grid) 82%, transparent);
  border-radius:10px;
  background:color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}

.habit-modal-summary span{
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-height:32px;
  padding:6px 10px;
  border-radius:8px;
  background:var(--surface);
  color:var(--muted);
  font-size:11px;
  font-weight:700;
  white-space:nowrap;
}

.habit-modal-summary strong{
  color:var(--text);
  font-size:16px;
  line-height:1;
}

#habitModal .manage-redesign{
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:12px;
  overflow:auto;
  padding-right:4px;
  overscroll-behavior:contain;
}

#habitModal .panel{
  border-radius:10px;
}

#habitModal .manage-panel,
#habitModal .manage-composer,
#habitModal .manage-overview-panel{
  min-height:0;
  padding:14px;
  border:1px solid color-mix(in srgb, var(--grid) 84%, transparent);
  background:color-mix(in srgb, var(--surface) 86%, var(--surface-2));
  box-shadow:none;
}

#habitModal .library-panel{
  order:1;
  flex:1 0 600px;
  display:grid;
  grid-template-rows:auto minmax(0, 1fr);
  gap:12px;
  overflow:hidden;
}

#habitModal .manage-composer{
  order:2;
  flex:0 0 auto;
}

#habitModal .manage-bottom{
  order:3;
  flex:0 0 auto;
}

#habitModal .manage-section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin:0;
}

#habitModal .manage-section-head.compact{
  align-items:center;
}

#habitModal .manage-section-head h3{
  margin:0 0 4px;
  color:var(--text);
  font-size:15px;
  line-height:1.2;
  font-weight:800;
  letter-spacing:0;
  text-transform:none;
}

#habitModal .manage-section-head .sub{
  max-width:780px;
  margin:0;
  font-size:12px;
  line-height:1.45;
}

.manage-library-tools{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:8px;
  flex:0 0 auto;
}

.manage-filter{
  min-height:34px;
  padding:8px 11px;
  border:1px solid color-mix(in srgb, var(--grid) 88%, transparent);
  border-radius:8px;
  background:var(--surface);
  color:var(--muted);
  font:inherit;
  font-size:11px;
  font-weight:800;
  line-height:1;
  cursor:pointer;
  transition:background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.manage-filter:hover{
  color:var(--text);
  border-color:color-mix(in srgb, var(--accent) 34%, var(--grid));
  transform:translateY(-1px);
}

.manage-filter.active{
  color:#fff;
  border-color:transparent;
  background:linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent-2) 76%, #22c55e));
}

.manage-filter-muted.active{
  background:linear-gradient(135deg, #64748b, color-mix(in srgb, var(--accent) 38%, #334155));
}

#habitModal .habit-library{
  min-height:540px;
  display:grid;
  align-content:start;
  gap:12px;
  overflow:auto;
  padding:2px 6px 6px 0;
  margin:0;
}

#habitModal .habit-category{
  display:grid;
  gap:11px;
  padding:12px;
  border:1px solid color-mix(in srgb, var(--category-color) 18%, var(--grid));
  border-radius:12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface-2) 86%, var(--surface))),
    linear-gradient(90deg, color-mix(in srgb, var(--category-color) 7%, transparent), transparent 48%);
}

#habitModal .habit-category-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:0;
  color:var(--text);
  font-size:12px;
  font-weight:800;
  letter-spacing:0;
  text-transform:none;
}

#habitModal .habit-category-title::before{
  content:none;
}

.habit-category-count{
  min-width:24px;
  min-height:22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:3px 7px;
  border-radius:999px;
  background:color-mix(in srgb, var(--category-color) 16%, var(--surface));
  color:color-mix(in srgb, var(--category-color) 86%, var(--text));
  font-size:11px;
  line-height:1;
}

#habitModal .habit-chip-list{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(190px, 1fr));
  gap:8px;
  margin:0;
}

#habitModal .habit-library-card{
  position:relative;
  min-width:0;
  min-height:76px;
  display:block;
  padding:10px;
  overflow:visible;
  border-radius:10px;
  border:1px solid color-mix(in srgb, var(--habit-accent) 16%, var(--grid));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 42%, var(--surface)));
  color:var(--text);
  box-shadow:0 12px 24px rgba(7, 13, 28, 0.08);
  transition:border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

#habitModal .habit-library-card.has-footer{
  min-height:108px;
  display:flex;
  flex-direction:column;
}

#habitModal .habit-library-card:hover{
  transform:translateY(-1px);
  border-color:color-mix(in srgb, var(--habit-accent) 38%, var(--grid));
  box-shadow:0 16px 30px rgba(7, 13, 28, 0.12);
}

#habitModal .habit-library-card.is-active{
  border-color:color-mix(in srgb, #22c55e 62%, var(--habit-accent));
  background:
    linear-gradient(135deg, color-mix(in srgb, #22c55e 10%, var(--surface)), color-mix(in srgb, var(--habit-accent) 7%, var(--surface))),
    var(--surface);
  box-shadow:
    inset 4px 0 0 #22c55e,
    0 16px 30px color-mix(in srgb, #22c55e 14%, rgba(7, 13, 28, 0.12));
}

#habitModal .habit-library-card.is-archived{
  border-style:dashed;
  opacity:0.9;
}

.habit-card-top{
  min-width:0;
  display:flex;
  align-items:flex-start;
  gap:8px;
}

#habitModal .habit-library-card .chip-icon{
  width:34px;
  height:34px;
  border-radius:9px;
  font-size:16px;
  border:1px solid color-mix(in srgb, var(--icon-color) 34%, transparent);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--icon-color) 16%, var(--surface)), color-mix(in srgb, var(--icon-color) 7%, var(--surface)));
}

.chip-copy{
  min-width:0;
  flex:1 1 auto;
  display:grid;
  gap:4px;
}

#habitModal .habit-library-card .chip-name{
  min-width:0;
  color:var(--text);
  font-size:12px;
  font-weight:800;
  line-height:1.2;
  white-space:normal;
}

.chip-category{
  min-width:0;
  color:var(--muted);
  font-size:10px;
  line-height:1.25;
}

.habit-card-tools{
  position:absolute;
  top:-9px;
  right:8px;
  z-index:2;
  margin-left:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:3px;
}

#habitModal .habit-card-tool{
  width:22px;
  height:22px;
  min-width:22px;
  min-height:22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0;
  border-radius:7px;
  border:1px solid color-mix(in srgb, var(--habit-accent) 24%, var(--grid));
  background:color-mix(in srgb, var(--habit-accent) 9%, var(--surface));
  color:color-mix(in srgb, var(--habit-accent) 88%, var(--text));
  font-size:11px;
  line-height:1;
  font-weight:900;
  cursor:pointer;
  box-shadow:0 6px 12px rgba(7, 13, 28, 0.14);
}

#habitModal .habit-card-state-btn{
  letter-spacing:0;
}

.habit-card-footer{
  width:100%;
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto auto;
  gap:6px;
  margin-top:auto;
  padding-top:8px;
  border-top:1px solid color-mix(in srgb, var(--grid) 72%, transparent);
}

#habitModal .habit-card-footer-btn{
  min-height:28px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:7px 9px;
  border-radius:7px;
  border:1px solid color-mix(in srgb, var(--habit-accent) 22%, var(--grid));
  background:color-mix(in srgb, var(--habit-accent) 8%, var(--surface));
  color:color-mix(in srgb, var(--habit-accent) 86%, var(--text));
  font-size:10px;
  line-height:1;
  font-weight:900;
  white-space:nowrap;
  cursor:pointer;
}

#habitModal .habit-card-footer .habit-card-state-btn{
  width:100%;
}

#habitModal .habit-card-state-btn:disabled{
  opacity:1;
  cursor:default;
}

#habitModal .habit-library-card.is-new .habit-card-state-btn{
  color:#fff;
  border-color:transparent;
  background:linear-gradient(135deg, #16a34a, color-mix(in srgb, var(--habit-accent) 54%, #15803d));
  box-shadow:0 8px 14px color-mix(in srgb, #16a34a 16%, transparent);
}

#habitModal .habit-library-card.is-active .habit-card-state-btn{
  cursor:default;
  color:#fff;
  border-color:transparent;
  background:linear-gradient(135deg, #22c55e, #16a34a);
}

#habitModal .habit-library-card.is-archived .habit-card-state-btn{
  color:#fff;
  border-color:transparent;
  background:linear-gradient(135deg, #64748b, color-mix(in srgb, var(--habit-accent) 46%, #334155));
}

#habitModal .habit-card-mini{
  background:transparent;
  color:var(--muted);
  border-color:color-mix(in srgb, var(--grid) 88%, transparent);
  font-size:10px;
}

#habitModal .habit-card-mini:hover{
  color:var(--text);
  border-color:color-mix(in srgb, var(--habit-accent) 36%, var(--grid));
}

#habitModal .habit-card-mini.danger{
  color:var(--danger-text);
  border-color:var(--danger-border);
}

.habit-library-empty{
  padding:18px;
  border:1px dashed var(--grid);
  border-radius:8px;
  background:var(--surface-2);
  text-align:center;
}

#habitModal .manage-composer{
  display:grid;
  gap:12px;
}

.habit-composer-grid{
  display:grid;
  grid-template-columns:minmax(240px, 1.1fr) minmax(160px, 0.56fr) minmax(180px, 0.62fr) 76px auto;
  gap:9px;
  align-items:end;
}

.habit-form-field{
  min-width:0;
  display:grid;
  gap:5px;
}

.habit-form-field span{
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  line-height:1.2;
}

#habitModal .habit-form-field input,
#habitModal .habit-form-field select{
  width:100%;
  min-height:40px;
  padding:9px 10px;
  border:1px solid color-mix(in srgb, var(--grid) 86%, transparent);
  border-radius:8px;
  background:var(--surface);
  color:var(--text);
  font:inherit;
}

#habitModal .habit-form-field input:focus,
#habitModal .habit-form-field select:focus{
  outline:2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset:2px;
}

#habitModal .habit-icon-field input{
  text-align:center;
  font-weight:800;
}

#habitModal .custom-category-field[hidden]{
  display:none !important;
}

#habitModal #addHabitBtn{
  min-height:40px;
  padding:10px 14px;
  border-radius:8px;
  white-space:nowrap;
}

#habitModal #cancelHabitEditBtn{
  flex:0 0 auto;
}

.manage-bottom{
  display:grid;
  grid-template-columns:minmax(0, 1fr) minmax(300px, 0.42fr);
  gap:12px;
  align-items:start;
}

.manage-bottom > [hidden]{
  display:none !important;
}

#habitModal .manage-overview-grid{
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:9px;
  min-width:0;
}

#habitModal .manage-overview-card{
  min-height:104px;
  padding:12px;
  border-radius:8px;
  border:1px solid color-mix(in srgb, var(--grid) 84%, transparent);
  background:var(--surface);
}

#habitModal .manage-overview-card strong{
  font-size:24px;
}

#habitModal .manage-overview-card-accent{
  border-color:color-mix(in srgb, var(--accent) 32%, var(--grid));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 11%, var(--surface)), color-mix(in srgb, #22c55e 8%, var(--surface)));
}

#habitModal .manage-hidden-render-target{
  display:none !important;
}

#habitModal .archived-panel{
  max-height:320px;
  overflow:auto;
}

#habitModal .habit-list{
  max-height:none;
  display:grid;
  gap:8px;
  overflow:visible;
  padding:0;
  margin:0;
}

#habitModal .habit-item{
  padding:10px;
  border-radius:8px;
  background:var(--surface);
}

.habit-list-copy{
  min-width:0;
  display:grid;
  gap:3px;
}

.habit-list-meta{
  min-width:0;
  color:var(--muted);
  font-size:11px;
  line-height:1.2;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

@media (max-width: 1100px){
  #habitModal .habit-modal-dialog{
    width:calc(100vw - 16px);
    height:calc(100dvh - 16px);
    max-height:calc(100dvh - 16px);
  }

  #habitModal .habit-manage-head{
    grid-template-columns:minmax(0, 1fr) auto;
  }

  .habit-modal-summary{
    grid-column:1 / -1;
    justify-self:start;
  }

  .habit-composer-grid{
    grid-template-columns:minmax(220px, 1fr) minmax(160px, 0.55fr) minmax(160px, 0.55fr) 72px;
  }

  #habitModal #addHabitBtn{
    grid-column:1 / -1;
    justify-self:start;
  }

  .manage-bottom{
    grid-template-columns:1fr;
  }
}

@media (max-width: 780px){
  #habitModal{
    padding:0;
    align-items:stretch;
  }

  #habitModal .habit-modal-dialog{
    width:100%;
    height:100dvh;
    max-height:none;
    border-radius:0;
    padding:12px;
    overflow:hidden;
  }

  #habitModal .habit-manage-head{
    position:sticky;
    top:0;
    z-index:3;
    grid-template-columns:minmax(0, 1fr) auto;
    background:var(--surface);
  }

  .habit-manage-title h2{
    font-size:20px;
  }

  .habit-modal-summary{
    width:100%;
    overflow:auto;
  }

  #habitModal .manage-redesign{
    display:flex;
    flex-direction:column;
    overflow:auto;
    padding-right:0;
  }

  #habitModal .library-panel{
    min-height:520px;
    flex-basis:520px;
  }

  #habitModal .manage-section-head,
  #habitModal .manage-section-head.compact{
    flex-direction:column;
    align-items:stretch;
  }

  .manage-library-tools{
    justify-content:flex-start;
  }

  #habitModal .habit-chip-list{
    grid-template-columns:repeat(auto-fill, minmax(178px, 1fr));
  }

  .habit-composer-grid{
    grid-template-columns:minmax(0, 1fr) 72px;
  }

  .habit-form-field-main,
  .habit-composer-grid .habit-form-field:not(.habit-icon-field),
  #habitModal #addHabitBtn{
    grid-column:1 / -1;
  }

  #habitModal .manage-overview-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px){
  #section-habits .habit-actions-strip{
    grid-template-columns:auto auto;
    justify-content:start;
  }

  #section-habits .habit-manage-btn{
    width:auto;
    grid-column:1 / -1;
    justify-self:start;
  }

  #section-habits .past-edit-toggle{
    justify-self:start;
  }

  #habitModal .habit-modal-dialog{
    padding:10px;
  }

  #habitModal .habit-modal-summary span{
    min-height:30px;
    padding:6px 8px;
  }

  #habitModal .library-panel{
    min-height:560px;
    flex-basis:560px;
  }

  #habitModal .habit-chip-list{
    grid-template-columns:1fr;
  }

  #habitModal .manage-overview-grid{
    grid-template-columns:1fr;
  }
}
