:root{
  --bg:#D3DDE7;--pane:#F6F7FA;--surface:#FFFFFF;--ink:#17184B;--muted:#62668A;--line:rgba(23,24,75,.09);
  --accent:#273287;--chip:#EDF0F5;--glass:rgba(255,255,255,.55);--warn:#C8443A;--lime:#D8E63C;--violet:#D6B4FC;
  --reply:#273287;--del:#C8443A;--arch:#A9790F;--move:#2E7D5B;--snooze:#7A4CC9;--spam:#7C7F9E;--todo:#17184B;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root{--bg:#0F1033;--pane:#141641;--surface:#1A1C4D;--ink:#F0EEE9;--muted:#A6A9CC;--line:rgba(255,255,255,.09);--accent:#4A57C8;--chip:#23265C;--glass:rgba(255,255,255,.08);--reply:#5A66D6;--todo:#4A57C8;color-scheme:dark}
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{height:100%;margin:0}
body{font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,system-ui,sans-serif;background:var(--bg);color:var(--ink);-webkit-tap-highlight-color:transparent;letter-spacing:-.005em;overflow:hidden}
svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
button,input,select,textarea{font:inherit;color:inherit}
input,select,textarea{font-size:16px;width:100%;padding:11px 14px;border-radius:14px;border:1px solid var(--line);background:var(--chip)}
textarea{resize:none;line-height:1.5}
:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.wordmark{display:block;width:68px;aspect-ratio:360/140;background:var(--ink);-webkit-mask:url(/icons/wordmark.png) left center/contain no-repeat;mask:url(/icons/wordmark.png) left center/contain no-repeat}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:12px 16px;border-radius:999px;border:1px solid var(--line);background:var(--surface);font-weight:600;cursor:pointer;text-decoration:none;color:var(--ink)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff}
.btn.danger{color:var(--warn)}
.btn:disabled{opacity:.5;cursor:default}
.round{width:40px;height:40px;border-radius:50%;border:0;background:var(--glass);display:grid;place-items:center;cursor:pointer;flex:none;padding:0;overflow:hidden;font-weight:700}
.dot{width:9px;height:9px;border-radius:50%;flex:none;display:inline-block}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.note{font-size:.85rem;color:var(--muted);line-height:1.45;margin:8px 0}
.empty{text-align:center;color:var(--muted);padding:56px 20px;line-height:1.5}
.empty strong{display:block;color:var(--ink);font-size:1.15rem;margin-bottom:4px}

/* inloggen */
.auth{min-height:100%;display:grid;place-items:center;padding:24px}
.authcard{width:min(380px,100%);background:var(--surface);border-radius:28px;padding:28px;display:grid;gap:14px}
.authcard .wordmark{width:96px;margin-bottom:8px}
.authcard label{display:grid;gap:6px;font-size:.85rem;font-weight:600;color:var(--muted)}
.authcard input{font-weight:400;color:var(--ink)}
.authcard .check{display:flex;align-items:center;gap:10px;font-weight:500}
.authcard .check input{width:auto}
.lead{margin:0;line-height:1.5;color:var(--muted)}
#setupBox,#loginBox{display:grid;gap:14px}
.msg{margin:0;min-height:1.2em;color:var(--warn);font-size:.9rem}

