/* DoTo styles — native nested CSS (SCSS-like, no build step).
   Nesting rule: `&` continues the parent selector, plain names nest as
   descendants. Flattened output must equal the previous flat file. */
:root{
  color-scheme:light;
  --blue:#1a73e8; --blue-dark:#1558b0; --blue-soft:#e8f0fe;
  --bg:#ffffff; --bg2:#f6f8fc; --sidebar:#f8fafd;
  --text:#202124; --muted:#5f6368; --line:#dadce0; --line-soft:#e6eaf0;
  --danger:#d93025; --ok:#188038;
  --scroll-thumb:#c1c7ce; --scroll-thumb-hover:#a8b0b8; --scroll-track:transparent;
  --radius:14px; --radius-sm:10px;
  --shadow:0 1px 2px rgba(60,64,67,.25),0 2px 8px rgba(60,64,67,.15);
  --shadow-lg:0 8px 28px rgba(0,0,0,.18);
  --safe-t:env(safe-area-inset-top,0px);
  --safe-r:env(safe-area-inset-right,0px);
  --safe-b:env(safe-area-inset-bottom,0px);
  --safe-l:env(safe-area-inset-left,0px);
  --topbar-h:calc(58px + env(safe-area-inset-top,0px));
  --side-w:280px; --detail-w:440px;
}
/* iOS 26.1+ PWA regression (WebKit bug 301994): in Home Screen standalone
   mode the system draws an opaque status-bar strip and pushes the web
   content below it, while env(safe-area-inset-top) returns 0 — which is
   correct, since no extra padding is needed there. Do NOT force a fixed
   safe-area height: it stacks on top of the system offset and leaves an
   unwanted empty band at the top of the app. */
*{box-sizing:border-box;scrollbar-width:thin;scrollbar-color:var(--scroll-thumb) var(--scroll-track)}
html,body{height:100%;overflow-x:hidden;overflow-x:clip}
body{
  margin:0; font-family:Roboto,"Google Sans",Arial,sans-serif; color:var(--text);
  background:var(--bg); -webkit-tap-highlight-color:transparent;
  overscroll-behavior-y:contain;
  padding-top:var(--topbar-h);
  &.dark{
    color-scheme:dark;
    --bg:#131314; --bg2:#1e1f20; --sidebar:#1b1c1e;
    --text:#e3e3e3; --muted:#9aa0a6; --line:#3c4043; --line-soft:#2a2b2e;
    --blue-soft:#2a3a55;
    --scroll-thumb:#5f6368; --scroll-thumb-hover:#7a8187; --scroll-track:transparent;
    & .list-item .c{background:rgba(255,255,255,.12)}
  }
}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
input,select,textarea{font:inherit;color:inherit}
.hidden{display:none!important}

/* Theme-aware scrollbars (light + dark) */
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:var(--scroll-track)}
::-webkit-scrollbar-thumb{background:var(--scroll-thumb);border-radius:8px;border:2px solid transparent;background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:var(--scroll-thumb-hover);border:2px solid transparent;background-clip:content-box}
::-webkit-scrollbar-corner{background:transparent}

/* Topbar — mobile first */
.topbar{
  height:var(--topbar-h); display:flex; align-items:center; gap:8px;
  padding:var(--safe-t) max(8px,var(--safe-r)) 0 max(8px,var(--safe-l));
  border-bottom:1px solid var(--line-soft);
  position:fixed; top:0; left:0; right:0; z-index:100; background:var(--bg);
  & .brand{
    display:flex;align-items:center;gap:8px;min-width:0;cursor:pointer;flex:none;
  }
  & .brand-mark{display:inline-flex;flex:none}
  & .brand-mark img{width:30px;height:30px;display:block}
  & .brand-text{display:flex;flex-direction:column;justify-content:center;line-height:1.05}
  & .brand-name{font-weight:700;font-size:19px;letter-spacing:.2px}
  & .search-wrap{flex:1;margin-left:4px}
}
.search-wrap{
  display:flex;align-items:center;gap:6px;background:var(--bg2);
  border-radius:24px;padding:0 10px;height:42px;min-width:0;
  & input{flex:1;border:0;background:transparent;outline:0;min-width:0}
}
.search-icon{color:var(--muted)}
.topbar-actions{display:flex;align-items:center;gap:2px;flex:none;position:relative}
.icon-btn{
  width:40px;height:40px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:var(--muted);
  &:hover{background:rgba(60,64,67,.1)}
  &.sm{width:32px;height:32px}
  &.active{color:var(--blue);background:var(--blue-soft)}
}

/* Layout — overflow-x:clip (not hidden): clip does NOT create a scroll
   container, so desktop `position:sticky` panels (sidebar, cal-side, time
   tracker) keep sticking. `hidden` would make them scroll away with the page. */
.app{display:flex;min-height:calc(100dvh - var(--topbar-h));position:relative;align-items:stretch;overflow-x:hidden;overflow-x:clip}
.scrim{position:fixed;inset:var(--topbar-h) 0 0 0;background:rgba(0,0,0,.35);z-index:30;transition:opacity .22s ease}

