:root{--bg:#081126;--surface:#0d1a38;--line:#1b2c52;--fg:#e8eefc;--muted:#9db0d6;--dim:#4a5a7d;--blue:#0b63ff;--cyan:#1ec8ff;--link:#6fb0ff;--danger:var(--warn);
--b-bg:#123a8f;--b-fg:#e8eefc;--b-dot:#4f8cff;--t-bg:#0f5a5a;--t-fg:#e6fffb;--t-dot:#2fc4b2;--p-bg:#3b2a7a;--p-fg:#efe9ff;--p-dot:#9b82f0;--o-bg:#7a3a12;--o-fg:#ffeede;--o-dot:#f0914f;
--font:"Poppins",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;--hour:56px;--warn:#ff8a8a;--fac:#f0b37e;--hol-bg:rgba(255,138,138,.06);--clash-chip:#ffb0b0;--toast-bg:#e8eefc;--toast-fg:#081126;color-scheme:dark}
/* tema claro (menu do usuário → Tema) */
:root[data-theme="light"]{--bg:#f3f6fb;--surface:#ffffff;--line:#d9e1ee;--fg:#14213d;--muted:#5b6b8c;--dim:#a9b4c8;--blue:#0b63ff;--cyan:#0a8fc7;--link:#0b5cd6;--danger:#d63a3a;
--b-bg:#dce8ff;--b-fg:#0c2a6b;--b-dot:#3a76f0;--t-bg:#d4f2ee;--t-fg:#0b4a44;--t-dot:#12a08f;--p-bg:#e9e2ff;--p-fg:#33206e;--p-dot:#7a5be0;--o-bg:#ffe5d1;--o-fg:#6b2d07;--o-dot:#e2742a;
--warn:#d32f2f;--fac:#c26a0c;--hol-bg:rgba(211,47,47,.06);--clash-chip:#c62828;--toast-bg:#14213d;--toast-fg:#ffffff;color-scheme:light}
:root[data-theme="light"] .pill.primary,:root[data-theme="light"] .fab{color:#031230}
:root[data-theme="light"] dialog::backdrop{background:rgba(20,33,61,.45)}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--fg);font-family:var(--font);font-size:15px;line-height:1.4;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
[hidden]{display:none!important}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.muted{color:var(--muted)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}

#app{max-width:760px;margin:0 auto;height:100%;display:flex;flex-direction:column;padding-top:env(safe-area-inset-top,0px)}
.top{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"title actions" "nav nav";align-items:center;gap:10px 12px;padding:16px 16px 0}
h1{grid-area:title;margin:0;font-size:26px;font-weight:700;letter-spacing:-.02em;line-height:1.15}
.top-actions{grid-area:actions;display:flex;align-items:center;gap:8px}
.nav{grid-area:nav;display:flex;align-items:center;gap:4px;min-width:0}
#period{flex:1 1 auto;min-width:0;text-align:center;font-size:16px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.nav-btn{flex:none}
.user-menu{position:relative}
.user-btn{width:44px;height:44px;border-radius:22px;border:1px solid var(--line);background:linear-gradient(135deg,var(--blue),var(--cyan));color:#031230;font-weight:700;font-size:16px;display:flex;align-items:center;justify-content:center;padding:0}
.user-pop{position:absolute;right:0;top:calc(100% + 8px);z-index:20;min-width:250px;padding:6px;border-radius:12px;background:var(--surface);border:1px solid var(--line);box-shadow:0 12px 32px rgba(0,0,0,.45)}
.user-pop p{margin:0;padding:8px 10px 10px;border-bottom:1px solid var(--line);display:flex;flex-direction:column}
.user-pop small{font-size:11px;color:var(--muted)}
.user-pop b{font-size:14px;font-weight:600}
.user-pop button{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;margin-top:4px;padding:0 10px;border:0;border-radius:8px;background:none;text-align:left;font-size:14px}
.user-pop button:hover{background:rgba(47,128,255,.1)}
.user-pop svg{width:18px;height:18px}
.theme-pick{padding:8px 10px 10px;border-bottom:1px solid var(--line)}
.theme-pick small{display:block;font-size:11px;color:var(--muted);margin-bottom:6px}
.theme-pick div{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:3px;border-radius:10px;background:var(--bg);border:1px solid var(--line)}
.user-pop .theme-pick button{min-height:34px;margin:0;padding:0;justify-content:center;border-radius:7px;font-size:12px;color:var(--muted)}
.user-pop .theme-pick button[aria-pressed="true"]{background:var(--blue);color:#fff;font-weight:600}
.icon-btn{width:44px;height:44px;border-radius:22px;border:1px solid var(--line);background:var(--surface);display:flex;align-items:center;justify-content:center;padding:0}
.icon-btn[aria-pressed="true"]{color:var(--cyan);border-color:var(--cyan)}
.seg{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin:14px 16px 0;padding:4px;border-radius:14px;background:var(--surface);border:1px solid var(--line)}
.seg button{height:44px;border:0;border-radius:10px;background:transparent;color:var(--muted);font-weight:500;font-size:14px}
.seg button[aria-pressed="true"]{background:var(--blue);color:#fff;font-weight:600}

main{flex:1 1 auto;min-height:0;overflow-y:auto;margin-top:12px;outline:none}

/* listas (Dia e 3 dias) */
.lists{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;padding:0 16px 8px}
@media (min-width:720px){.lists{grid-template-columns:repeat(var(--n),minmax(0,1fr))}}
.lday{padding:14px;border-radius:16px;background:var(--surface);border:1px solid var(--line);display:flex;flex-direction:column;gap:10px;min-width:0}
.lday.today{border-color:var(--blue)}
.lday h2{margin:0;display:flex;justify-content:space-between;align-items:baseline;gap:8px}
.lday-title{position:relative;padding:0 0 0 14px;border:0;background:none;text-align:left;font-size:15px;font-weight:700}
.lday-title::before{content:"";position:absolute;left:0;top:50%;width:4px;height:18px;border-radius:2px;background:linear-gradient(180deg,var(--blue),var(--cyan));transform:translateY(-50%)}
.lday-count{font-size:12px;font-weight:400;color:var(--muted);white-space:nowrap}
.lrows{display:flex;flex-direction:column}
.lrow{display:grid;grid-template-columns:44px minmax(0,1fr);align-items:center;min-height:48px;padding:2px 0;border-left:4px solid var(--b-dot);border-radius:8px}
.lmain{display:grid;grid-template-columns:52px minmax(0,1fr);gap:10px;align-items:center;min-height:44px;padding:6px 10px 6px 0;border:0;background:none;text-align:left;min-width:0}
.chk{width:44px;height:44px;border:0;background:none;display:flex;align-items:center;justify-content:center;padding:0;color:transparent}
.chk::before{content:"";position:absolute;width:22px;height:22px;border-radius:11px;border:2px solid var(--muted)}
.chk{position:relative}
.chk svg{position:relative;width:14px;height:14px;stroke-width:3}
.chk:hover{color:var(--muted)}
.chk[aria-pressed="true"]{color:#031230}
.chk[aria-pressed="true"]::before{background:var(--cyan);border-color:var(--cyan)}
.lrow.done{opacity:.55}
.lrow.done span,.row.done span{text-decoration:line-through}
.row.done{opacity:.55}
.late-box{padding:8px 0;border-radius:12px;background:rgba(255,138,138,.07);border:1px solid rgba(255,138,138,.25)}
.late-box h3{margin:0 0 4px;padding:0 12px;font-size:12px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--danger)}
.late-box .lrow{margin-inline:6px}
.lrow.late time small{color:var(--danger)}
.pill.ok{color:var(--cyan)}
.lrow+.lrow{margin-top:4px}
.lmain:hover{background:rgba(47,128,255,.06)}
.lrow time{font-size:13px;font-weight:700;font-variant-numeric:tabular-nums;display:flex;flex-direction:column;line-height:1.2}
.lrow time small{font-size:11px;font-weight:400;color:var(--muted)}
.lrow span{font-size:14px;font-weight:500;overflow-wrap:anywhere}
.lrow.t{border-left-color:var(--t-dot)}.lrow.p{border-left-color:var(--p-dot)}.lrow.o{border-left-color:var(--o-dot)}
.lrow.past{opacity:.5}
.c-b{background:var(--b-bg);color:var(--b-fg)}.c-t{background:var(--t-bg);color:var(--t-fg)}
.c-p{background:var(--p-bg);color:var(--p-fg)}.c-o{background:var(--o-bg);color:var(--o-fg)}

/* mês */
.month{padding:0 12px}
.wd,.mgrid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}
.wd span{text-align:center;font-size:11px;font-weight:500;letter-spacing:.08em;color:var(--muted);padding:4px 0 6px}
.mgrid{row-gap:2px}
.cell{height:52px;border:0;background:transparent;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:0}
.cell.dim{color:var(--dim)}
.cell b{width:32px;height:32px;border-radius:16px;display:flex;align-items:center;justify-content:center;font-size:15px;font-weight:500}
.cell.today b{background:var(--blue);color:#fff;font-weight:600}
.cell.sel b{box-shadow:0 0 0 2px var(--cyan)}
.dots{display:flex;gap:3px;height:6px}
.dots i{width:6px;height:6px;border-radius:3px}
.dots .b{background:var(--b-dot)}.dots .t{background:var(--t-dot)}.dots .p{background:var(--p-dot)}.dots .o{background:var(--o-dot)}
.daylist{margin:16px 4px 0;padding:16px;border-radius:16px;background:var(--surface);border:1px solid var(--line);display:flex;flex-direction:column;gap:10px}
.daylist h2{margin:0;font-size:15px;font-weight:600;display:flex;justify-content:space-between;gap:8px;align-items:baseline}
.daylist h2 span{font-size:12px;font-weight:400;color:var(--muted)}
.row{display:grid;grid-template-columns:48px minmax(0,1fr);gap:12px;align-items:center;border:0;background:none;padding:0;text-align:left}
.row time{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}
.row span{font-size:14px;font-weight:500;padding:8px 10px;border-radius:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.empty{color:var(--muted);font-size:14px;margin:0}
/* feriados */
.cell.hol b{color:var(--warn);font-weight:700}
.cell.hol.fac b{color:var(--fac)}
.cell.today.hol b{color:#fff}
.hol-name{display:none}
/* conflito de horário entre pendentes */
time.clash,.lrow time.clash,.row time.clash{color:var(--warn)!important;font-weight:700}
.lrow time.clash small{color:var(--warn)}
.chip em{font-style:normal}
.chip em.clash{color:var(--clash-chip);font-weight:700;text-decoration:underline;text-underline-offset:2px}
.hol-line{margin:0;font-size:12px;font-weight:600;color:var(--warn)}
.hol-line.fac{color:var(--fac);font-weight:500}
@media (min-width:960px){
  .cell .hol-name{display:block;font-size:10.5px;line-height:1.2;color:var(--warn);text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-top:-2px}
  .cell.hol.fac .hol-name{color:var(--fac)}
  .cell.hol{background:linear-gradient(var(--hol-bg),var(--hol-bg)),var(--bg)}
  .cell.hol:hover,.cell.hol.sel{background:linear-gradient(var(--hol-bg),var(--hol-bg)),var(--surface)}
}

.login{min-height:100%;display:flex;align-items:center;justify-content:center;padding:24px 16px}
.login-card{width:min(360px,100%);display:flex;flex-direction:column;align-items:stretch;gap:14px;padding:28px 24px;border-radius:20px;background:var(--surface);border:1px solid var(--line);text-align:center}
.login-card img{align-self:center;border-radius:16px}
.login-card h1{margin:0}
.login-card p.muted{margin:-10px 0 4px}
.login-card .f{text-align:left}
.login-card input[type=password],.login-card input[type=text]{width:100%;min-height:48px;padding:10px 14px;border-radius:12px;border:1px solid var(--line);background:var(--bg);font-size:16px}
.login-card .pill{width:100%}
.bar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px calc(16px + env(safe-area-inset-bottom,0px))}
.pill{height:48px;padding:0 22px;border-radius:24px;border:1px solid var(--line);background:var(--surface);font-weight:500;font-size:14px}
.pill.primary{border:0;background:linear-gradient(90deg,var(--blue),var(--cyan));color:#031230;font-weight:600}
.pill.danger{color:var(--danger)}
.fab{width:56px;height:56px;border-radius:28px;border:0;background:linear-gradient(135deg,var(--blue),var(--cyan));color:#031230;display:flex;align-items:center;justify-content:center;box-shadow:0 8px 24px rgba(11,99,255,.45)}
.fab svg{width:26px;height:26px;stroke-width:2.4}

/* diálogo */
dialog{width:min(520px,100vw);max-height:100dvh;margin:auto;padding:0;border:1px solid var(--line);border-radius:20px;background:var(--bg);color:var(--fg)}
dialog::backdrop{background:rgba(3,8,20,.7)}
@media (max-width:560px){dialog{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border-radius:0;border:0}}
dialog form{display:flex;flex-direction:column;height:100%;max-height:100dvh}
.dlg-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:20px 16px 0}
.dlg-head h2{margin:0;font-size:20px;font-weight:700;letter-spacing:-.02em}
.spacer{width:44px}
.fields{flex:1 1 auto;overflow-y:auto;display:flex;flex-direction:column;gap:14px;padding:18px 16px}
.f{display:flex;flex-direction:column;gap:6px;border:0;margin:0;padding:0;min-width:0}
.f>span,.f legend,.lbl{font-size:12px;font-weight:500;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);padding:0}
.f input[type=text],.f input[type=date],.f input[type=time],.f input[type=url],.f select,.f textarea{width:100%;min-height:48px;padding:10px 14px;border-radius:12px;border:1px solid var(--line);background:var(--surface);font-size:15px}
.f textarea{resize:vertical}
.two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.when{display:flex;flex-direction:column;gap:14px}
.allday{display:flex;align-items:center;gap:10px;min-height:40px;font-size:14px;color:var(--fg);cursor:pointer}
.allday input{width:20px;height:20px;margin:0;accent-color:var(--blue);cursor:pointer}
#times-wrap[hidden]{display:none}
.scope{flex-direction:row;flex-wrap:wrap;gap:6px;padding:10px;border-radius:12px;background:var(--surface);border:1px solid var(--line)}
.scope legend{width:100%;float:left;margin-bottom:6px}
.scope label{position:relative;flex:1 1 0}
.scope input{position:absolute;opacity:0;inset:0;margin:0;cursor:pointer}
.scope span{display:flex;align-items:center;justify-content:center;min-height:40px;border-radius:8px;font-size:14px;color:var(--muted);border:1px solid var(--line)}
.scope input:checked+span{background:var(--blue);border-color:var(--blue);color:#fff;font-weight:600}
.scope input:focus-visible+span{outline:2px solid var(--cyan);outline-offset:2px}
.f select:disabled{opacity:.5}
.searchbar{display:flex;align-items:center;gap:10px;margin:12px 16px 0;padding:0 4px 0 14px;border-radius:12px;background:var(--surface);border:1px solid var(--cyan)}
.searchbar>svg{flex:none;color:var(--muted)}
.searchbar input{flex:1 1 auto;min-width:0;min-height:44px;border:0;background:none;font-size:15px;outline:none}
.searchbar input::-webkit-search-cancel-button{display:none}
.searchbar .icon-btn{border:0;background:none;width:40px;height:40px}
.results{display:flex;flex-direction:column;gap:4px;padding:0 16px 16px}
.results h2{margin:4px 0 8px;font-size:14px;font-weight:500;color:var(--muted)}
.res{display:grid;grid-template-columns:120px minmax(0,1fr);gap:14px;align-items:start;padding:10px 12px;border:0;border-left:4px solid var(--b-dot);border-radius:8px;background:var(--surface);text-align:left}
.res:hover{background:rgba(47,128,255,.1)}
.res.t{border-left-color:var(--t-dot)}.res.p{border-left-color:var(--p-dot)}.res.o{border-left-color:var(--o-dot)}
.res time{display:flex;flex-direction:column;font-size:13px;font-variant-numeric:tabular-nums}
.res time small{color:var(--muted);font-size:12px}
.res strong{display:block;font-size:14px;font-weight:600;overflow-wrap:anywhere}
.res .hit{display:block;margin-top:2px;font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.res.past{opacity:.6}
.res.done strong{text-decoration:line-through}
.trash-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:6px}
.trash-head h2{margin:0}
.trash-row{grid-template-columns:120px minmax(0,1fr);cursor:default}
.trash-row:hover{background:var(--surface)}
.trash-actions{grid-column:1 / -1;display:flex;gap:8px;justify-content:flex-end}
.trash-actions .pill{height:36px;padding:0 14px;font-size:13px}
.toast{position:fixed;left:50%;bottom:calc(90px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:50;display:flex;align-items:center;gap:14px;max-width:calc(100vw - 32px);padding:10px 10px 10px 16px;border-radius:12px;background:var(--toast-bg);color:var(--toast-fg);font-size:14px;box-shadow:0 10px 30px rgba(0,0,0,.5)}
.toast button{border:0;background:none;color:#0b63ff;font-weight:700;padding:6px 8px;min-height:36px}
.colors{flex-direction:row;flex-wrap:wrap;gap:12px;align-items:center}
.colors legend{width:100%;margin-bottom:6px}
.colors label{position:relative;width:44px;height:44px}
.colors input{position:absolute;inset:0;opacity:0;margin:0;cursor:pointer}
.colors i{display:block;width:44px;height:44px;border-radius:22px;border:3px solid transparent}
.colors .c-b{background:var(--b-dot)}.colors .c-t{background:var(--t-dot)}.colors .c-p{background:var(--p-dot)}.colors .c-o{background:var(--o-dot)}
.colors input:checked+i{border-color:var(--fg)}
.colors input:focus-visible+i{outline:2px solid var(--cyan);outline-offset:2px}
.links{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.links li{display:grid;grid-template-columns:minmax(0,1fr) 44px;align-items:center;min-height:44px;padding-left:14px;border-radius:12px;background:var(--surface);border:1px solid var(--line)}
.links a{color:var(--link);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}
.links a small{color:var(--muted);margin-left:6px}
.links button{width:44px;height:44px;border:0;background:none;color:var(--muted);display:flex;align-items:center;justify-content:center}
.link-add{display:flex;flex-direction:column;gap:8px}
.links li.od a::before{content:"";display:inline-block;width:8px;height:8px;margin-right:8px;border-radius:2px;background:#0a7cdb;vertical-align:1px}
.links li.od small{color:var(--link)}
.atts a{display:flex;align-items:center;gap:8px;min-width:0}
.atts a svg{flex:none;width:18px;height:18px;color:var(--muted)}
.atts li.pending span{color:var(--muted);font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.atts li.pending small{margin-left:6px}
.links button.armed{color:var(--danger)}
.att-add{display:inline-flex;align-items:center;justify-content:center;gap:8px;align-self:flex-start;cursor:pointer}
.att-add svg{width:18px;height:18px}
.hint{color:var(--muted);font-size:12px}
.lbl small{margin-left:6px;letter-spacing:0;color:var(--fg)}
.ck-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.ck-hide{min-height:36px;padding:0 12px;border-radius:18px;border:1px solid var(--line);background:none;color:var(--muted);font-size:12px}
.ck-hide:hover{color:var(--fg)}
.checklist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}
.checklist li{display:grid;grid-template-columns:36px minmax(0,1fr) 44px;align-items:center;min-height:44px;border-radius:12px;background:var(--surface);border:1px solid var(--line)}
.ck-drag{width:36px;height:44px;border:0;background:none;color:var(--muted);display:flex;align-items:center;justify-content:center;padding:0;cursor:grab;touch-action:none}
.ck-drag svg{width:18px;height:18px;stroke-width:3.2}
.checklist li.dragging{opacity:.85;border-color:var(--cyan);box-shadow:0 6px 18px rgba(0,0,0,.4);position:relative;z-index:2}
.checklist li.dragging .ck-drag{cursor:grabbing;color:var(--cyan)}
.checklist label{display:flex;align-items:center;gap:12px;min-height:44px;cursor:pointer;min-width:0}
.checklist input{width:20px;height:20px;flex:none;margin:0;accent-color:var(--cyan);cursor:pointer}
.checklist span{font-size:14px;overflow-wrap:anywhere}
.checklist li.done span{text-decoration:line-through;color:var(--muted)}
.checklist .ck-text{cursor:text;border-radius:6px;padding:2px 4px;margin:-2px -4px}
.checklist .ck-text:hover{background:rgba(47,128,255,.08)}
.checklist input.ck-edit{flex:1 1 auto;width:auto;height:auto;min-width:0;min-height:36px;padding:6px 10px;border-radius:8px;border:1px solid var(--cyan);background:var(--bg);color:var(--fg);font-size:14px;accent-color:auto;cursor:text}
.ck-rm{width:44px;height:44px;border:0;background:none;color:var(--muted);display:flex;align-items:center;justify-content:center}
.ck-add{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px}
.ck-add input{min-height:48px;padding:10px 14px;border-radius:12px;border:1px solid var(--line);background:var(--surface);font-size:15px}
.ck-badge{display:inline-block;margin-left:8px;padding:1px 6px;border-radius:6px;font-size:11px;font-weight:500;color:var(--muted);border:1px solid var(--line);white-space:nowrap;text-decoration:none;vertical-align:1px}
.ck-badge.full{color:var(--t-dot);border-color:var(--t-dot)}
.err{margin:0;color:var(--danger);font-size:14px}
.dlg-foot{display:flex;flex-wrap:wrap;gap:10px;justify-content:flex-end;padding:12px 16px calc(16px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--line)}
.dlg-foot .danger{margin-right:auto}
.desk,.chips{display:none}
.pill svg{width:18px;height:18px;margin-right:6px;vertical-align:-4px}

/* computador */
@media (min-width:960px){
  body{font-size:14px}
  #app{max-width:1400px;padding:0 24px}
  .toolbar{display:flex;align-items:center;gap:12px;padding:14px 0;border-bottom:1px solid var(--line)}
  .top{display:contents}
  h1{order:0;margin-right:12px}
  .nav{order:1;flex:none;gap:2px}
  #period{order:0;flex:none;min-width:190px;font-size:16px;padding:0 4px}
  #prev{order:-1}
  #today-d{order:-2;margin-right:8px}
  #next{order:1}
  .searchbar{order:2;flex:1 1 auto;margin:0 0 0 auto;max-width:340px}
  .searchbar[hidden]{display:flex!important}
  .searchbar #q-close{visibility:hidden}
  .searchbar.has-q #q-close{visibility:visible}
  .seg{order:3}
  #add-d{order:4}
  .top-actions{order:5}
  .mob{display:none}
  .user-btn{width:36px;height:36px;font-size:14px}
  h1{font-size:22px}
  .seg{order:1;margin:0;width:270px;flex:none;padding:3px;border-radius:10px}
  .seg button{height:34px;border-radius:8px;font-size:13px}
  .top-actions{align-items:center;gap:6px}
  .icon-btn{width:36px;height:36px;border-radius:8px}
  .icon-btn svg{width:18px;height:18px}
  .pill{height:36px;padding:0 16px;border-radius:8px;font-size:13px}
  .desk{display:inline-flex;align-items:center}
  .bar{display:none}
  main{margin-top:16px}

  .lists{padding:0 0 24px;gap:16px;align-items:start}
  .lday{padding:16px 16px 12px;border-radius:12px;gap:8px}
  .lday h2{padding-bottom:8px;border-bottom:1px solid var(--line)}
  .lday-title{font-size:14px}
  .lrows{gap:0}
  .lrow{min-height:40px;border-radius:6px;border-left-width:3px}
  .lrow+.lrow{margin-top:2px}
  .lmain{min-height:36px;padding:4px 10px 4px 0}
  .lrow time{flex-direction:row;gap:4px;align-items:baseline;font-size:12px}
  .lrow time small::before{content:"–";margin-right:4px}
  .lmain{grid-template-columns:90px minmax(0,1fr)}
  .lrow span{font-size:13px}
  .chk{width:36px;height:36px}
  .chk::before{width:18px;height:18px;border-radius:9px}
  .lrow{grid-template-columns:36px minmax(0,1fr)}
  .lists[style*="--n:1"]{max-width:860px}

  .month{display:grid;grid-template-columns:minmax(0,1fr) 340px;column-gap:20px;row-gap:0;align-items:start;padding:0 0 24px}
  .month .daylist .row span{white-space:normal}
  .month .wd{grid-column:1}
  .mgrid{grid-column:1;gap:1px;background:var(--line);border:1px solid var(--line);border-radius:12px;overflow:hidden}
  .month .daylist{grid-column:2;grid-row:1 / span 2;margin:0;position:sticky;top:0}
  .cell{height:auto;min-height:104px;align-items:stretch;justify-content:flex-start;padding:6px;gap:4px;background:var(--bg);border-radius:0}
  .cell:hover{background:var(--surface)}
  .cell.sel{background:var(--surface)}
  .cell b{width:26px;height:26px;font-size:13px;align-self:flex-start}
  .cell.sel b{box-shadow:none;color:var(--cyan)}
  .cell.today b{color:#fff}
  .cell .dots{display:none}
  .chips{display:flex;flex-direction:column;gap:2px;min-width:0}
  .chip{display:block;font-style:normal;font-size:11px;line-height:1.3;padding:2px 6px;border-radius:4px;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .chip.b{background:var(--b-bg);color:var(--b-fg)}.chip.t{background:var(--t-bg);color:var(--t-fg)}
  .chip.p{background:var(--p-bg);color:var(--p-fg)}.chip.o{background:var(--o-bg);color:var(--o-fg)}
  .chip.done{opacity:.5;text-decoration:line-through}
  .chip.more{background:none;color:var(--muted);padding-top:0}
  .cell.dim .chip{opacity:.5}

  /* diálogo em duas colunas: dados à esquerda, checklist à direita */
  dialog{width:min(960px,94vw);max-height:88vh;border-radius:14px}
  dialog form{max-height:88vh}
  .dlg-head{padding:14px 20px 12px;border-bottom:1px solid var(--line)}
  .dlg-head h2{font-size:17px}
  .dlg-head .icon-btn{order:2}
  .dlg-head .spacer{display:none}
  .fields{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);column-gap:28px;row-gap:0;align-content:start;padding:16px 20px}
  .fields>*{grid-column:1;margin-bottom:12px}
  .fields>.ck-block{margin-bottom:0}
  .fields>.ck-block{grid-column:2;grid-row:1 / span 20;align-self:stretch;min-height:0;padding-left:28px;margin-left:-1px;border-left:1px solid var(--line)}
  .f{gap:4px}
  .f>span,.f legend,.lbl{font-size:11px}
  .f input[type=text],.f input[type=date],.f input[type=time],.f input[type=url],.f select,.f textarea,.ck-add input{min-height:36px;padding:6px 10px;border-radius:8px;font-size:14px}
  .when{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.3fr);gap:12px}
  .when .allday{grid-column:1 / -1;grid-row:2;min-height:28px;font-size:13px}
  .allday input{width:16px;height:16px}
  .two{gap:10px}
  .colors{gap:10px}
  .colors label,.colors i{width:28px;height:28px}
  .colors i{border-width:2px}
  .colors legend{margin-bottom:2px}
  .checklist{gap:2px;max-height:52vh;overflow-y:auto}
  .checklist li{min-height:34px;border-radius:6px;background:none;border:1px solid transparent;grid-template-columns:28px minmax(0,1fr) 32px}
  .ck-drag{width:28px;height:34px;opacity:.35}
  .checklist li:hover .ck-drag,.ck-drag:focus-visible{opacity:1}
  .checklist li:hover{background:var(--surface)}
  .checklist label{min-height:34px;gap:10px}
  .checklist input{width:16px;height:16px}
  .checklist span{font-size:13px}
  .ck-rm{width:32px;height:32px;opacity:0}
  .checklist li:hover .ck-rm,.ck-rm:focus-visible{opacity:1}
  .ck-rm svg{width:16px;height:16px}
  .ck-hide{min-height:28px;font-size:11px;padding:0 10px}
  .ck-add{margin-top:4px}
  .ck-add .pill,.link-add .pill{height:36px}
  .links li{min-height:36px;border-radius:8px;grid-template-columns:minmax(0,1fr) 36px}
  .links button{width:36px;height:36px}
  .link-add{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.4fr) auto;gap:8px}
  .link-add input{min-height:36px;padding:6px 10px;border-radius:8px;border:1px solid var(--line);background:var(--surface);font-size:14px}
  .dlg-foot{padding:12px 20px}
  .scope{padding:8px;border-radius:8px}
  .scope span{min-height:30px;font-size:13px;border-radius:6px}
  .searchbar{border-color:var(--line);padding-left:12px}
  .searchbar:focus-within{border-color:var(--cyan)}
  .searchbar input{min-height:34px;font-size:13px}
  .searchbar .icon-btn{width:32px;height:32px}
  .results{padding:0 0 24px;max-width:960px}
  .res{grid-template-columns:150px minmax(0,1fr);padding:8px 12px}
  .trash-row{grid-template-columns:150px minmax(0,1fr) auto;align-items:center}
  .trash-actions{grid-column:auto}
  .toast{bottom:28px}
}

@media (prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}
