:root{
  --navy:#14263d; --navy2:#1f3a5f; --bg:#f2f4f8; --card:#fff; --line:#e3e7ee; --ink:#1b2430; --mute:#6b7685;
  --amber:#f5b301; --red:#c62828; --redbg:#fde8e8; --green:#2e7d32; --greenbg:#e7f4e8; --yellow:#fff4cc; --blue:#e6efff; --sat:#eef0f3;
  --radius:14px; --shadow:0 1px 2px rgba(20,38,61,.06),0 4px 14px rgba(20,38,61,.06);
  --bnav-h:64px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.4 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;-webkit-text-size-adjust:100%}
body.locked{overflow:hidden}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
[hidden]{display:none!important}
h2{font-size:21px;margin:0}
h3{font-size:17px;margin:0 0 10px;display:flex;align-items:center;gap:8px}
.count{background:#eef1f5;color:#44505f;border-radius:99px;font-size:13px;padding:1px 9px}

/* Top bar */
.top{position:sticky;top:0;z-index:20;background:var(--navy);color:#fff;padding:0 14px;padding-top:env(safe-area-inset-top)}
.top-row{display:flex;align-items:center;gap:12px;max-width:1400px;margin:0 auto;height:56px}
.brand{display:flex;align-items:center;gap:9px;font-weight:700;font-size:17px;letter-spacing:.2px;white-space:nowrap}
.brand svg{width:30px;height:30px;stroke:none}
.brand small{display:block;font-weight:500;font-size:11px;opacity:.65;letter-spacing:.5px;text-transform:uppercase}
.brand span{line-height:1.1}
.tabs{display:none;flex:1;justify-content:center;gap:4px}
.tab{display:flex;align-items:center;gap:7px;background:none;border:0;color:#c8d3e2;padding:9px 14px;border-radius:10px;font-weight:600}
.tab svg{width:19px;height:19px}
.tab.on{color:#fff;background:rgba(255,255,255,.12)}
.icon-btn{margin-left:auto;display:grid;place-items:center;background:rgba(255,255,255,.1);border:0;color:#fff;border-radius:10px;width:42px;height:42px}
.icon-btn.dark{background:#eef1f5;color:var(--ink)}

/* Bottom nav (phone / iPad portrait) */
.bnav{position:fixed;left:0;right:0;bottom:0;z-index:30;display:flex;background:#fff;border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom);box-shadow:0 -4px 16px rgba(20,38,61,.06)}
.bt{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;height:var(--bnav-h);background:none;border:0;color:#7a8596;font-size:11.5px;font-weight:600}
.bt.on{color:var(--navy2)}
.bt.on svg{stroke:var(--navy2);background:#e8eef7;border-radius:10px;padding:3px 10px;width:42px;height:28px}
@media(min-width:1024px){.tabs{display:flex}.bnav{display:none}.icon-btn{margin-left:0}}

main{max-width:1400px;margin:0 auto;padding:14px 14px calc(var(--bnav-h) + 90px + env(safe-area-inset-bottom))}
@media(min-width:1024px){main{padding:18px 22px 100px}}
.page-head{display:flex;align-items:center;gap:10px;margin:4px 0 12px}
.page-head h2{flex:1}
.card{background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px;margin-bottom:14px}
.muted{color:var(--mute)}
.pad{padding:8px 0}
.row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.spacer{flex:1}
.hint{font-size:13px;color:var(--mute);margin-top:4px}
.hint.center{text-align:center;margin:10px 0}
.empty{padding:24px;text-align:center;color:var(--mute)}

/* FAB */
.fab{position:fixed;right:16px;bottom:calc(var(--bnav-h) + 16px + env(safe-area-inset-bottom));z-index:25;display:flex;align-items:center;gap:6px;background:var(--amber);color:#1b1b1b;border:0;border-radius:99px;padding:14px 20px 14px 16px;font-weight:700;box-shadow:0 6px 20px rgba(0,0,0,.22)}
.fab svg{stroke-width:2.6}
@media(min-width:1024px){.fab{bottom:24px;right:24px}}
.btn.wide-only{display:none}
@media(min-width:1024px){.btn.wide-only{display:inline-flex}}

/* Buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid #d5dce6;background:#fff;border-radius:11px;padding:11px 16px;font-weight:600;min-height:44px}
.btn.primary{background:var(--navy2);color:#fff;border-color:var(--navy2)}
.btn.amber{background:var(--amber);border-color:var(--amber);color:#1b1b1b}
.btn.danger{color:var(--red);border-color:#f2c4c4}
.btn.ghost{border-color:transparent;background:transparent}
.btn.block{width:100%}
.btn.grow{flex:1}
.btn:disabled{opacity:.5;cursor:default}
.btn.sm{padding:7px 12px;font-size:14px;min-height:38px}
.btn.icon{width:44px;padding:0}
.seg{display:inline-flex;background:#e4e8ef;border-radius:12px;padding:3px}
.seg button{border:0;background:none;padding:9px 14px;border-radius:9px;font-weight:600;color:#4a5566;min-height:40px}
.seg button.on{background:#fff;color:var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.12)}
.seg.small button{padding:7px 10px;font-size:14px}

/* Board nav */
.board-nav{display:flex;align-items:center;gap:8px;margin-bottom:12px;flex-wrap:wrap}
.board-nav .range{font-weight:700}
.navgrp{display:flex;gap:6px}

/* Day view */
.strip{display:flex;gap:8px;overflow-x:auto;padding:4px 2px 10px;scroll-snap-type:x proximity;scrollbar-width:none;margin:0 -14px;padding-left:14px;padding-right:14px}
.strip::-webkit-scrollbar{display:none}
.dchip{flex:none;scroll-snap-align:center;width:54px;height:72px;border-radius:14px;border:1px solid var(--line);background:#fff;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
.dchip small{font-size:12px;color:var(--mute);font-weight:600}
.dchip b{font-size:20px}
.dchip i{width:7px;height:7px;border-radius:50%;background:transparent}
.dchip i.dot{background:#9fb3cc}
.dchip i.dot-red{background:var(--red)}
.dchip.today{border:2px solid var(--amber)}
.dchip.sat{background:var(--sat)}
.dchip.sel{background:var(--navy2);border-color:var(--navy2);color:#fff}
.dchip.sel small{color:#c8d3e2}
.day-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin:6px 2px 12px;flex-wrap:wrap}
.pcards{display:grid;gap:12px;grid-template-columns:1fr;margin-bottom:14px}
@media(min-width:700px){.pcards{grid-template-columns:1fr 1fr}}
@media(min-width:1200px){.pcards{grid-template-columns:1fr 1fr 1fr}}
.pcard{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);padding:14px}
.pc-head{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.pc-head b{font-size:17px;flex:1}
.ava{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:700;flex:none}
.idle-btn{width:100%;border:2px dashed #e4b4b4;background:#fff7f7;color:var(--red);border-radius:12px;padding:16px;font-size:15px}
.pcard.idle .idle-btn b{font-weight:800}
.jblock{border-radius:12px;border-left:6px solid var(--c);background:color-mix(in srgb,var(--c) 9%,#fff);padding:10px 12px;margin-top:8px}
.jblock.miss{box-shadow:inset 0 0 0 2px var(--red)}
.jblock.done{opacity:.55}
.jb-main{cursor:pointer}
.jb-title{font-size:18px;font-weight:700}
.jb-title .ph{font-weight:500;color:var(--mute);font-size:15px}
.jb-sub{font-size:14px;color:#4a5566;margin-top:2px}
.jb-flags{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.jb-flags span{font-size:12.5px;font-weight:600;background:#fff;border-radius:99px;padding:2px 9px;border:1px solid var(--line)}
.jb-note{font-size:14px;margin-top:6px;color:#3b4554;background:#fff;border-radius:8px;padding:6px 9px}
.jb-actions{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap}

/* Week grid */
.board-wrap{overflow-x:auto;background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);-webkit-overflow-scrolling:touch}
table.board{border-collapse:separate;border-spacing:0;min-width:100%}
.board th,.board td{border-bottom:1px solid var(--line);border-right:1px solid var(--line);vertical-align:top;padding:5px}
.board thead th{position:sticky;top:0;background:#f8fafc;font-size:12px;font-weight:600;color:var(--mute);text-align:center;padding:7px 4px;white-space:nowrap}
.board thead th b{font-size:14px;color:var(--ink)}
.board thead th.today{background:var(--yellow)}
.board thead th.sat,.board td.sat{background:var(--sat)}
.board th.name{position:sticky;left:0;z-index:2;background:#fff;text-align:left;font-size:15px;color:var(--ink);min-width:84px;padding:10px 8px;box-shadow:2px 0 4px rgba(0,0,0,.04)}
.board thead th.name{z-index:3;background:#f8fafc}
.board td{min-width:128px;height:70px;cursor:pointer}
.board td.today{background:#fffbea}
.board td.sat{min-width:84px}
.board td.clash{background:var(--redbg)}
.board tr.idle-row td,.board tr.idle-row th{background:#fafbfc;height:auto;cursor:default;font-size:13px;text-align:center}
.idle-bad{color:var(--red);font-weight:700}
.wk-sep{border-left:3px solid #c9d2df!important}
.chip{display:block;border-radius:8px;padding:6px 8px;font-size:13.5px;font-weight:600;line-height:1.2;margin-bottom:4px;color:#1b2430;border-left:4px solid var(--c,#7a8aa0);background:color-mix(in srgb,var(--c,#7a8aa0) 15%,#fff);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:200px}
.chip .ph{display:block;font-weight:500;color:var(--mute);font-size:12px}
.chip.miss{box-shadow:inset 0 0 0 2px var(--red)}
.chip.done{opacity:.45;text-decoration:line-through}
.chip.past{opacity:.65}
.chip.demo{display:inline-block;margin-right:8px;min-width:120px}
.add-hint{color:#c3cad4;font-size:22px;text-align:center;line-height:56px}
@media(hover:hover){.add-hint{display:none}.board td:hover .add-hint{display:block}.board td:hover{background:#f1f6ff}}
@media(min-width:768px) and (max-width:1366px){.board td{min-width:120px;height:76px}}

/* Legend */
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:13px;color:var(--mute);margin:4px 2px 12px}
.legend span{display:inline-flex;align-items:center;gap:6px}
.lg{display:inline-block;width:14px;height:14px;border-radius:4px;vertical-align:-2px}
.lg.miss{box-shadow:inset 0 0 0 2px var(--red);background:#fff}
.lg.clash{background:var(--redbg);border:1px solid #f2c4c4}
.lg.sat{background:var(--sat);border:1px solid var(--line)}

/* Lists */
.list{display:flex;flex-direction:column}
.item{display:flex;align-items:center;gap:12px;padding:12px 2px;border-top:1px solid var(--line);cursor:pointer;min-height:56px}
.item:first-child{border-top:0}
.item.static{cursor:default}
.item .main{flex:1;min-width:0}
.item .t{font-weight:700;font-size:16px}
.item .s{font-size:14px;color:var(--mute);margin-top:1px}
.item.job{align-items:flex-start}
.badges{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}
.badge{display:inline-block;font-size:12px;font-weight:700;padding:3px 9px;border-radius:99px;background:#eef1f5;color:#44505f;white-space:nowrap}
.badge.p1{background:#fbd5c8;color:#8a2a0e}.badge.p2{background:#ffeaa6;color:#6b4e00}.badge.p3{background:#d5ecd0;color:#1f5c22}
.badge.red{background:var(--redbg);color:var(--red)}.badge.green{background:var(--greenbg);color:var(--green)}
.badge.yellow{background:var(--yellow);color:#6b4e00}.badge.blue{background:var(--blue);color:#1f4b99}
.warn{font-size:13px;color:var(--red);font-weight:700;margin-top:3px}
.swatch{width:8px;align-self:stretch;min-height:40px;border-radius:4px;flex:none}
.inline-form{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.inline-form input{flex:1;min-width:150px;border:1px solid #cfd6e0;border-radius:11px;padding:11px 12px;font-size:16px;background:#fff;min-height:44px}
.log-item{padding:12px 0;border-top:1px solid var(--line)}
.log-item:first-child{border-top:0}
.log-item .s{color:#3b4554;margin-top:3px;font-size:15px}

/* Sheet */
.sheet-bg{position:fixed;inset:0;background:rgba(10,20,35,.5);z-index:50;display:flex;align-items:flex-end;justify-content:center;animation:fade .15s}
.sheet{background:#fff;width:100%;max-width:600px;max-height:94vh;max-height:94dvh;display:flex;flex-direction:column;border-radius:20px 20px 0 0;box-shadow:0 -8px 30px rgba(0,0,0,.2);animation:up .2s ease-out}
@media(min-width:700px){.sheet-bg{align-items:center}.sheet{border-radius:20px;max-height:88vh}}
@keyframes up{from{transform:translateY(30px);opacity:.6}}
@keyframes fade{from{opacity:0}}
.sheet-head{display:flex;align-items:center;gap:10px;padding:16px 18px 10px;border-bottom:1px solid var(--line)}
.sheet-head h2{flex:1;font-size:20px}
.sheet-body{overflow-y:auto;padding:16px 18px;-webkit-overflow-scrolling:touch}
.sheet-foot{display:flex;gap:8px;padding:12px 18px calc(12px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:#fff;border-radius:0 0 20px 20px;flex-wrap:wrap}
.field{margin-bottom:16px}
.field label{display:block;font-size:14px;color:#4a5566;margin-bottom:6px;font-weight:700}
.field input[type=text],.field input[type=date],.field input[type=number],.field input[type=password],.field select,.field textarea,.preview input{width:100%;border:1px solid #cfd6e0;border-radius:11px;padding:11px 12px;background:#fff;font-size:16px;min-height:46px}
.field textarea{min-height:70px;resize:vertical}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
@media(max-width:480px){.grid2{grid-template-columns:1fr}}
.stepper{display:flex;align-items:center;gap:8px}
.stepper input{text-align:center;width:76px!important;font-weight:700;font-size:18px!important}
.stepper .btn{width:50px;padding:0;font-size:22px}
.pills{display:flex;flex-wrap:wrap;gap:8px}
.pill{border:1px solid #cfd6e0;background:#fff;border-radius:99px;padding:10px 16px;font-weight:600;min-height:44px}
.pill.on{background:var(--navy2);border-color:var(--navy2);color:#fff}
.toggles{display:flex;flex-direction:column;gap:2px;margin-bottom:12px;background:#f7f9fb;border-radius:12px;padding:4px 12px}
.tgl{display:flex;align-items:center;gap:12px;padding:10px 0;cursor:pointer;border-top:1px solid var(--line)}
.tgl:first-child{border-top:0}
.tgl input{position:absolute;opacity:0;pointer-events:none}
.tgl .sw{width:48px;height:28px;border-radius:99px;background:#cfd6e0;position:relative;flex:none;transition:.15s}
.tgl .sw::after{content:"";position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:.15s}
.tgl input:checked + .sw{background:var(--green)}
.tgl input:checked + .sw::after{left:23px}
.tgl small{display:block;color:var(--mute);font-size:13px}
.summary{font-weight:700;margin-bottom:10px;color:#3b4554}

/* Preview */
.preview{border:2px solid var(--amber);border-radius:14px;padding:14px;background:#fffbea}
.preview h4{margin:0 0 8px;font-size:17px}
.mv{display:flex;justify-content:space-between;gap:10px;padding:8px 0;border-top:1px dashed #e8d9a0;font-size:15px}
.mv:first-of-type{border-top:0}
.mv .to{font-weight:700;white-space:nowrap;text-align:right}
.conf{color:var(--red);font-size:14px;padding:8px 0}

/* Guide */
.guide{display:flex;flex-direction:column;gap:10px}
.gcard{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.g-head{width:100%;display:flex;align-items:center;gap:12px;background:none;border:0;padding:16px;text-align:left;font-size:16px;min-height:60px}
.g-ic{font-size:22px;width:30px;text-align:center}
.g-head b{flex:1}
.chev{color:var(--mute);transition:.15s}
.gcard.open .chev{transform:rotate(90deg)}
.g-body{display:none;padding:0 18px 16px 58px;font-size:15.5px;line-height:1.55;color:#2c3644}
.gcard.open .g-body{display:block}
.g-body ol,.g-body ul{padding-left:20px;margin:6px 0}
.g-body li{margin:6px 0}
.g-body ul.plain{list-style:none;padding-left:0}
.g-body .note{background:#f2f6fc;border-radius:10px;padding:10px 12px}
.demo-row{margin-top:10px}
@media(max-width:480px){.g-body{padding-left:18px}}

/* Login */
.login{min-height:100vh;min-height:100dvh;display:flex;align-items:center;justify-content:center;padding:20px;background:linear-gradient(160deg,var(--navy),var(--navy2))}
.login .box{background:#fff;border-radius:22px;padding:30px 26px;width:100%;max-width:380px;box-shadow:0 20px 50px rgba(0,0,0,.25);text-align:center}
.login .box svg{stroke:none}
.login h1{margin:10px 0 2px;font-size:24px}
.login input{width:100%;border:1px solid #cfd6e0;border-radius:12px;padding:14px;font-size:18px;margin:18px 0 8px;text-align:center;letter-spacing:1px}
.err{color:var(--red);font-size:14px;min-height:20px;margin-bottom:6px}

.toast{position:fixed;left:50%;bottom:calc(var(--bnav-h) + 20px + env(safe-area-inset-bottom));transform:translateX(-50%);background:var(--navy);color:#fff;padding:12px 18px;border-radius:12px;z-index:80;box-shadow:var(--shadow);max-width:90vw;font-weight:600}

/* Credit */
.credit{text-align:center;font-size:12.5px;color:#8a94a3;margin:22px 0 6px}
.credit a{color:var(--navy2);font-weight:700;text-decoration:none}
.credit.light{position:absolute;left:0;right:0;bottom:calc(18px + env(safe-area-inset-bottom));color:rgba(255,255,255,.65)}
.credit.light a{color:#fff}
.login{position:relative}
