/* Layout: one column ≤540px (quarter of a portrait monitor). Dark "press sheet" header with a CMYK colour bar, white cards that lift on hover. Large type for easy reading. */
:root{
  --paper:#eceff3; --surface:#ffffff; --sunk:#e4e8ed; --ink:#0f1720; --muted:#4f5d6c; --line:#d5dce3;
  --hero:#0f1720; --on-hero:#f4f7fa; --hero-muted:#9fb0c0;
  --accent:#0b6f99; --accent-soft:#dcedf5; --on-accent:#ffffff;
  --late:#c0222f; --late-soft:#fbe2e4; --warn:#9a5300; --warn-soft:#fdebd2; --ok:#21683f; --ok-soft:#d9eee1;
  --c:#00a0d6; --m:#d6197a; --y:#f2c200; --k:#0f1720;
  --shadow:0 1px 2px rgba(15,23,32,.06),0 6px 20px rgba(15,23,32,.07);
  --shadow-up:0 2px 4px rgba(15,23,32,.08),0 14px 34px rgba(15,23,32,.14);
  --f-body:"Zen Kaku Gothic New","Hiragino Sans","Yu Gothic",system-ui,sans-serif;
  --f-num:"JetBrains Mono",ui-monospace,Menlo,monospace;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --paper:#0b1015; --surface:#161e27; --sunk:#202a35; --ink:#ecf1f5; --muted:#a3b2c0; --line:#2c3845;
  --hero:#18222d; --on-hero:#f4f7fa; --hero-muted:#9fb0c0;
  --accent:#4cbde6; --accent-soft:#143746; --on-accent:#06202b;
  --late:#ff7c86; --late-soft:#45181d; --warn:#f2ad55; --warn-soft:#3e2b10; --ok:#72d6a0; --ok-soft:#163526; --k:#ecf1f5;
  --shadow:0 1px 2px rgba(0,0,0,.3),0 6px 20px rgba(0,0,0,.25); --shadow-up:0 2px 4px rgba(0,0,0,.35),0 14px 34px rgba(0,0,0,.4); color-scheme:dark}}
:root[data-theme="dark"]{
  --paper:#0b1015; --surface:#161e27; --sunk:#202a35; --ink:#ecf1f5; --muted:#a3b2c0; --line:#2c3845;
  --hero:#18222d; --on-hero:#f4f7fa; --hero-muted:#9fb0c0;
  --accent:#4cbde6; --accent-soft:#143746; --on-accent:#06202b;
  --late:#ff7c86; --late-soft:#45181d; --warn:#f2ad55; --warn-soft:#3e2b10; --ok:#72d6a0; --ok-soft:#163526; --k:#ecf1f5;
  --shadow:0 1px 2px rgba(0,0,0,.3),0 6px 20px rgba(0,0,0,.25); --shadow-up:0 2px 4px rgba(0,0,0,.35),0 14px 34px rgba(0,0,0,.4); color-scheme:dark}
html,body{background:var(--paper);color:var(--ink)}
body{font-family:var(--f-body);font-size:17px;line-height:1.6;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));padding-block:0;-webkit-font-smoothing:antialiased}
.app{max-width:540px;margin:0 auto;padding-block:14px 48px;display:flex;flex-direction:column;gap:18px}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.num{font-family:var(--f-num);font-variant-numeric:tabular-nums;letter-spacing:-.02em}
h1,h2{margin:0;line-height:1.3;text-wrap:balance}
h2{font-size:16px;font-weight:700;color:var(--muted)}
.grow{flex:1;min-width:0}