/* Sidebar drawer on mobile */
.sidebar{
  position:fixed;top:var(--topbar-h);bottom:0;left:0;width:min(300px,84vw);
  padding-bottom:var(--safe-b);padding-left:var(--safe-l);
  background:var(--sidebar);z-index:31;transform:translateX(-102%);
  transition:transform .22s ease;display:flex;flex-direction:column;
  border-right:1px solid var(--line-soft);overflow-y:auto;overflow-x:hidden;
  &.open{transform:none;box-shadow:var(--shadow-lg)}
}
.sidebar-scroll{padding:10px 8px;display:flex;flex-direction:column;min-height:100%;min-width:0;overflow-x:hidden}
.list-nav{
  display:flex;flex-direction:column;gap:1px;
}
.list-item{
  display:flex;align-items:center;gap:10px;padding:4px 12px;border-radius:0 24px 24px 0;text-align:left;width:100%;
  & .material-icons-outlined{color:var(--muted)}
  &.active{
    background:var(--blue-soft);font-weight:500;
    & .material-icons-outlined{color:var(--blue)}
  }
  & .n{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  & .c{font-size:12px;color:var(--muted);background:rgba(0,0,0,.06);border-radius:12px;padding:1px 8px}
  & .c.alert{background:var(--danger);color:#fff;font-weight:700}
  &.drop-target{outline:2px dashed var(--blue);background:var(--blue-soft)}
  &.dragging{opacity:.5}
  &.drop-before{box-shadow:0 -2px 0 var(--blue)}
  &.drop-after{box-shadow:0 2px 0 var(--blue)}
}
.view-item{
  & .n{font-weight:500}
}
.create-list{
  display:flex;align-items:center;gap:10px;padding:10px 12px;color:var(--blue);font-weight:500;border-radius:24px;margin-top:2px;
  &:hover{background:var(--blue-soft)}
}
.sidebar-divider{height:1px;background:var(--line-soft);margin:5px 4px;border:0;align-self:stretch}
.sidebar-filters{margin-top:7px}
.sidebar-label{font-size:12px;color:var(--muted);margin:2px 10px 6px;font-weight:500}
.f-group{display:flex;align-items:center;gap:8px;margin:1px 0 8px;min-width:0}
.f-name{flex:0 0 68px;width:68px;font-size:12px;color:var(--muted);margin:0 0 0 10px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.f-btns{
  display:flex;gap:6px;padding:0 5px 0 0;flex-wrap:nowrap;flex:1;min-width:0;align-items:center;
  &.colors{gap:2px;flex-wrap:wrap;justify-content:flex-end}
  &.colors .f-dot{width:22px;height:22px}
}
.f-btn{
  flex:1 1 0;min-width:0;display:inline-flex;align-items:center;justify-content:center;gap:4px;font-size:12px;border:1px solid var(--line);border-radius:14px;padding:2px 4px;color:var(--muted);white-space:nowrap;overflow:hidden;
  & .material-icons-outlined{font-size:16px;flex:none}
  &.selected{border-color:var(--blue);color:var(--blue);background:var(--blue-soft);font-weight:500}
}
.f-dot{
  width:24px;height:24px;border-radius:50%;border:2px solid var(--bg);box-shadow:0 0 0 1px var(--line);flex:none;padding:0;
  &.selected{box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--blue)}
}
.link-btn{
  color:var(--blue);font-size:14px;padding:6px 10px;text-align:left;
  &.danger{color:var(--danger)}
}
.sidebar-foot{margin-top:auto;padding:8px 10px;display:flex;flex-direction:column;gap:6px}
.sidebar-foot .io-row{gap:6px}
.legal-row{display:flex;align-items:center;justify-content:flex-start;gap:3px;padding:2px 0 0 6px}
.legal-row a{font-size:11px;color:var(--muted);text-decoration:none}
.legal-row a:hover{color:var(--blue);text-decoration:underline}
.legal-row span{font-size:11px;color:var(--muted)}
.legal-row .made-by{font-size:11px;color:var(--muted)}
.legal-row .made-by a{color:var(--blue);text-decoration:none;font-size:11px}
.legal-row .made-by a:hover{text-decoration:underline}
.sidebar-foot .btn-ghost{font-size:12px;padding:8px 6px}
.sidebar-foot .btn-ghost .material-icons-outlined{font-size:16px}
.switch-row{display:flex;align-items:center;gap:8px;font-size:14px;color:var(--muted)}
.io-row{display:flex;gap:8px}
.btn-ghost{
  display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:18px;padding:8px 12px;font-size:13px;color:var(--muted);
  &:hover{border-color:var(--blue);color:var(--blue)}
  & .material-icons-outlined{font-size:18px}
}

/* Resizers */
.resizer{flex:none;touch-action:none;user-select:none}
.resizer-side{
  display:none;position:absolute;top:0;bottom:0;right:0;width:8px;cursor:col-resize;z-index:5;
  &::after{content:"";display:block;width:3px;height:100%;margin:0 auto;border-radius:3px;background:transparent}
  &:hover::after,&.active::after{background:var(--blue)}
}
.resizer-detail{
  position:absolute;left:-4px;top:0;bottom:0;width:10px;cursor:col-resize;display:none;z-index:5;
  &::after{content:"";display:block;width:4px;height:40px;margin:40vh auto 0;border-radius:4px;background:var(--line)}
  &:hover::after{background:var(--blue)}
}

/* Main */
.main{flex:1;min-width:0;max-width:1100px;margin:0 auto;width:100%;padding:12px 14px 110px}
.view{animation:fade .18s ease}
@keyframes fade{from{opacity:.4}to{opacity:1}}
.list-header{
  display:flex;align-items:center;justify-content:space-between;gap:8px;margin:2px 0 8px;
  position:relative;
  & h1{font-size:22px;font-weight:400;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:40px}
  & #listTitle{transform:translateY(3px)}
  & .list-header-actions{
    display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;gap:6px;position:relative;
    & .btn-ghost{height:40px;display:inline-flex;align-items:center;line-height:1;flex:none}
    & .material-icons-outlined{font-size:22px;line-height:1}
    & .icon-btn{flex:none}
  }
}
.cal-title-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-width:0}
#calPrev,#calNext{display:flex;justify-content:center;align-items:center}
#calTodayBtn{margin-left:5px;margin-right:5px}
/* belt-and-suspenders: calendar controls must always sit in one row */
#viewCal .list-header-actions{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center}
#viewCal .list-header-actions > *{flex:none}
.seg-mini{
  display:inline-flex;background:var(--bg2);border-radius:14px;padding:2px;gap:2px;
  & button{
    font-size:12px;color:var(--muted);border-radius:11px;padding:6px 12px;
    &.selected{background:var(--bg);color:var(--text);box-shadow:var(--shadow);font-weight:500}
  }
}
.board-hint{margin:2px 0 0;padding-bottom:10px}
.count-pill{
  font-size:12px;background:var(--blue-soft);color:var(--blue);border-radius:12px;padding:2px 10px;font-weight:500;white-space:nowrap;
  &.muted{background:rgba(60,64,67,.1);color:var(--muted)}
}
.chips{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:6px}
.chip{
  display:inline-flex;align-items:center;gap:6px;font-size:12px;border:1px solid var(--line);border-radius:16px;padding:4px 6px 4px 10px;background:var(--bg);
  & button{display:flex;border-radius:50%}
}
.dot{width:12px;height:12px;border-radius:50%;display:inline-block;flex:none;border:1px solid var(--line)}

/* Home / summary */
.home-hero{
  display:flex;flex-direction:column;gap:14px;margin:8px 0 24px;
  & h1{margin:0 0 8px;font-size:clamp(24px,6vw,32px);font-weight:700;letter-spacing:.2px}
  & .muted{margin:6px 0 0}
  & .home-hero-actions{
    order:-1;display:flex;gap:8px;width:100%;
    & > *{flex:1 1 0;min-width:0;justify-content:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-left:6px;padding-right:6px;font-size:13px}
    & .material-icons-outlined{font-size:18px;flex:none}
  }
}
@media (min-width:700px){
  .home-hero .home-hero-actions{width:auto;justify-content:flex-start}
  .home-hero .home-hero-actions > *{flex:none;padding-left:12px;padding-right:12px}
}
#homeAddBtn .short-t{display:none}
@media (max-width:699px){
  #homeAddBtn .full-t{display:none}
  #homeAddBtn .short-t{display:inline}
}
.eyebrow{margin:0 0 8px;color:var(--muted);font-size:14px}
.eyebrow strong{color:var(--text)}
.home-meta{display:flex;gap:16px;margin-bottom:24px;flex-wrap:wrap;align-items:stretch}
.weather{
  display:flex;align-items:center;gap:10px;background:var(--bg2);border:1px solid var(--line-soft);border-radius:14px;padding:10px 16px;
  & .material-icons-outlined{font-size:32px;color:var(--blue)}
}
#weatherTemp{font-size:20px;font-weight:700}
.wx-tom{display:flex;align-items:center;gap:6px;border-left:1px solid var(--line);padding-left:12px;margin-left:2px}
.wx-tom .material-icons-outlined{font-size:22px;color:var(--blue)}
#wxTomTemp{font-size:14px;font-weight:500;white-space:nowrap}
.quote{
  flex:1 1 220px;display:flex;gap:8px;align-items:flex-start;background:var(--bg);border:1px dashed var(--line);border-radius:14px;padding:10px 14px;
  & .material-icons-outlined{color:var(--muted);flex:none}
  & p{margin:2px 0;font-style:italic;color:var(--muted);font-size:14px;flex:1}
  & #quoteRefresh{flex:none;align-self:center}
}
.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:16px;margin-bottom:24px}
.stat{
  background:var(--bg2);border:1px solid var(--line-soft);border-radius:16px;padding:18px;text-align:left;width:100%;
  & .num{font-size:24px;font-weight:700}
  & .lbl{font-size:12px;color:var(--muted)}
  &.clickable{
    cursor:pointer;
    &:hover{border-color:var(--blue)}
  }
}
.home-grid{
  display:grid;grid-template-columns:1fr;gap:24px;
  & .task-list{gap:14px;margin-top:10px}
  & .task{margin:0}
}
#notifCard{margin-bottom:24px}
.card{
  border:1px solid var(--line-soft);border-radius:18px;padding:22px 24px;background:var(--bg);
  & h2{
    font-size:15px;margin:2px 0 14px;display:flex;align-items:center;gap:8px;font-weight:500;
    & .material-icons-outlined{font-size:20px}
  }
  & .task-list{margin-top:2px}
}
.danger{color:var(--danger)} .blue{color:var(--blue)} .red{color:var(--danger)} .purple{color:#7b1fa2}
.mini-empty{color:var(--muted);font-size:13px;padding:8px 2px;margin:0}
.listname-tag{font-size:12px;color:var(--muted);border:1px solid var(--line);border-radius:12px;padding:2px 8px;white-space:nowrap;display:inline-flex;align-items:center}

/* Add bar (Google Tasks style) */
.add-bar{
  display:flex;align-items:center;gap:8px;border:1px solid var(--line);border-radius:24px;padding:4px 6px 4px 4px;background:var(--bg);box-shadow:0 1px 2px rgba(0,0,0,.06);
  &:focus-within{border-color:var(--blue);box-shadow:0 1px 4px rgba(26,115,232,.3)}
  & input{flex:1;border:0;outline:0;background:transparent;height:40px;min-width:0}
}
.add-plus{
  width:38px;height:38px;border-radius:50%;color:var(--blue);display:flex;align-items:center;justify-content:center;
  &:hover{background:var(--blue-soft)}
}
.add-go{width:36px;height:36px;border-radius:50%;background:var(--blue);color:#fff;display:flex;align-items:center;justify-content:center}
.quick-add-meta{display:flex;gap:8px;margin:10px 0 0;flex-wrap:wrap}
.qa-group{
  display:flex;align-items:center;gap:4px;border:1px solid var(--line);border-radius:16px;padding:3px 8px 3px 10px;background:var(--bg);min-width:0;
  & > span{font-size:11px;font-weight:500;color:var(--muted);flex:none}
  & button{
    display:inline-flex;align-items:center;gap:4px;font-size:12px;color:var(--muted);border:1px solid transparent;border-radius:12px;padding:4px 8px;white-space:nowrap;
    & .material-icons-outlined{font-size:16px}
    &:hover{border-color:var(--line)}
    &.active{border-color:var(--blue);color:var(--blue);background:var(--blue-soft)}
  }
  & input[type="date"]{border:0;outline:0;background:transparent;color:var(--muted);min-width:0;padding:4px 2px}
  & .qa-seg{display:inline-flex;gap:2px}
  & .qa-seg button{padding:4px 6px}
  & .qa-colors{display:inline-flex;gap:6px;align-items:center;padding:2px}
  & .qa-colors .f-dot{width:18px;height:18px}
}

/* Task rows — ONE shared card design on every page (List, Board, Home):
   flush color edge with square left corners;
   row 1 = [drag] ○ title …labels | row 2 = …buttons.
   Narrow screens stack: title line, labels line, buttons line. */
.task-list{
  list-style:none;margin:10px 0 0;padding:0;display:flex;flex-direction:column;
  &.done{
    & .task-title{color:var(--muted)}
  }
}
.task{
  display:grid;grid-template-columns:auto 1fr auto;align-items:center;column-gap:6px;row-gap:4px;
  background:var(--bg);border:1px solid var(--line-soft);border-inline-start:4px solid var(--task-color,transparent);
  border-radius:0 10px 10px 0;margin:8px 0 4px;padding:13px 15px;position:relative;
  &.dragging{opacity:.5}
  &.drop-above{box-shadow:0 -2px 0 var(--blue)}
  &.drop-below{box-shadow:0 2px 0 var(--blue)}
  &.drop-into{outline:2px dashed var(--blue);outline-offset:-2px}
  &.touch-dragging{opacity:.6;outline:2px dashed var(--blue);outline-offset:-2px}
  &.done-task{
    & .check{
      background:var(--blue);border-color:var(--blue);
      &::after{content:"✓";color:#fff;position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:14px}
    }
    & .task-title{text-decoration:line-through;color:var(--muted)}
  }
  & .check{margin:0}
}
.drag{color:var(--line);cursor:grab;padding:8px 2px;touch-action:none;display:none}
@media (pointer:coarse),(any-pointer:coarse){
  .drag{display:block}
  .task{grid-template-columns:auto auto 1fr auto}
}

/* Compact mobile topbar: give the search field room — keep safe-area so
   the bar never slides under the notch / Dynamic Island in standalone (iOS home-screen) */
@media (max-width:699px){
  .topbar{gap:4px;padding:var(--safe-t) max(4px,var(--safe-r)) 0 max(4px,var(--safe-l))}
  .brand-name{font-size:17px}
  .search-wrap{height:38px}
  .topbar .icon-btn{width:36px;height:36px}
}
/* Narrow: sync pill collapses to its status dot (full text lives in the dialog) */
@media (max-width:600px){
  .sync-pill{padding:8px 10px}
  .sync-pill span:last-child{display:none}
}
@media (max-width:430px){
  .brand-text{display:none}
  .search-wrap input::placeholder{font-size:13px}
}
.check{
  width:22px;height:22px;border:2px solid var(--muted);border-radius:50%;flex:none;margin-top:7px;position:relative;background:transparent;
  &:hover{border-color:var(--blue)}
}
.task-main{display:contents;min-width:0}
.task-titlewrap{grid-column:2;grid-row:2;min-width:0}
@media (pointer:coarse),(any-pointer:coarse){
  .task-titlewrap{grid-column:3}
}
.task-title{width:100%;border:0;outline:0;background:transparent;font-size:15px;padding:6px 2px;min-width:0;text-align:left}
span.task-title{display:block;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
span.task-title.empty{opacity:.55;font-style:italic}
input.task-title{cursor:text}
.task-subs{list-style:none;margin:1px 0 0;padding:0;display:flex;flex-direction:column;gap:2px;font-size:11px;color:var(--muted)}
.task-subs li{display:flex;align-items:center;gap:5px;cursor:pointer;min-width:0}
.task-subs li::before{content:"";width:9px;height:9px;border:1.5px solid var(--muted);border-radius:3px;flex:none}
.task-subs li.done::before{background:var(--blue);border-color:var(--blue)}
.task-subs li span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.task-subs li.done span{text-decoration:line-through}
.task-subs li.more{color:var(--blue)}
.task-subs li.more::before{display:none}
.task-meta{
  display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:12px;color:var(--muted);
  grid-row:1;grid-column:1/-1;padding:0;margin:0;justify-content:flex-end;
}
.badge{
  display:inline-flex;align-items:center;gap:4px;border:1px solid var(--line);border-radius:12px;padding:2px 8px;background:var(--bg);white-space:nowrap;max-width:100%;font:inherit;color:inherit;
  & .material-icons-outlined{font-size:15px}
  &.date.overdue{color:var(--danger);border-color:var(--danger)}
  &.date.today{color:var(--blue);border-color:var(--blue)}
  &.imp-low{color:var(--ok)} &.imp-medium{color:#b06000} &.imp-high{color:var(--danger);font-weight:500}
  &.w-light{color:var(--muted)} &.w-medium{color:#3b6fd4} &.w-heavy{color:#7b1fa2;font-weight:500}
  &.ext{max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--blue)}
  &.recur{color:var(--blue)}
  &.tm{color:#7b1fa2;cursor:pointer}
}
.task-actions{
  display:flex;align-items:center;flex:none;
  grid-row:2;grid-column:3;justify-content:flex-end;margin:0;
}
@media (pointer:coarse),(any-pointer:coarse){
  .task-actions{grid-column:4}
}
.color-dot-btn{width:22px;height:22px;border-radius:50%;border:2px solid var(--bg);box-shadow:0 0 0 1px var(--line);margin-right:2px;padding:0;flex:none}
.sub-progress{font-size:11px;color:var(--muted)}

.empty{
  text-align:center;color:var(--muted);padding:34px 10px;
  & img{opacity:.9}
}

.completed-toggle{
  display:flex;align-items:center;gap:6px;font-size:14px;font-weight:500;color:var(--muted);padding:14px 4px 4px;width:100%;
  &.board-completed{font-size:12px;padding:10px 2px 2px}
  & .chev{transition:transform .2s}
  &[aria-expanded="false"] .chev{transform:rotate(-90deg)}
}

/* Board (All view) — uses the full available width AND height.
   overflow-y:clip (NOT hidden): hidden turns body into a scroll container,
   which corrupts the sticky desktop sidebar's position when arriving from a
   scrolled page (+18px gap at its top). clip locks window scrolling without
   creating a scroll container, so sticky keeps working. */
body.view-board{overflow-y:clip}
body.view-board{
  & .main{max-width:none;display:flex;flex-direction:column;min-height:calc(100dvh - var(--topbar-h) - 28px);padding-bottom:16px}
  & #viewAll{flex:1;display:flex;flex-direction:column;min-height:0}
  & .board{flex:1;min-height:300px;position:sticky;bottom:0}
  & .board-col{max-height:calc(100dvh - 170px)}
}
.board{display:flex;gap:12px;overflow-x:auto;padding:6px 2px 12px;scroll-snap-type:x proximity;scrollbar-width:thin}
.board::-webkit-scrollbar{height:8px}
.board-col{
  flex:0 0 min(380px,90vw);background:var(--bg2);border:1px solid var(--line-soft);border-radius:14px;display:flex;flex-direction:column;max-height:calc(100dvh - 220px);min-height:200px;scroll-snap-align:start;
  &.drop-target{outline:2px dashed var(--blue);outline-offset:-2px}
  &.dragging-col{opacity:.5}
  &.drop-before{box-shadow:-3px 0 0 var(--blue)}
  &.drop-after{box-shadow:3px 0 0 var(--blue)}
  & .col-drag{display:none}
  @media (pointer:coarse),(any-pointer:coarse){
    & .col-drag{display:block}
  }
}
.board-col-head{
  display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--line-soft);
  & h3{margin:0;font-size:14px;font-weight:500;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  & .c{font-size:11px;color:var(--muted)}
}
.board-col-body{overflow-y:auto;padding:4px 8px 8px;flex:1;min-height:60px}
/* Board cards use three separate rows (labels / title / buttons)
   so they never collide; smaller controls + compact badges to fit columns */
.board-col-body{
  & .drag{display:none}
  @media (pointer:coarse),(any-pointer:coarse){
    & .drag{display:block}
  }
  & .badge{
    font-size:11px;padding:1px 6px;
    & .material-icons-outlined{font-size:13px}
  }
  & .task-actions .icon-btn.sm{
    width:22px;height:22px;
    & .material-icons-outlined{font-size:18px}
  }
  & .color-dot-btn{width:14px;height:14px}
}
.col-drag{
  color:var(--line);cursor:grab;touch-action:none;flex:none;font-size:20px;
  &:active{cursor:grabbing}
}
.board-add{
  display:flex;gap:6px;padding:8px;border-bottom:1px solid var(--line-soft);
  & input{
    flex:1;border:1px solid var(--line);border-radius:0;padding:8px;min-width:0;background:var(--bg);outline:0;
    &::placeholder{font-size:12px}
    &:focus{border-color:var(--blue)}
  }
}

/* Time tracker view */
body.view-time{
  & .main{max-width:none}
}
.time-wrap{display:flex;flex-direction:column;gap:16px;align-items:stretch}
.time-tracker{order:-1}
.time-records,.time-tasks,.time-tracker{min-width:0}
#timeTaskList{max-height:calc(100dvh - 330px);min-height:120px;overflow-y:auto}
.time-search{margin:2px 0 8px}
.time-display{
  font-size:clamp(40px,4vw,56px);font-weight:700;text-align:center;letter-spacing:2px;margin:8px 0 4px;
  font-variant-numeric:tabular-nums;user-select:none;
}
#timeForTaskCard .task{margin:8px 0 4px}
#timeForTaskCard .time-empty{text-align:center}
.time-btns{display:flex;gap:12px;justify-content:center;margin:12px 0 4px}
.time-btn{
  width:58px;height:58px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;
  border:1px solid var(--line);color:var(--muted);background:var(--bg);
  & .material-icons-outlined{font-size:28px}
  &:disabled{opacity:.35;cursor:default}
  &:not(:disabled):hover{border-color:var(--blue);color:var(--blue)}
  &.play.active{background:var(--blue);border-color:var(--blue);color:#fff}
  &.pause.active{background:#b06000;border-color:#b06000;color:#fff}
  &.stop:not(:disabled){color:var(--danger)}
}
.time-hint{text-align:center;margin:8px 0 0}
.time-rec{
  display:flex;align-items:center;gap:8px;padding:8px 2px;border-bottom:1px solid var(--line-soft);
  & .time-rec-main{flex:1;min-width:0}
  & .time-rec-title{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
.rec-day-head{display:flex;align-items:center;gap:8px;margin:10px 0 2px}
.rec-day-head:first-child{margin-top:2px}
.rec-day-head > span{font-size:12px;font-weight:500;color:var(--muted)}
.rec-day-head .btn-ghost{font-size:12px;padding:5px 10px;margin-left:auto}
.rec-day-head .btn-ghost .material-icons-outlined{font-size:15px}
.time-pick{
  display:flex;align-items:center;gap:8px;padding:9px 10px;border:1px solid transparent;border-radius:10px;cursor:pointer;
  & .n{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}
  &:hover{background:var(--bg2)}
  &.selected{border-color:var(--blue);background:var(--blue-soft);font-weight:500}
  &.done-task .n{color:var(--muted);text-decoration:line-through}
}
@media (min-width:1024px){
  .time-wrap{flex-direction:row;align-items:flex-start}
  .time-records{flex:1 1 0}
  .time-tasks{flex:1 1 0}
  .time-tracker{flex:1 1 0;order:0;position:sticky;top:calc(var(--topbar-h) + 12px)}
}

/* Calendar view */
body.view-cal{
  & .main{max-width:none}
}
.cal-wrap{display:flex;gap:16px;align-items:flex-start;flex-wrap:wrap}
.cal-main{flex:3 1 480px;min-width:0}
.cal-dow{
  display:grid;grid-template-columns:repeat(7,1fr);gap:4px;margin-bottom:4px;
  & span{text-align:center;font-size:11px;font-weight:500;color:var(--muted);padding:4px 0}
  & span.weekend{background:#f1f3f4;border-radius:6px}
}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}
.cal-cell{
  aspect-ratio:1/1;min-height:64px;border:1px solid var(--line-soft);border-radius:10px;padding:4px;display:flex;flex-direction:column;gap:3px;min-width:0;background:var(--bg);cursor:pointer;
  &.out{border:0;background:transparent;cursor:default}
  &.weekend{background:#f1f3f4}
  &.today{border-color:var(--blue)}
  &.selected{box-shadow:0 0 0 2px var(--blue)}
  &.has-overdue .cal-num{color:var(--danger)}
  &.drop-target{outline:2px dashed var(--blue);outline-offset:-2px}
}
body.dark .cal-dow span.weekend{background:#2a2b2e}
body.dark .cal-cell.weekend{background:#232527}
body.dark .cal-ym-grid span.weekend{background:#232527}
@keyframes calZoomOut{from{transform:scale(1.06);opacity:0}to{transform:none;opacity:1}}
@keyframes calZoomIn{from{transform:scale(.94);opacity:0}to{transform:none;opacity:1}}
@keyframes calSlideL{from{transform:translateX(28px);opacity:.3}to{transform:none;opacity:1}}
@keyframes calSlideR{from{transform:translateX(-28px);opacity:.3}to{transform:none;opacity:1}}
.cal-grid.zoom-out{animation:calZoomOut .2s ease}
.cal-grid.zoom-in{animation:calZoomIn .2s ease}
.cal-grid.slide-l{animation:calSlideL .2s ease}
.cal-grid.slide-r{animation:calSlideR .2s ease}
.cal-year.zoom-out{animation:calZoomOut .2s ease}
.cal-year.slide-l{animation:calSlideL .2s ease}
.cal-year.slide-r{animation:calSlideR .2s ease}
.cal-num{
  width:26px;height:26px;border-radius:50%;font-size:12px;color:var(--muted);flex:none;
  .today > &:not(.selected){background:var(--blue);color:#fff}
  .selected > &{background:var(--blue-soft);color:var(--blue);font-weight:700}
}
.cal-chip{
  display:block;width:100%;text-align:left;font-size:11px;padding:2px 6px 2px 8px;border-radius:0;
  border-left:3px solid var(--task-color,transparent);background:var(--bg2);color:var(--text);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;
  &.done{color:var(--muted);text-decoration:line-through}
  &:hover{filter:brightness(.96)}
}
.cal-num + .cal-chip{margin-top:3px}
body.dark .cal-chip:hover{filter:brightness(1.25)}
.cal-more{font-size:11px;color:var(--blue);text-align:left;padding:0 6px}
.cal-side{flex:1 1 280px;min-width:0;border:1px solid var(--line-soft);border-radius:14px;padding:12px;background:var(--bg)}
.cal-year{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
@media (min-width:700px){.cal-year{grid-template-columns:repeat(3,1fr)}}
@media (min-width:1280px){.cal-year{grid-template-columns:repeat(4,1fr)}}
.cal-ym{
  border:1px solid var(--line-soft);border-radius:14px;padding:10px;background:var(--bg);text-align:left;min-width:0;
  &.current{border-color:var(--blue)}
  &:hover{border-color:var(--blue)}
  & h3{margin:0 0 6px;font-size:13px;font-weight:500}
  &.current h3{color:var(--blue)}
}
.cal-ym-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}
.cal-ym-grid span{
  aspect-ratio:1;display:flex;align-items:center;justify-content:center;
  font-size:10px;color:var(--muted);border-radius:50%;position:relative;
  &.has{color:var(--text);font-weight:700}
  &.has::after{content:"";position:absolute;bottom:1px;width:3px;height:3px;border-radius:50%;background:var(--blue)}
  &.weekend{background:#f1f3f4}
  &.today{background:var(--blue);color:#fff}
}
.cal-agenda-head{display:flex;align-items:center;gap:8px;margin-bottom:4px}
.cal-agenda-head h2{margin:0;font-size:16px;font-weight:500;flex:1}
@media (min-width:1024px){
  .cal-side{position:sticky;top:calc(var(--topbar-h) + 12px);max-height:calc(100dvh - var(--topbar-h) - 24px);overflow-y:auto}
}

/* Detail panel: bottom sheet on mobile, side panel on desktop */
.detail{
  position:fixed;left:0;right:0;bottom:0;top:auto;z-index:35;background:var(--bg);
  border-radius:20px 20px 0 0;box-shadow:var(--shadow-lg);max-height:92dvh;display:flex;flex-direction:column;
  border-top:1px solid var(--line-soft);
  container-type:inline-size;container-name:detail;min-width:0;
  &:not(.hidden){animation:detailIn .3s cubic-bezier(.32,.72,0,1)}
}
/* Bottom sheet slides up from the screen edge (no fade — it is docked, not floating). */
@keyframes detailIn{from{transform:translateY(100%)}to{transform:none}}
@media (min-width:1024px){
  @keyframes detailIn{from{transform:translateX(24px);opacity:0}to{transform:none;opacity:1}}
}
/* Weight + Priority side-by-side only when the panel itself is wide enough */
@container detail (min-width:430px){
  .d-grid{grid-template-columns:1fr 1fr}
}
.detail-head{display:flex;align-items:center;gap:8px;padding:8px;border-bottom:1px solid var(--line-soft)}
.detail-title{flex:1;font-weight:500}
.detail-body{overflow:auto;overflow-x:hidden;padding:12px 16px 16px;display:flex;flex-direction:column;gap:14px;min-width:0}
.d-section{min-width:0}
.d-title{
  font-size:20px;border:0;border-bottom:2px solid transparent;outline:0;padding:8px 2px;background:transparent;width:100%;
  &:focus{border-color:var(--blue)}
}
.d-label{
  font-size:12px;color:var(--muted);font-weight:500;margin:0 0 8px;
  & .hint{font-weight:400;opacity:.8}
}
.palette{display:flex;gap:6px;flex-wrap:wrap}
.swatch{
  width:22px;height:22px;border-radius:50%;border:2px solid transparent;position:relative;flex:none;
  &.selected{border-color:var(--blue);box-shadow:0 0 0 2px var(--blue-soft)}
}
.d-grid{display:grid;grid-template-columns:1fr;gap:14px;min-width:0}
.d-grid>*{min-width:0}
.segmented{
  display:flex;background:var(--bg2);border-radius:12px;padding:4px;gap:4px;min-width:0;
  & button{
    flex:1 1 0;min-width:0;display:flex;align-items:center;justify-content:center;gap:4px;font-size:12px;padding:8px 2px;border-radius:9px;color:var(--muted);white-space:nowrap;overflow:hidden;
    & .material-icons-outlined{font-size:16px;flex:none}
    &.selected{background:var(--bg);color:var(--text);box-shadow:var(--shadow);font-weight:500}
  }
  &.importance{
    & button.selected[data-v="low"]{color:var(--ok)}
    & button.selected[data-v="medium"]{color:#b06000}
    & button.selected[data-v="high"]{color:var(--danger)}
  }
}
.d-row{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0;
  & input[type="date"],& input[type="time"]{border:1px solid var(--line);border-radius:10px;padding:10px;background:var(--bg);min-width:0;flex:1}
  & input[type="time"]{flex:0 1 128px}
  & input[type="date"]{flex:1 1 140px;min-width:0}
  & select{flex:1;border:1px solid var(--line);border-radius:10px;padding:10px;background:var(--bg);min-width:0}
}
#dRecurN{
  width:64px;flex:none;border:1px solid var(--line);border-radius:10px;padding:10px;background:var(--bg);outline:0;
  &:focus{border-color:var(--blue)}
}
#dRecurUnit{flex:1}
.day-chips{
  display:flex;gap:6px;flex-wrap:wrap;margin-top:8px;
  & button{
    width:36px;height:36px;border-radius:50%;border:1px solid var(--line);color:var(--muted);font-size:12px;font-weight:500;
    &.selected{border-color:var(--blue);color:var(--blue);background:var(--blue-soft)}
  }
}
#dExt{
  flex:1;border:1px solid var(--line);border-radius:10px;padding:10px 12px;outline:0;min-width:0;background:var(--bg);
  &:focus{border-color:var(--blue)}
}
.muted{color:var(--muted)} .small{font-size:12px}
#dNotes{
  width:100%;border:1px solid var(--line);border-radius:10px;padding:10px;background:var(--bg);resize:vertical;outline:0;min-height:160px;
  &:focus{border-color:var(--blue)}
}
.sub-list{
  list-style:none;margin:0 0 6px;padding:0;display:flex;flex-direction:column;gap:2px;
  & input[type="text"]{flex:1;border:0;outline:0;background:transparent;min-width:0}
  & li{
    display:flex;align-items:center;gap:8px;padding:6px 2px;border-bottom:1px dashed var(--line-soft);
    & .check{margin:0}
    &.done input{text-decoration:line-through;color:var(--muted)}
  }
}
.sub-add{
  display:flex;align-items:center;gap:8px;color:var(--muted);border:1px dashed var(--line);border-radius:10px;padding:8px 10px;
  & input{flex:1;border:0;outline:0;background:transparent;min-width:0}
}
.detail-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 16px calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--line-soft)}
.detail-foot-actions{display:flex;align-items:center;gap:8px;flex:none}
.btn-soft{
  background:var(--blue-soft);color:var(--blue);border-radius:20px;padding:10px 18px;font-weight:500;display:inline-flex;align-items:center;gap:6px;
  &:hover{filter:brightness(.96)}
}
.btn-primary{
  background:var(--blue);color:#fff;border-radius:20px;padding:10px 18px;font-weight:500;display:inline-flex;align-items:center;gap:6px;
  &:hover{background:var(--blue-dark)}
  &.danger{
    background:var(--danger);
    &:hover{background:#a50e0e}
  }
}

/* Menus / popups / toast */
.menu{
  position:absolute;background:var(--bg);border-radius:12px;box-shadow:var(--shadow-lg);padding:6px;z-index:60;min-width:210px;border:1px solid var(--line-soft);
  & button{
    display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;border-radius:8px;text-align:left;font-size:14px;
    &:hover{background:rgba(60,64,67,.08)}
    &.danger{color:var(--danger)}
    &.selected{color:var(--blue);font-weight:500;background:var(--blue-soft)}
  }
}
#sortMenu{position:absolute;top:calc(100% + 6px);right:0}
#listMenu{position:absolute;top:calc(100% + 4px);right:0}
.palette-pop{
  display:flex;gap:4px;padding:10px;position:fixed;z-index:120;flex-wrap:nowrap;max-width:94vw;
  & .swatch{width:16px;height:16px}
  &.mini{
    gap:4px;padding:6px;max-width:min(300px,94vw);
    & .swatch{width:12px;height:12px}
  }
}
.swatch-wrap{
  display:flex;align-items:center;justify-content:center;min-width:0;flex:1 1 0;
  border-radius:8px;padding:9px 2px;min-height:42px;
  &:hover{filter:brightness(.9)}
}
.palette-pop.mini .swatch-wrap{min-height:34px;padding:7px 2px}
.swatch-label{color:#fff;font-size:10px;font-weight:500;line-height:1.2;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 1px 2px rgba(0,0,0,.4)}
#weightPop,#importancePop{
  position:fixed;z-index:120;
  & button{
    padding:6px 10px;font-size:13px;
    &.selected{color:var(--blue);font-weight:500}
    & .material-icons-outlined{font-size:16px}
  }
}
#movePop{position:fixed;z-index:120}
.toast{
  position:fixed;left:50%;transform:translateX(-50%);bottom:calc(84px + env(safe-area-inset-bottom));
  background:#323232;color:#fff;border-radius:10px;padding:12px 14px;display:flex;gap:14px;align-items:center;
  z-index:220;box-shadow:var(--shadow-lg);max-width:min(92vw,480px);font-size:14px;
  & button{color:#8ab4f8;font-weight:500}
}

/* In-app modal (no browser popups) */
.modal-scrim{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:200;display:flex;align-items:center;justify-content:center;padding:16px}
.modal{
  background:var(--bg);border-radius:16px;box-shadow:var(--shadow-lg);padding:20px;width:min(400px,100%);display:flex;flex-direction:column;gap:10px;
  & h3{margin:0;font-size:17px}
  & p{margin:0}
  & h3:empty,& p:empty{display:none}
  & input{
    border:1px solid var(--line);border-radius:10px;padding:10px 12px;outline:0;background:var(--bg);min-width:0;
    &:focus{border-color:var(--blue)}
  }
}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}

/* Inline new-list creator (replaces the button in place) */
.list-creator{
  display:flex;align-items:center;gap:4px;padding:6px 8px;margin-top:4px;
  & input{flex:1;border:1px solid var(--blue);border-radius:16px;padding:8px 12px;outline:0;min-width:0;background:var(--bg)}
}

.desktop-only{display:none!important}

/* Tablet+ */
@media (min-width:700px){
  .search-wrap{max-width:420px}
  .main{padding:20px 28px 80px}
  .home-grid{grid-template-columns:1fr 1fr}
}

/* Desktop: persistent sidebar + right detail panel, like Google Tasks */
@media (min-width:1024px){
  .desktop-only{display:inline-flex!important}
  .sidebar{position:sticky;top:var(--topbar-h);height:calc(100dvh - var(--topbar-h));transform:none;width:var(--side-w);flex:none}
  .scrim{display:none!important}
  .resizer-side{display:block}
  .resizer-detail{display:block}
  .detail{position:sticky;top:var(--topbar-h);height:calc(100dvh - var(--topbar-h));max-height:none;width:var(--detail-w);flex:none;border-radius:0;border:0;border-left:1px solid var(--line-soft);box-shadow:none}
  #detailBack{display:none}
  body.side-collapsed .sidebar{display:none}
  .board-col{flex:1 1 0;min-width:320px;max-width:560px}
  .board{overflow-x:auto}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

/* Command palette */
.palette-box{
  background:var(--bg);border-radius:16px;box-shadow:var(--shadow-lg);
  width:min(560px,100%);max-height:min(70dvh,560px);display:flex;flex-direction:column;overflow:hidden;
  align-self:flex-start;margin-top:12dvh;
}
.palette-input-wrap{
  display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid var(--line-soft);
  & .material-icons-outlined{color:var(--muted)}
  & input{flex:1;border:0;outline:0;background:transparent;font-size:16px;min-width:0}
}
.palette-list{list-style:none;margin:0;padding:6px;overflow-y:auto;min-height:0}
.palette-item{
  display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;cursor:pointer;font-size:14px;
  & .material-icons-outlined{color:var(--muted);flex:none}
  & .hint{margin-left:auto;font-size:12px;color:var(--muted);flex:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:40%}
  &.selected{background:var(--blue-soft)}
  &.selected .material-icons-outlined{color:var(--blue)}
}
.palette-empty{color:var(--muted);font-size:14px;padding:14px;text-align:center}
.palette-hint{margin:0;padding:8px 14px;border-top:1px solid var(--line-soft)}

/* Shortcuts help */
.help-modal{width:min(520px,100%);max-height:min(80dvh,640px);display:flex;flex-direction:column}
#helpTable{overflow-y:auto;min-height:0}
.help-row{display:flex;align-items:center;gap:10px;padding:7px 2px;border-bottom:1px solid var(--line-soft);font-size:14px}
.help-row:last-child{border-bottom:0}
.help-keys{display:flex;gap:4px;flex:none;min-width:130px;flex-wrap:wrap}
kbd{
  font-family:inherit;font-size:12px;background:var(--bg2);border:1px solid var(--line);
  border-bottom-width:2px;border-radius:6px;padding:2px 7px;white-space:nowrap;
}

/* Keyboard selection ring on task rows */
.task.kb-selected{outline:2px solid var(--blue);outline-offset:2px}

/* Sidebar ghost links + even button rows */
a.btn-ghost{text-decoration:none}
.io-row .btn-ghost{flex:1;justify-content:center}

/* Sync status pill (navbar) */
.sync-pill{
  display:inline-flex;align-items:center;gap:7px;font-size:12px;color:var(--muted);
  border:1px solid var(--line);border-radius:16px;padding:6px 11px;white-space:nowrap;max-width:190px;
  &:hover{border-color:var(--blue);color:var(--blue)}
  & .dot{width:8px;height:8px;border-radius:50%;background:var(--muted);flex:none}
  & span:last-child{overflow:hidden;text-overflow:ellipsis}
  &.ok .dot{background:var(--ok)}
  &.ok{color:var(--muted)}
  &.warn .dot{background:#b06000}
  &.warn{color:#b06000}
  &.err .dot{background:var(--danger)}
  &.err{color:var(--danger)}
  &.busy .dot{background:var(--blue);animation:pulse 1s infinite}
}
@keyframes pulse{50%{opacity:.35}}

/* Sync & Settings (sidebar button + dialog) */
.btn-account{
  display:flex;align-items:center;gap:8px;width:100%;background:var(--blue);color:#fff;
  border-radius:18px;padding:10px 14px;font-weight:500;margin-top:6px;
  &:hover{background:var(--blue-dark)}
  & .material-icons-outlined{font-size:20px;flex:none}
  & .t{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  & .s{font-size:11px;font-weight:400;opacity:.85;flex:none}
}
.account-row{display:flex;gap:8px;align-items:center}
.account-row .btn-account{flex:1;min-width:0}
.trash-btn{position:relative;flex:none;border:1px solid var(--line);margin-top:6px}
.trash-btn .c{position:absolute;top:-5px;right:-5px;font-size:10px;line-height:16px;min-width:16px;text-align:center;background:var(--blue);color:#fff;border-radius:10px;padding:0 4px}

/* Account dialog */
.account-modal{width:min(600px,100%);max-height:min(92dvh,800px);overflow-y:auto; min-height: 440px;}
.set-group{margin:6px 0}
.set-group .d-label{margin-bottom:10px}
.color-names{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px 10px}
.color-row{display:flex;align-items:center;gap:4px;min-width:0}
.color-row .dot{width:14px;height:14px;border-radius:50%;flex:none;box-shadow:0 0 0 1px var(--line)}
.color-row input{flex:1;border:1px solid var(--line);border-radius:8px;padding:6px 10px;font-size:13px;outline:0;min-width:0;background:var(--bg)}
.color-row input:focus{border-color:var(--blue)}
.color-row .icon-btn.sm{width:20px;height:20px;flex:none}
.color-row .icon-btn.sm .material-icons-outlined{font-size:15px}
.color-add-row{margin-top:8px;gap:6px;align-items:center}
.color-add-row input[type="color"]{width:28px;height:28px;padding:2px;border:1px solid var(--line);border-radius:8px;background:var(--bg);flex:none;cursor:pointer}
.color-add-row #customColorName{padding:6px 10px;font-size:16px}
.color-add-row #customColorAdd{padding:6px 10px;font-size:13px}
.sync-err{color:var(--danger);font-size:13px;margin:6px 0 0}
.account-actions{justify-content:flex-start;flex-wrap:wrap}

/* Sync history log */
.log-modal{width:min(480px,100%);max-height:min(80dvh,600px);display:flex;flex-direction:column}
.diag-box{background:var(--bg2);border:1px solid var(--line-soft);border-radius:12px;padding:10px 12px;margin-bottom:8px}
.diag-text{margin:0 0 8px;font-family:Consolas,monospace;font-size:11px;line-height:1.5;color:var(--muted);white-space:pre-wrap;word-break:break-all}
.diag-box .btn-ghost{font-size:12px;padding:6px 10px}
.sync-log{list-style:none;margin:0 0 6px;padding:0;overflow-y:auto;min-height:0}
.log-row{display:flex;gap:10px;padding:7px 2px;border-bottom:1px solid var(--line-soft);font-size:13px}
.log-row:last-child{border-bottom:0}
.log-t{color:var(--muted);font-size:12px;flex:none;min-width:150px}
.log-row.error{color:var(--danger)}
.log-row.conflict{color:#b06000}
.account-actions{justify-content:flex-start;flex-wrap:wrap}
.account-actions .btn-ghost .material-icons-outlined{font-size:18px}
.setup-row{display:flex;gap:8px;margin-top:8px}
.setup-row input{flex:1;border:1px solid var(--line);border-radius:10px;padding:9px 12px;outline:0;min-width:0;background:var(--bg)}
.setup-row input:focus{border-color:var(--blue)}

/* Import source picker */
.import-row select{
  flex:1.2;min-width:0;border:1px solid var(--line);border-radius:18px;padding:8px 30px 8px 12px;font-size:13px;
  color:var(--muted);background:var(--bg);outline:0;cursor:pointer;
  appearance:none;-webkit-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 12px center;
  &:focus{border-color:var(--blue)}
}

/* Pull-to-refresh indicator */
.ptr-sync{
  position:fixed;top:calc(var(--topbar-h) + 8px);left:50%;transform:translateX(-50%);z-index:90;
  display:inline-flex;align-items:center;gap:8px;background:var(--bg);
  border:1px solid var(--line-soft);box-shadow:var(--shadow);border-radius:20px;
  padding:8px 16px;font-size:13px;color:var(--muted);white-space:nowrap;
  &.ready{color:var(--blue);border-color:var(--blue)}
  & .material-icons-outlined{font-size:18px}
  &.ready .material-icons-outlined{animation:ptrspin 1s linear infinite}
}
@keyframes ptrspin{to{transform:rotate(360deg)}}

/* Sync conflict dialog (batched review: one modal for all conflicts) */
.conflict-modal{width:min(540px,100%);max-height:min(84dvh,640px);display:flex;flex-direction:column}
.conflict-title{font-weight:500;margin:0}
#conflictCount:empty{display:none}
.conflict-list{overflow-y:auto;min-height:0;margin:6px 0 4px;display:flex;flex-direction:column;gap:12px}
.conflict-item{border-top:1px solid var(--line-soft);padding-top:10px}
.conflict-item:first-child{border-top:0;padding-top:0}
.conflict-item-head{display:flex;align-items:center;gap:8px;margin-bottom:2px}
.conflict-item-title{font-weight:500;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.conflict-sub{margin:0 0 6px}
.conflict-pick{margin-top:8px}
.conflict-diff{display:grid;grid-template-columns:auto 1fr 1fr;gap:5px 12px;font-size:13px;min-height:0}
.conflict-diff .cd-h{font-size:11px;font-weight:500;color:var(--muted)}
.conflict-diff .cd-f{color:var(--muted);white-space:nowrap}
.conflict-diff span{min-width:0;overflow:hidden;text-overflow:ellipsis}
.conflict-actions{flex-wrap:wrap}

/* Settings tabs (Sync first, then Labels, Home page, General) */
.set-tabs{display:flex;gap:4px;background:var(--bg2);border-radius:14px;padding:3px;margin:4px -10px 12px;overflow-x:auto}
.set-tabs button{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--muted);border-radius:11px;padding:8px 6px;white-space:nowrap;flex:1;justify-content:center;min-width:0}
@media (max-width:400px){
  .set-tabs button .material-icons-outlined{display:none}
}
.set-tabs button .material-icons-outlined{font-size:18px}
.set-tabs button.selected{background:var(--bg);color:var(--text);box-shadow:var(--shadow);font-weight:500}
.set-pane{display:flex;flex-direction:column;gap:8px}
#homeToggles{display:flex;flex-direction:column;gap:10px}

/* Notes (Google Keep style masonry) */
.notes-search{margin:0 0 12px}
.notes-search input{flex:1;border:0;outline:0;background:transparent;height:40px;min-width:0}
.notes-search{display:flex;align-items:center;gap:8px;border:1px solid var(--line);border-radius:24px;padding:4px 12px;background:var(--bg);box-shadow:0 1px 2px rgba(0,0,0,.06)}
.notes-search:focus-within{border-color:var(--blue)}
.note-add{border:1px solid var(--line);border-radius:16px;padding:12px;background:var(--bg);box-shadow:0 1px 2px rgba(0,0,0,.06);margin-bottom:18px}
.note-add input,.note-add textarea{width:100%;border:0;outline:0;background:transparent;font:inherit;resize:vertical}
.note-add input{font-weight:500;font-size:16px;margin-bottom:10px}
.note-add textarea{font-size:16px;min-height:160px}
.note-add-row{display:flex;align-items:center;gap:8px;margin-top:8px;flex-wrap:nowrap}
.note-add-row .qa-colors{display:inline-flex;gap:8px;align-items:center;flex:1;min-width:0;overflow-x:auto;padding:4px}
.note-add-row .add-note-btn{flex:none;width:40px;height:40px;border-radius:50%;padding:0;justify-content:center}
.notes-head{font-size:13px;font-weight:500;color:var(--muted);display:flex;align-items:center;gap:6px;margin:18px 0 10px}
.notes-head .material-icons-outlined{font-size:17px}
.notes-grid{display:flex;flex-direction:column;gap:12px}
.note-card{display:block;width:auto;margin:0;border:1px solid var(--line);border-left:6px solid var(--note-c,#9aa0a6);border-radius:0 12px 12px 0;padding:12px 12px 8px;background:var(--bg);cursor:pointer;position:relative}
.note-foot .color-dot-btn{margin-right:auto}
.note-card:hover{box-shadow:var(--shadow)}
.note-card h3{margin:0 26px 6px 0;font-size:15px;font-weight:500}
.note-card .note-body{margin:0;font-size:14px;white-space:pre-wrap;word-break:break-word;display:-webkit-box;-webkit-line-clamp:12;-webkit-box-orient:vertical;overflow:hidden}
.note-card .note-body.muted{color:var(--muted);font-style:italic}
.note-pin{position:absolute;top:6px;right:6px;opacity:.45}
.note-pin.on{opacity:1;color:var(--blue)}
.note-card:hover .note-pin{opacity:1}
.note-foot{display:flex;align-items:center;justify-content:flex-end;gap:2px;margin-top:8px}
.note-foot .icon-btn.sm.on{color:var(--blue)}
.note-foot .btn-ghost.sm{font-size:12px;padding:5px 10px}
.note-title-input,.note-body-input{width:100%;border:0;outline:0;background:transparent;font:inherit;color:var(--text);resize:vertical}
.note-title-input{font-weight:500;font-size:16px;margin:0 26px 4px 0;width:calc(100% - 30px)}
.note-body-input{font-size:16px;min-height:160px}
.note-title-input:focus,.note-body-input:focus{background:var(--bg2);border-radius:8px}
.palette-dot{width:26px;height:26px;border-radius:50%;border:2px solid var(--bg);box-shadow:0 0 0 1px var(--line);padding:0}
.palette-dot.selected{box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--blue)}
.note-modal input.d-title,.note-modal textarea{width:100%;border:1px solid var(--line);border-radius:10px;padding:8px 12px;font:inherit;background:var(--bg);color:var(--text);outline:0}
.note-modal input.d-title:focus,.note-modal textarea:focus{border-color:var(--blue)}
.note-modal textarea{resize:vertical;margin-top:8px;min-height:min(46dvh,420px)}
/* Compact options row: swatches + icon toggles share one line */
.note-options{display:flex;align-items:center;gap:6px;min-width:0}
.note-options .palette{flex:1 1 auto;min-width:0;flex-wrap:nowrap;overflow-x:auto;padding:2px}
.note-options .spacer{flex:1}
.note-options .palette-dot{width:18px;height:18px;flex:none}
.switch-icon{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;cursor:pointer;color:var(--muted);flex:none;position:relative}
.switch-icon:hover{background:var(--bg2);color:var(--text)}
.switch-icon input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;margin:0}
.switch-icon .material-icons-outlined{font-size:19px;pointer-events:none}
.switch-icon input:checked ~ .material-icons-outlined{color:var(--blue)}
.switch-icon input:focus-visible ~ .material-icons-outlined{box-shadow:0 0 0 2px var(--blue-soft)}
.note-modal .palette{margin:6px 0}
.note-actions .spacer{flex:1}
/* Note editor: bottom sheet on mobile, like the task detail panel */
@keyframes noteSheetIn{from{transform:translateY(100%)}to{transform:none}}
@media (max-width:1023px){
  #noteScrim{align-items:flex-end;padding:0}
  .note-modal{width:100%;max-width:none;border-radius:20px 20px 0 0;border:0;border-top:1px solid var(--line-soft);box-shadow:var(--shadow-lg);max-height:92dvh;overflow-y:auto;padding-bottom:calc(20px + env(safe-area-inset-bottom));animation:noteSheetIn .3s cubic-bezier(.32,.72,0,1)}
}
.btn-ghost.sm{font-size:12px;padding:5px 10px}
.btn-ghost.danger{color:var(--danger);border-color:var(--danger)}
.btn-ghost.danger:hover{border-color:var(--danger);color:var(--danger)}
.icon-btn.danger{color:var(--danger)}
.icon-btn.on{color:var(--blue)}

/* Home pinned notes */
#homeNotesCard{margin-bottom:24px}
.home-notes{display:flex;flex-direction:column;gap:12px}
.home-notes .note-card{cursor:default}

/* Trash */
.trash-row{align-items:center}
.trash-meta{flex:1;min-width:0}
.trash-title{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.trash-sub{margin-top:2px}
.trash-row .restore-btn{flex:none}
.trash-actions{display:flex;align-items:center;gap:4px}
.trash-actions .material-icons-outlined{font-size:18px}
#viewTrash .notes-head{margin-top:22px}
/* Trash header fits one line on narrow screens: icon-only button beside the title */
@media (max-width:600px){
  #viewTrash .list-header > div{min-width:0}
  #viewTrash .list-header .board-hint{display:none}
  #emptyTrashBtn{width:40px;height:40px;padding:0;justify-content:center}
  #emptyTrashBtn .btn-label{display:none}
}

/* Compact mobile task cards: badges own the full top row, actions sit on the
   title row where the space is. Must stay last in file: equal-specificity
   overrides of the base task rules. */
@media (max-width:600px){
  .cal-cell{aspect-ratio:auto;min-height:56px}
  .task{column-gap:4px;padding:10px 12px}
  .task-meta{grid-row:1;grid-column:1/-1;justify-content:flex-start}
  .task-meta .badge{font-size:11px;padding:1px 6px}
  .task-meta .badge .material-icons-outlined{font-size:13px}
  .task-actions{grid-row:2;grid-column:-2;justify-content:flex-end;gap:2px}
  .task-actions .icon-btn.sm{width:26px;height:26px}
  .task-actions .icon-btn.sm .material-icons-outlined{font-size:19px}
  .task-actions [title="Move to list"],.task-actions [title="Track time on this task"]{display:none}
  .task-actions .color-dot-btn{width:18px;height:18px}
  .home-grid{gap:14px}
  .card{padding:14px}
  .card h2{margin:0 0 10px}
}