/* app mobiel */
.app{height:100%;display:flex;flex-direction:column;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}
.side{display:none}
.main{flex:1;min-height:0;display:flex;flex-direction:column}
.top{display:flex;align-items:center;gap:8px;padding:14px 16px 10px}
.tleft{flex:1;min-width:0}
h1{margin:0;font-size:1.35rem;font-weight:600;letter-spacing:-.025em}
h1 em{font-weight:400}
.count{margin:2px 0 0;font-size:.85rem;color:var(--muted)}
.chips{display:flex;gap:6px;overflow-x:auto;padding:0 16px 10px;scrollbar-width:none;flex:none}
.chips::-webkit-scrollbar{display:none}
.chip{flex:none;display:flex;align-items:center;gap:7px;border:0;border-radius:999px;padding:8px 14px;background:var(--glass);font-weight:600;font-size:.85rem;cursor:pointer;color:var(--ink)}
.chip .n{opacity:.6;font-weight:500}
.chip[aria-pressed="true"]{background:var(--ink);color:var(--surface)}
.seg{display:flex;gap:2px;margin:0 16px 10px;background:var(--glass);border-radius:999px;padding:4px;flex:none}
.seg button{flex:1;border:0;background:none;padding:8px 4px;border-radius:999px;font-weight:600;font-size:.85rem;cursor:pointer;white-space:nowrap;color:var(--ink)}
.seg button[aria-selected="true"]{background:var(--accent);color:#fff}
.search{padding:0 16px 10px;flex:none}
.search input{background:var(--surface);border:0;border-radius:999px}
.content{flex:1;min-height:0;overflow:auto;padding:0 12px 16px;position:relative}
.content.deckmode{overflow:hidden;display:flex;flex-direction:column;padding:0 16px 10px}

/* kaarten */
.deck{position:relative;flex:1;min-height:0}
.card{position:absolute;inset:0;background:var(--surface);border-radius:32px;padding:18px;display:flex;flex-direction:column;touch-action:none;user-select:none;-webkit-user-select:none;cursor:grab;transition:transform .3s ease,opacity .3s ease;box-shadow:0 1px 2px rgba(23,24,75,.05)}
.card.behind{transform:scale(.95) translateY(12px);opacity:.6;pointer-events:none}
.chead{display:flex;gap:12px;align-items:center}
.avatar{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;background:var(--chip);font-weight:600;flex:none}
.chead strong{display:block;font-size:1.05rem;font-weight:600}
.chead span{display:block;color:var(--muted);font-size:.8rem;overflow-wrap:anywhere}
.pills{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}
.pill{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:999px;padding:5px 11px;font-size:.8rem;background:none}
.pill.warn{border-color:var(--warn);color:var(--warn)}
.subject{font-size:1.4rem;font-weight:600;letter-spacing:-.03em;line-height:1.15;margin:16px 0 8px}
.snip{color:var(--muted);line-height:1.55;flex:1;min-height:0;overflow:hidden}
.cardfoot{display:flex;justify-content:flex-end;margin-top:10px}
.cta{display:inline-flex;align-items:center;gap:12px;border:0;border-radius:999px;padding:7px 7px 7px 20px;font-weight:600;cursor:pointer}
.cta .arr{width:32px;height:32px;border-radius:50%;display:grid;place-items:center}
.stamp{position:absolute;top:16px;left:50%;transform:translateX(-50%);padding:8px 16px;border-radius:12px;color:#fff;font-weight:700;opacity:0;pointer-events:none;white-space:nowrap}
.deskacts{display:none}

/* lijsten */
.row{display:flex;gap:10px;width:100%;text-align:left;border:0;background:var(--surface);padding:12px 14px;border-radius:18px;margin-bottom:6px;cursor:pointer;color:var(--ink);align-items:flex-start}
.row .main2{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.row .top2{display:flex;justify-content:space-between;gap:8px;align-items:baseline}
.row strong{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row .date{font-size:.78rem;color:var(--muted);white-space:nowrap}
.row .date.late{color:var(--arch);font-weight:600}
.row .subj{font-size:.92rem;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row .sn{font-size:.85rem;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row .dot{margin-top:6px}
.row.sel{background:var(--accent);color:#fff}
.row.sel .date,.row.sel .sn{color:rgba(255,255,255,.78)}
.listhead{font-weight:700;margin:14px 6px 8px;font-size:.95rem}
.listhead.muted{color:var(--muted)}

/* acties */
.todo{display:flex;gap:12px;align-items:flex-start;padding:14px;background:var(--surface);border-radius:20px;margin-bottom:8px}
.check{width:28px;height:28px;border-radius:50%;border:2px solid var(--accent);background:none;flex:none;cursor:pointer;display:grid;place-items:center;color:#fff;padding:0}
.todo.done .check{background:var(--accent)}
.todo.done .ttext{text-decoration:line-through;color:var(--muted)}
.tbody{flex:1;min-width:0}
.ttext{font-weight:500;line-height:1.35}
.tmeta{font-size:.85rem;color:var(--muted);margin-top:4px}
.tmeta button{background:none;border:0;padding:0;color:var(--accent);cursor:pointer;text-align:left;font-size:.85rem}
.tags{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
.tag{font-size:.78rem;font-weight:600;padding:2px 9px;border-radius:999px;background:var(--chip)}
.tag.late{color:var(--warn)}
.tag.auto{color:var(--snooze)}
.tbtns{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.tbtn{background:none;border:1px solid var(--line);border-radius:999px;padding:6px 12px;font-size:.85rem;font-weight:600;cursor:pointer;color:var(--ink)}
.x{background:none;border:0;color:var(--muted);font-size:1.3rem;line-height:1;cursor:pointer;padding:4px 6px}

/* menu onderaan */
.menu{display:flex;align-items:flex-end;background:var(--surface);border-radius:26px;padding:6px;margin:0 12px 8px;flex:none}
.mi{flex:1 1 0;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:3px;background:none;border:0;color:var(--muted);font-size:.7rem;font-weight:600;cursor:pointer;padding:6px 0 5px;border-radius:20px;position:relative;min-width:0;white-space:nowrap}
.mi[aria-current="page"]{background:var(--chip);color:var(--ink)}
.mi .ico{width:26px;height:26px;display:grid;place-items:center}
.mi.center .ico{width:38px;height:38px;border-radius:50%;background:var(--accent);color:#fff}
.mbadge{position:absolute;top:1px;right:calc(50% - 22px);min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:var(--violet);color:#17184B;font-size:.68rem;font-weight:800;display:grid;place-items:center}

/* lezen (mobiel: in een sheet) */
.reader{display:none}
.rbar{display:flex;align-items:center;gap:4px;padding:10px 16px;border-bottom:1px solid var(--line);flex:none;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
.rt{display:inline-flex;align-items:center;gap:6px;border:0;background:none;color:var(--ink);padding:7px 10px;border-radius:8px;font-size:.84rem;font-weight:600;cursor:pointer;white-space:nowrap}
.rt:hover{background:var(--chip)}
.rt svg{color:var(--muted)}
.rt.prim{background:var(--accent);color:#fff}
.rt.prim svg{color:#fff}
.rsp{flex:1}
.rscroll{flex:1;overflow:auto;min-height:0}
.rinner{max-width:760px;padding:22px 20px 40px}
.rhead{display:flex;align-items:center;gap:12px}
.rhead .avatar{background:var(--violet);color:#17184B}
.rfrom{min-width:0;flex:1}
.rfrom strong{display:block}
.rfrom span{display:block;font-size:.85rem;color:var(--muted);overflow-wrap:anywhere}
.rdate{font-size:.85rem;color:var(--muted);white-space:nowrap}
.rsubj{font-size:1.5rem;font-weight:700;letter-spacing:-.025em;line-height:1.15;margin:18px 0 10px}
.atts{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 10px}
.att{display:inline-flex;gap:6px;align-items:center;padding:6px 12px;border-radius:10px;background:var(--chip);font-size:.85rem}
.att.warn{color:var(--warn);background:transparent;border:1px solid var(--warn)}
.warnmsg{color:var(--warn);font-size:.85rem;margin:0 0 12px}
.rbody{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6;font-size:1rem;margin-top:14px}
.rempty{flex:1;display:grid;place-content:center;text-align:center;color:var(--muted)}
.rkeys{margin-top:32px;color:var(--muted);font-size:.8rem;line-height:2}
.rkeys kbd{font:inherit;font-weight:700;font-size:.75rem;background:var(--chip);border-radius:5px;padding:2px 6px}

/* sheets */
.scrim{position:fixed;inset:0;background:rgba(15,16,51,.4);z-index:20}
.sheet{position:fixed;left:0;right:0;bottom:0;margin:0 auto;max-width:560px;max-height:92%;background:var(--surface);border-radius:28px 28px 0 0;padding:18px 18px calc(16px + env(safe-area-inset-bottom));z-index:30;display:flex;flex-direction:column;animation:up .25s ease}
.sheet.tall{height:92%}
.sheet.full{height:100%;max-height:100%;border-radius:0;padding-top:calc(12px + env(safe-area-inset-top))}
@keyframes up{from{transform:translateY(40px);opacity:0}to{transform:none;opacity:1}}
.shead{display:flex;align-items:center;gap:10px;margin-bottom:8px;flex:none}
.shead h2{flex:1;margin:0;font-size:1.2rem;font-weight:700;letter-spacing:-.02em;min-width:0;overflow:hidden;text-overflow:ellipsis}
.sbody{flex:1;min-height:0;overflow:auto;display:flex;flex-direction:column;gap:10px}
.sfoot{display:flex;gap:8px;margin-top:12px;flex:none}
.sub{color:var(--muted);font-size:.9rem;margin:0}
.field{display:grid;gap:6px;font-size:.85rem;font-weight:600;color:var(--muted)}
.field>input,.field>select,.field>textarea{font-weight:400;color:var(--ink)}
.opt{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;padding:13px 14px;border:1px solid var(--line);border-radius:16px;background:var(--surface);cursor:pointer;text-align:left;color:var(--ink)}
.opt.sug{border:2px solid var(--move)}
.opt small{color:var(--muted)}
.choice3{display:flex;justify-content:center;gap:22px;padding:8px 0}
.bol{display:flex;flex-direction:column;align-items:center;gap:8px;background:none;border:0;font-weight:600;cursor:pointer;color:var(--ink)}
.bol .ring{width:70px;height:70px;border-radius:50%;display:grid;place-items:center}
.bol .ring svg{width:26px;height:26px}
.tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.tool{width:44px;height:44px;border-radius:50%;border:0;background:var(--chip);display:grid;place-items:center;cursor:pointer;color:var(--ink);flex:none}
.tool.ai{background:var(--violet);color:#17184B}
.tool.on{background:var(--warn);color:#fff;animation:pulse 1.2s infinite}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(200,68,58,.5)}100%{box-shadow:0 0 0 12px rgba(200,68,58,0)}}
.status{font-size:.85rem;color:var(--muted);margin:0}
.orig{background:var(--chip);border-radius:16px;padding:8px 14px}
.orig summary{cursor:pointer;font-weight:700;font-size:.9rem;padding:4px 0}
.orig div{max-height:28vh;overflow:auto;white-space:pre-wrap;font-size:.9rem;line-height:1.5;margin:6px 0}
.suggest{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:4px;max-height:220px;overflow:auto}
.sg{display:flex;flex-direction:column;align-items:flex-start;width:100%;border:0;background:none;padding:8px 10px;border-radius:12px;cursor:pointer;text-align:left;color:var(--ink)}
.sg small{color:var(--muted)}
.sg:hover,.sg.on{background:var(--chip)}
.attlist{display:flex;flex-wrap:wrap;gap:6px}
.mchips{display:flex;flex-wrap:wrap;gap:6px}
.mchip{border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:7px 12px;font-size:.85rem;font-weight:600;cursor:pointer;color:var(--ink)}
.mchip[aria-pressed="true"]{background:var(--accent);border-color:var(--accent);color:#fff}
.group{background:var(--chip);border-radius:20px;overflow:hidden}
.srow{display:flex;align-items:center;gap:12px;width:100%;padding:13px 14px;border:0;border-bottom:1px solid var(--line);background:none;cursor:pointer;text-align:left;color:var(--ink)}
.srow:last-child{border-bottom:0}
.srow .grow{flex:1;min-width:0}
.srow small{display:block;color:var(--muted);font-size:.82rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.box{background:var(--chip);border-radius:18px;padding:12px 14px;display:grid;gap:10px}
.box input,.box select,.box textarea{background:var(--surface)}
.line{display:flex;align-items:center;justify-content:space-between;gap:12px}
.line label{flex:1}
.line select{width:auto;max-width:60%}
.switch{appearance:none;-webkit-appearance:none;width:48px;height:28px;border-radius:999px;background:var(--line);position:relative;cursor:pointer;flex:none;padding:0;border:0}
.switch::after{content:"";position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:#fff;transition:transform .2s}
.switch:checked{background:var(--accent)}
.switch:checked::after{transform:translateX(20px)}
.sw{width:28px;height:28px;border-radius:50%;border:0;cursor:pointer;padding:0;box-shadow:inset 0 0 0 1px rgba(23,24,75,.15)}
.sw[aria-pressed="true"]{outline:2px solid var(--ink);outline-offset:2px}
.linkbtn{border:0;background:none;color:var(--warn);font-weight:600;cursor:pointer;padding:6px}
h3.sh{font-size:.95rem;margin:12px 2px 0}

/* keuze bij Multi */
.chooser{position:fixed;inset:0;z-index:35;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;background:rgba(23,24,75,.16);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)}
.chopts{display:flex;gap:36px}
.chbtn{display:flex;flex-direction:column;align-items:center;gap:10px;background:none;border:0;font-weight:600;cursor:pointer;color:var(--ink)}
.chbtn .ring{width:92px;height:92px;border-radius:50%;display:grid;place-items:center;color:#fff}
.chbtn .ring svg{width:32px;height:32px}
.chbtn span:last-child,.chsub{background:var(--surface);padding:6px 14px;border-radius:999px}
.toast{position:fixed;left:50%;bottom:calc(92px + env(safe-area-inset-bottom));transform:translate(-50%,200%);background:var(--ink);color:var(--surface);padding:9px 10px 9px 18px;border-radius:999px;transition:transform .25s,visibility .25s;z-index:40;max-width:calc(100% - 32px);display:flex;gap:12px;align-items:center;visibility:hidden;width:max-content}
.toast.on{transform:translate(-50%,0);visibility:visible}
.toast button{background:none;border:0;color:inherit;font-weight:700;text-decoration:underline;cursor:pointer;padding:4px 8px}
.mobile-only{}

/* desktop: drie kolommen, zoals een Mac-app */
@media (min-width: 900px){
  .app{display:grid;grid-template-columns:236px minmax(330px,410px) minmax(0,1fr);padding:0;height:100vh}
  .app.wide{grid-template-columns:236px minmax(0,1fr)}
  .mobile-only,.menu{display:none!important}
  .side{display:flex;flex-direction:column;gap:1px;padding:18px 10px 12px;background:rgba(211,221,231,.6);border-right:1px solid var(--line);overflow:auto}
  .side .wordmark{margin:2px 10px 16px}
  .side .compose{margin:0 0 12px;border-radius:10px;padding:9px 12px}
  .sidehead{font-size:.72rem;font-weight:700;color:var(--muted);margin:14px 10px 4px}
  .sitem{display:flex;align-items:center;gap:10px;width:100%;border:0;background:none;padding:7px 10px;border-radius:8px;font-weight:500;font-size:.9rem;text-align:left;cursor:pointer;color:var(--ink)}
  .sitem:hover{background:rgba(23,24,75,.05)}
  .sitem[aria-current="true"]{background:rgba(23,24,75,.09)}
  .sitem svg{color:var(--accent)}
  .sitem .n{margin-left:auto;color:var(--muted);font-size:.8rem;font-weight:600}
  .sitem.bottom{margin-top:auto}
  .main{background:var(--pane);border-right:1px solid var(--line)}
  .top{padding:20px 16px 10px}
  .seg{display:none!important}
  .content{padding:0 8px 16px}
  .row{background:none;border-radius:10px;margin-bottom:2px;border-bottom:1px solid var(--line)}
  .row:hover{background:rgba(23,24,75,.04)}
  .row.sel{background:var(--accent);border-bottom-color:transparent}
  .reader{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--surface)}
  .rinner{padding:30px 44px 48px}
  .viewtoggle{display:inline-flex;gap:2px;background:rgba(23,24,75,.07);border-radius:9px;padding:3px}
  .viewtoggle button{border:0;background:none;font-size:.8rem;font-weight:600;padding:5px 12px;border-radius:7px;cursor:pointer;color:var(--ink)}
  .viewtoggle button[aria-pressed="true"]{background:var(--surface);box-shadow:0 1px 2px rgba(23,24,75,.15)}
  .content.deckmode{padding:6px 32px 24px}
  .deck{max-width:640px;width:100%;margin:0 auto}
  .deskacts{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;max-width:640px;width:100%;margin:14px auto 0;flex:none}
  .dact{display:flex;flex-direction:column;align-items:center;gap:6px;padding:12px 8px;border:0;border-radius:22px;background:var(--surface);font-weight:600;cursor:pointer;color:var(--ink)}
  .dact .di{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;color:#fff}
  .dact small{color:var(--muted);font-weight:500}
  .sheet{top:50%;left:50%;right:auto;bottom:auto;transform:translate(-50%,-50%);width:min(600px,92vw);max-height:88vh;border-radius:26px;animation:none;padding:22px}
  .sheet.tall{height:min(820px,88vh)}
  .sheet.full{height:88vh;max-height:88vh;border-radius:26px;padding:22px}
  .toast{bottom:28px}
}
@media (min-width: 900px) and (max-width: 1279px){.rt span{display:none}.rt.prim span{display:inline}}
.rot-180{display:grid;transform:rotate(180deg)}.rot-90{display:grid;transform:rotate(90deg)}.rot--90{display:grid;transform:rotate(-90deg)}.rot-0{display:grid}
.sheet.nopad{padding:0;padding-top:env(safe-area-inset-top)}
.sheet.nopad .rbar{padding-top:12px}
.line .grow{flex:1;min-width:0}
.box strong .dot{margin-right:6px}
h3.sh .dot{margin-right:6px}
.mi .ico svg{width:20px;height:20px}
.mi.center .ico svg{width:18px;height:18px}
.sheet .btn{flex:1}
.sbody>.btn{flex:none}
@media (min-width: 900px){.sheet.nopad{padding:0}}

.chead .avatar{display:grid}
.mi{font-size:.64rem;letter-spacing:-.02em}