/* hero */
.hero{background:var(--hero);color:var(--on-hero);border-radius:20px;padding:18px 20px 0;overflow:hidden;display:flex;flex-direction:column;gap:14px;box-shadow:var(--shadow)}
.hero-row{display:flex;align-items:flex-end;gap:12px}
.hero small{display:block;font-size:12px;letter-spacing:.24em;color:var(--hero-muted);font-weight:500}
.hero h1{font-size:28px;font-weight:700;letter-spacing:.04em}
.hero-date{margin-left:auto;text-align:right;line-height:1.1}
.hero-date .num{display:block;font-size:30px;font-weight:700}
.hero-date span:last-child{font-size:14px;color:var(--hero-muted)}
.sizer{display:flex;align-items:center;gap:6px;font-size:14px;color:var(--hero-muted)}
.sizer button{border:1px solid rgba(255,255,255,.22);background:transparent;color:var(--on-hero);border-radius:999px;min-height:36px;padding:0 14px;cursor:pointer;font-weight:700}
.sizer button[aria-pressed="true"]{background:var(--on-hero);color:var(--hero);border-color:var(--on-hero)}
.cbar{display:grid;grid-template-columns:repeat(4,1fr);height:6px;margin:0 -20px}
.cbar i:nth-child(1){background:var(--c)}.cbar i:nth-child(2){background:var(--m)}.cbar i:nth-child(3){background:var(--y)}.cbar i:nth-child(4){background:#5b6773}

/* buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 18px;border-radius:12px;border:1px solid var(--line);background:var(--surface);cursor:pointer;font-weight:700;white-space:nowrap;transition:background .15s,border-color .15s}
.btn:hover{border-color:var(--accent)}
.btn.pri{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
.btn.big{width:100%;min-height:56px;font-size:18px}
.link{background:none;border:0;padding:8px 0;color:var(--muted);cursor:pointer;text-decoration:underline;text-underline-offset:3px;font-size:15px}

.today-btn{width:100%;min-height:76px;justify-content:flex-start;gap:16px;padding:12px 18px;border:0;border-radius:16px;text-align:left;white-space:normal;box-shadow:var(--shadow);background:var(--surface)}
.today-btn:hover{box-shadow:var(--shadow-up)}
.today-btn b{display:block;font-size:20px;color:var(--ink)}
.today-btn small{display:block;font-size:14px;color:var(--muted);font-weight:500}
.sun{width:34px;height:34px;border-radius:50%;background:var(--y);box-shadow:0 0 0 6px color-mix(in srgb,var(--y) 28%,transparent);flex:none}
.today-btn .arrow{margin-left:auto;font-size:22px;color:var(--accent)}

/* groups & cards */
.grp{display:flex;gap:10px;align-items:baseline;font-size:17px;color:var(--ink);padding:2px 4px 0}
.grp .num{font-size:14px;font-weight:500;color:var(--muted)}
.grp.late{color:var(--late)}.grp.risk{color:var(--warn)}
.card{background:var(--surface);border-radius:18px;box-shadow:var(--shadow);overflow:hidden;transition:transform .18s ease,box-shadow .18s ease;position:relative}
.card.late{box-shadow:var(--shadow),inset 0 0 0 2px var(--late)}
.card:not(.open):hover,.card:not(.open):focus-within{transform:scale(1.035);box-shadow:var(--shadow-up);z-index:1}
.card.late:not(.open):hover{box-shadow:var(--shadow-up),inset 0 0 0 2px var(--late)}
.head{display:flex;flex-direction:column;gap:8px;width:100%;padding:16px 18px;background:none;border:0;text-align:left;cursor:pointer}
.r1{display:flex;gap:10px;align-items:flex-start}
.title{font-weight:700;font-size:19px;flex:1;min-width:0;line-height:1.4}
.cust{display:block;font-size:15px;color:var(--muted);font-weight:500}
.chip{border-radius:999px;padding:3px 12px;font-size:14px;font-weight:700;white-space:nowrap}
.s-late{background:var(--late);color:var(--surface)}
.s-risk{background:var(--warn-soft);color:var(--warn)}
.s-ok{background:var(--ok-soft);color:var(--ok)}
.s-ready{background:var(--accent-soft);color:var(--accent)}
.due{display:flex;gap:12px;align-items:baseline;flex-wrap:wrap}
.due .num{font-size:22px;font-weight:700}
.left{font-size:15px;font-weight:700}
.left.late{color:var(--late)}.left.risk{color:var(--warn)}.left.ok{color:var(--muted)}
.prog{display:flex;align-items:center;gap:10px}
.bar{flex:1;height:10px;background:var(--sunk);border-radius:5px;overflow:hidden}
.bar i{display:block;height:100%;background:linear-gradient(90deg,var(--c),var(--accent));border-radius:5px}
.prog .num{font-size:15px;color:var(--muted)}
.why{font-size:15px;color:var(--muted)}

.body{border-top:1px solid var(--line);padding:12px 18px 18px;display:flex;flex-direction:column;gap:12px;background:color-mix(in srgb,var(--sunk) 35%,var(--surface))}
.steps{list-style:none;margin:0;padding:0;background:var(--surface);border-radius:12px;border:1px solid var(--line)}
.step{display:flex;align-items:center;gap:6px;border-top:1px solid var(--line);padding:0 6px 0 14px}
.step:first-child{border-top:0}
.step label{flex:1;display:flex;align-items:center;gap:14px;min-height:52px;cursor:pointer;font-size:17px}
.step input{width:26px;height:26px;accent-color:var(--accent);flex:none}
.step.done span{color:var(--muted);text-decoration:line-through}
.step .x{background:none;border:0;color:var(--muted);cursor:pointer;width:44px;height:44px;font-size:20px;border-radius:10px}
.step .x:hover{background:var(--sunk)}
.add{display:flex;gap:8px}
input[type=text],input[type=date],select,textarea{min-height:50px;border:1px solid var(--line);border-radius:12px;background:var(--surface);padding:8px 12px;width:100%;box-sizing:border-box;min-width:0;font-size:17px}
textarea{resize:vertical;line-height:1.55}
.saved{font-size:14px;color:var(--muted);margin-top:-6px}
.foot{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}

.form{background:var(--surface);border-radius:18px;box-shadow:var(--shadow);padding:18px;display:flex;flex-direction:column;gap:14px}
.fld{display:flex;flex-direction:column;gap:6px}
.fld label,.lbl{font-size:15px;font-weight:700}
.two{display:grid;grid-template-columns:1.4fr 1fr;gap:8px}
.seg{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.seg label{display:flex;align-items:center;justify-content:center;min-height:50px;border:1px solid var(--line);border-radius:12px;cursor:pointer;font-weight:700;position:relative}
.seg input{position:absolute;opacity:0;pointer-events:none}
.seg label:has(input:checked){border-color:var(--accent);background:var(--accent-soft);color:var(--accent)}
.err{color:var(--late);font-size:15px;font-weight:700}
.row{display:flex;gap:8px}
.row>*{flex:1}

.empty{border:2px dashed var(--line);border-radius:18px;padding:22px;text-align:center;color:var(--muted)}
.note{font-size:14px;color:var(--muted);line-height:1.65}
details.done-list{background:var(--surface);border-radius:16px;box-shadow:var(--shadow);padding:12px 18px}
details.done-list summary{cursor:pointer;font-weight:700;color:var(--muted);min-height:32px}
.dl{display:flex;justify-content:space-between;align-items:center;gap:8px;border-top:1px solid var(--line);padding:4px 0}

/* today sheet */
.sheet{position:fixed;inset:0;z-index:25;background:color-mix(in srgb,#0f1720 45%,transparent);backdrop-filter:blur(3px);display:flex;justify-content:center;align-items:flex-start;padding:calc(12px + env(safe-area-inset-top,0px)) max(12px,env(safe-area-inset-right,0px)) calc(12px + env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px));overflow-y:auto}
.sheet-in{background:var(--paper);border-radius:20px;padding:16px;width:100%;max-width:540px;display:flex;flex-direction:column;gap:12px;box-shadow:0 20px 50px rgba(0,0,0,.3)}
.plist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.pr{background:var(--surface);border-radius:16px;box-shadow:var(--shadow);padding:12px 14px;display:flex;gap:12px;align-items:center}
.pr .no{font-family:var(--f-num);font-weight:700;font-size:26px;color:var(--accent);min-width:1.3em;text-align:center}
.pr .w{font-size:15px;color:var(--muted)}
.plist.rest .pr{opacity:.85}

/* calendar */
.gwrap{overflow-x:auto;background:var(--surface);border-radius:18px;box-shadow:var(--shadow)}
.grw,.ghead{display:flex;width:100%;border:0;border-top:1px solid var(--line);background:none;padding:0;text-align:left;cursor:pointer;font:inherit;color:inherit}
.ghead{cursor:default;border-top:0}
.glab{position:sticky;left:0;z-index:3;width:140px;flex:none;background:var(--surface);padding:6px 10px;border-right:1px solid var(--line);box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;min-width:0}
.glab b{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.glab .num{font-size:12px;color:var(--muted)}
.gtrack{position:relative;flex:none;height:54px;display:block}
.ghead .gtrack{height:46px}
.gday{position:absolute;top:2px;width:30px;text-align:center;font-size:11px;line-height:1.3;padding-top:4px;color:var(--muted)}
.gday b{display:block;font-size:13px;color:var(--ink);white-space:nowrap}
.gday.gsun b,.gday.gsun{color:var(--late)}
.gday.td{background:var(--ink);color:var(--surface);border-radius:8px;bottom:2px}
.gday.td b{color:var(--surface)}
.gwk{position:absolute;top:0;bottom:0;width:30px;background:var(--sunk);opacity:.7}
.gtd{position:absolute;top:0;bottom:0;width:2px;background:var(--late);z-index:2}
.gbar{position:absolute;top:20px;height:14px;border-radius:7px;z-index:1}
.gb-ok{background:var(--accent)}.gb-risk{background:var(--warn)}.gb-late{background:var(--late)}.gb-ready{background:var(--ok)}
.gdue{position:absolute;top:19px;width:13px;height:13px;margin-left:-8px;transform:rotate(45deg);background:var(--ink);border:2px solid var(--surface);z-index:2}
.gout{position:absolute;right:6px;top:17px;font-size:13px;font-style:normal;font-weight:700;color:var(--muted);z-index:2}
.grw:hover .glab,.grw[aria-current="true"] .glab{background:var(--accent-soft)}
.grw:hover .gtrack{background:color-mix(in srgb,var(--accent) 7%,transparent)}

/* celebration */
.cel{position:fixed;inset:0;z-index:30;display:grid;place-items:center;background:color-mix(in srgb,#0f1720 40%,transparent);backdrop-filter:blur(3px);padding:16px}
.cel-card{position:relative;background:var(--surface);border-radius:22px;padding:22px 22px 18px;width:min(320px,100%);text-align:center;overflow:hidden;box-shadow:0 20px 50px rgba(0,0,0,.3)}
.cel-card svg{width:130px;height:150px;display:block;margin:0 auto}
.cel-msg{font-size:22px;font-weight:700;margin-top:6px}
.cel-sub{font-size:15px;color:var(--muted);margin:2px 0 16px}
.hop{animation:hop .5s ease-out 0s 3 alternate;transform-origin:50% 100%}
.wave{animation:wave .35s ease-in-out 0s 8 alternate;transform-origin:24px 88px}
.wave2{animation:wave2 .35s ease-in-out 0s 8 alternate;transform-origin:96px 88px}
@keyframes hop{from{transform:translateY(6px) scaleY(.94)}to{transform:translateY(-14px) scaleY(1.03)}}
@keyframes wave{from{transform:rotate(-10deg)}to{transform:rotate(18deg)}}
@keyframes wave2{from{transform:rotate(10deg)}to{transform:rotate(-18deg)}}
.cf{position:absolute;top:-10px;width:8px;height:11px;animation:fall 2.6s linear forwards}
@keyframes fall{to{transform:translateY(360px) rotate(540deg);opacity:.2}}
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(18px + env(safe-area-inset-bottom,0px));background:var(--ink);color:var(--paper);padding:12px 18px;border-radius:14px;z-index:20;max-width:calc(100% - 32px);font-size:16px;display:flex;gap:12px;align-items:center;box-shadow:0 10px 30px rgba(0,0,0,.25)}
.toast button{background:none;border:0;color:var(--c);font-weight:700;cursor:pointer;text-decoration:underline}
@media (prefers-reduced-motion: reduce){.hop,.wave,.wave2{animation:none}.cf{display:none}.card,.card:hover{transition:none;transform:none!important}}

/* ===== server version additions ===== */
.app.narrow{max-width:440px;padding-top:24px}
input[type=password]{min-height:50px;border:1px solid var(--line);border-radius:12px;background:var(--surface);padding:8px 12px;width:100%;box-sizing:border-box;font-size:17px}
.hero-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.hero-tools .who{font-size:14px;color:var(--hero-muted);margin-left:auto}
.icon-btn{border:1px solid rgba(255,255,255,.22);background:transparent;color:var(--on-hero);border-radius:999px;min-height:36px;padding:0 14px;cursor:pointer;font-weight:700;font-size:14px}
.duo{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.duo .today-btn{min-height:84px;padding:12px 14px;gap:12px}
.duo .today-btn b{font-size:18px}
.calico{width:34px;height:34px;flex:none;border-radius:8px;background:var(--surface);border:2px solid var(--accent);position:relative;overflow:hidden}
.calico::before{content:"";position:absolute;left:0;right:0;top:0;height:9px;background:var(--m)}
.calico::after{content:attr(data-d);position:absolute;inset:9px 0 0;display:grid;place-items:center;font:700 14px var(--f-num);color:var(--ink)}
.next-meet{font-size:15px;font-weight:700;color:var(--accent)}
.sync{font-size:13px;color:var(--muted)}
.sync.bad{color:var(--late);font-weight:700}

/* meetings in card */
.mlist{list-style:none;margin:0;padding:0;background:var(--surface);border-radius:12px;border:1px solid var(--line)}
.mrow{display:flex;gap:10px;align-items:center;padding:10px 12px;border-top:1px solid var(--line);flex-wrap:wrap}
.mrow:first-child{border-top:0}
.mrow .when{font-family:var(--f-num);font-weight:700;font-size:17px}
.mrow .what{font-size:15px;color:var(--muted);flex:1;min-width:8em}
.mrow.past{opacity:.6}
.mrow .acts{display:flex;gap:6px;margin-left:auto}
.btn.sm{min-height:40px;padding:0 12px;font-size:15px}
.warn-tag{font-size:13px;font-weight:700;color:var(--late);background:var(--late-soft);border-radius:999px;padding:1px 10px}

/* calendar sheet */
.cal-head{display:flex;align-items:center;gap:8px}
.cal-head .ym{flex:1;text-align:center;font-size:20px;font-weight:700}
.cal-head .btn{min-width:48px;padding:0 10px;font-size:20px}
.month{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;background:var(--surface);border-radius:16px;padding:8px;box-shadow:var(--shadow)}
.month .wd{text-align:center;font-size:13px;font-weight:700;color:var(--muted);padding:2px 0}
.month .wd.su,.dcell.su .dn{color:var(--late)}
.month .wd.sa,.dcell.sa .dn{color:var(--accent)}
.dcell{border:0;background:none;border-radius:10px;min-height:58px;padding:4px 2px;display:flex;flex-direction:column;align-items:center;gap:3px;cursor:pointer;font:inherit;color:inherit}
.dcell .dn{font-family:var(--f-num);font-size:17px;font-weight:700;line-height:1.2;width:30px;height:30px;display:grid;place-items:center;border-radius:50%}
.dcell.other{opacity:.35}
.dcell.past .dn{color:var(--muted)}
.dcell.today .dn{background:var(--ink);color:var(--surface)!important}
.dcell[aria-pressed="true"]{background:var(--accent-soft);outline:2px solid var(--accent)}
.dcell:hover{background:var(--sunk)}
.dots2{display:flex;gap:3px;flex-wrap:wrap;justify-content:center;max-width:44px}
.dots2 i{width:7px;height:7px;border-radius:50%;background:var(--muted);display:block}
.dots2 i.ap{background:var(--m)}
.load{font-size:12px;color:var(--muted)}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:13px;color:var(--muted)}
.legend i{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:5px;vertical-align:1px}

.dayp{background:var(--surface);border-radius:16px;box-shadow:var(--shadow);padding:14px;display:flex;flex-direction:column;gap:10px}
.dayp h3{margin:0;font-size:19px}
.dbar{position:relative;height:30px;background:var(--ok-soft);border-radius:8px;overflow:hidden}
.dbar .b{position:absolute;top:0;bottom:0;background:var(--muted);opacity:.75}
.dbar .b.ap{background:var(--m);opacity:.8}
.dbar .b.pick{background:var(--accent);opacity:.95;outline:2px solid var(--surface)}
.dbar .b.pick.clash{background:var(--late)}
.dticks{display:flex;justify-content:space-between;font-family:var(--f-num);font-size:12px;color:var(--muted);margin-top:-6px}
.seglist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.seg-free,.seg-busy{display:flex;align-items:center;gap:12px;border-radius:12px;padding:10px 12px;min-height:48px;box-sizing:border-box;width:100%;text-align:left;font:inherit}
.seg-free{background:var(--ok-soft);color:var(--ok);border:2px solid transparent;cursor:pointer;font-weight:700}
.seg-free:hover{border-color:var(--ok)}
.seg-free .t,.seg-busy .t{font-family:var(--f-num);font-weight:700;min-width:8.5em}
.seg-busy{background:var(--sunk);color:var(--ink);border:0}
.seg-busy .n{color:var(--muted);font-size:15px;min-width:0;overflow:hidden;text-overflow:ellipsis}
.seg-busy.ap{background:color-mix(in srgb,var(--m) 14%,var(--surface))}
.allday{font-size:14px;color:var(--muted)}
.verdict{border-radius:12px;padding:10px 12px;font-weight:700}
.verdict.ok{background:var(--ok-soft);color:var(--ok)}
.verdict.ng{background:var(--late-soft);color:var(--late)}
.three{display:grid;grid-template-columns:1fr 1fr;gap:8px}

/* settings */
.set-sec{background:var(--surface);border-radius:16px;box-shadow:var(--shadow);padding:16px;display:flex;flex-direction:column;gap:12px}
.set-sec h3{margin:0;font-size:18px}
.calpick{display:flex;flex-direction:column;gap:4px}
.calpick label{display:flex;align-items:center;gap:12px;min-height:44px;cursor:pointer}
.calpick input{width:24px;height:24px;accent-color:var(--accent)}
.swatch{width:14px;height:14px;border-radius:50%;display:inline-block}
.howto{font-size:15px;line-height:1.7;margin:0;padding-left:1.4em}
.ulist{list-style:none;margin:0;padding:0}
.ulist li{display:flex;justify-content:space-between;align-items:center;border-top:1px solid var(--line);padding:6px 0}
.ulist li:first-child{border-top:0}
.gmeet{position:absolute;top:6px;width:10px;height:10px;border-radius:50%;background:var(--m);margin-left:-5px;z-index:2;border:2px solid var(--surface)}
.btn[disabled]{opacity:.45;cursor:not-allowed}
.synced{display:inline-block;margin-left:8px;font-size:13px;font-weight:700;color:var(--ok)}
