:root{--bg:#f6f7fb;--surface:#fff;--surface2:#f0f2f7;--border:#e3e6ee;--text:#1b1f2a;--muted:#667085;--accent:#2f6fed;--accent2:#e8f0ff;--ok:#16a34a;--warn:#d97706;--danger:#dc2626;--shadow:0 1px 2px rgba(16,24,40,.06),0 2px 8px rgba(16,24,40,.06);--shadow-lg:0 12px 32px rgba(16,24,40,.18);--radius:14px;
--c-upcoming:#d97706;--c-inwork:#2f6fed;--c-long:#7c3aed;--c-research:#db2777;--c-done:#16a34a;color-scheme:light}
@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--bg:#0f1218;--surface:#171b23;--surface2:#1f2430;--border:#2a3040;--text:#e8ebf2;--muted:#98a2b3;--accent:#5b8cff;--accent2:#1c2a4a;--shadow:0 1px 2px rgba(0,0,0,.4);--shadow-lg:0 12px 32px rgba(0,0,0,.5);color-scheme:dark}}
:root[data-theme=dark]{--bg:#0f1218;--surface:#171b23;--surface2:#1f2430;--border:#2a3040;--text:#e8ebf2;--muted:#98a2b3;--accent:#5b8cff;--accent2:#1c2a4a;--shadow:0 1px 2px rgba(0,0,0,.4);--shadow-lg:0 12px 32px rgba(0,0,0,.5);color-scheme:dark}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--text);font:15px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased}
a{color:var(--accent);text-decoration:none}
h1{font-size:1.6rem;margin:.2rem 0 .8rem;letter-spacing:-.02em}h2{font-size:1.1rem;margin:0 0 .6rem}h3{font-size:.95rem;margin:0 0 .4rem}
.muted{color:var(--muted)}.small{font-size:.83rem}
#app{display:flex;min-height:100vh}
.sidebar{width:232px;flex:none;background:var(--surface);border-right:1px solid var(--border);padding:18px 12px;display:flex;flex-direction:column;position:sticky;top:0;height:100vh}
.brand{display:flex;align-items:center;gap:10px;font-weight:700;font-size:1.08rem;color:var(--text);padding:4px 8px 18px}
.brand-mark{display:inline-grid;place-items:center;width:34px;height:34px;border-radius:10px;background:linear-gradient(135deg,#2f6fed,#7c3aed);color:#fff;font-size:20px}
.sidebar nav a{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:10px;color:var(--text);font-weight:500;margin-bottom:2px}
.sidebar nav a:hover{background:var(--surface2)}.sidebar nav a.active{background:var(--accent2);color:var(--accent)}
.sidebar nav .sec{font-size:.72rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);padding:14px 10px 4px}
.dot{width:10px;height:10px;border-radius:50%;flex:none;display:inline-block}
.sidebar-foot{margin-top:auto;font-size:.85rem;padding:8px}
main{flex:1;min-width:0;padding:24px 28px 40px}
.bottomnav{display:none}
.loading{padding:40px;color:var(--muted)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--border);background:var(--surface);color:var(--text);padding:8px 14px;border-radius:10px;font:inherit;font-weight:600;cursor:pointer;min-height:38px}
.btn:hover{background:var(--surface2)}.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff}.btn.primary:hover{filter:brightness(1.07)}
.btn.ghost{border-color:transparent;background:transparent}.btn.danger{color:var(--danger)}.btn.big{width:100%;min-height:48px;font-size:1rem}.btn.sm{min-height:30px;padding:4px 10px;font-size:.85rem}
input,select,textarea{font:inherit;color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:9px 11px;width:100%;min-height:40px}
input:focus,select:focus,textarea:focus,.btn:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
textarea{min-height:90px;resize:vertical}
label{display:block;font-size:.82rem;font-weight:600;color:var(--muted);margin:10px 0 4px}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.row>*{flex:1}.row>.btn{flex:none}
.grid{display:grid;gap:16px}.g2{grid-template-columns:repeat(2,minmax(0,1fr))}.g3{grid-template-columns:repeat(3,minmax(0,1fr))}.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
.panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px;box-shadow:var(--shadow);margin-bottom:16px}
.panel pre{white-space:pre-wrap;word-break:break-all;background:var(--surface2);padding:10px;border-radius:8px}
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-bottom:14px;flex-wrap:wrap}
.stat .v{font-size:1.6rem;font-weight:700;letter-spacing:-.02em}.stat .l{color:var(--muted);font-size:.83rem}
.chip{display:inline-flex;align-items:center;gap:4px;font-size:.75rem;font-weight:600;padding:2px 8px;border-radius:999px;background:var(--surface2);color:var(--muted)}
.chip.due{background:#fff4e5;color:#b45309}.chip.over{background:#fde8e8;color:#b91c1c}.chip.okc{background:#e7f6ec;color:#15803d}
:root[data-theme=dark] .chip.due,:root[data-theme=dark] .chip.over,:root[data-theme=dark] .chip.okc{background:var(--surface2)}
.progress{height:8px;background:var(--surface2);border-radius:99px;overflow:hidden}.progress>i{display:block;height:100%;background:var(--accent);border-radius:99px}
.progress.ok>i{background:var(--ok)}.progress.over>i{background:var(--danger)}
.proj-card{display:block;color:var(--text);transition:transform .12s, box-shadow .12s;border-top:4px solid var(--pc)}
.proj-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-lg)}
.meta{display:flex;justify-content:space-between;font-size:.83rem;color:var(--muted);margin:8px 0 4px}
.tabs{display:flex;gap:4px;background:var(--surface2);padding:4px;border-radius:12px;width:max-content;max-width:100%;overflow:auto}
.tabs button{border:0;background:transparent;font:inherit;font-weight:600;color:var(--muted);padding:7px 14px;border-radius:9px;cursor:pointer}
.tabs button.on{background:var(--surface);color:var(--text);box-shadow:var(--shadow)}
/* board */
.board{display:flex;gap:14px;overflow-x:auto;padding-bottom:12px;align-items:flex-start;scroll-snap-type:x mandatory}
.col{flex:0 0 292px;background:var(--surface2);border-radius:var(--radius);padding:10px;scroll-snap-align:start;max-height:calc(100vh - 230px);display:flex;flex-direction:column}
.col-head{display:flex;align-items:center;gap:8px;font-weight:700;padding:4px 4px 10px}.col-head .n{color:var(--muted);font-weight:600;font-size:.85rem}.col-head .grow{flex:1}
.col-list{min-height:40px;overflow-y:auto;flex:1;display:flex;flex-direction:column;gap:8px;padding:2px}
.kcard{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:11px 12px;box-shadow:var(--shadow);cursor:pointer;touch-action:manipulation;user-select:none}
.kcard:hover{border-color:var(--accent)}.kcard .t{font-weight:600;margin-bottom:6px}
.kcard .chips{display:flex;flex-wrap:wrap;gap:5px;align-items:center}
.kcard .av{margin-left:auto}
.av{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;background:var(--accent);color:#fff;font-size:.7rem;font-weight:700}
.sortable-ghost{opacity:.35}.sortable-chosen{box-shadow:var(--shadow-lg);transform:rotate(1.5deg)}
.add-card{margin-top:8px;color:var(--muted);justify-content:flex-start;background:transparent;border:1px dashed var(--border)}
.drawer{margin-top:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.drawer summary{list-style:none;cursor:pointer;padding:12px 16px;font-weight:700;display:flex;align-items:center;gap:8px}
.drawer summary::-webkit-details-marker{display:none}.drawer summary .chev{margin-left:auto;transition:transform .15s}.drawer[open] summary .chev{transform:rotate(180deg)}
.drawer .col-list{flex-direction:row;flex-wrap:wrap;padding:0 14px 14px;max-height:none}.drawer .kcard{width:260px;opacity:.85}
/* modal / sheet */
.backdrop{position:fixed;inset:0;background:rgba(15,18,24,.45);display:flex;align-items:flex-start;justify-content:center;z-index:50;overflow-y:auto;padding:40px 16px}
.modal{background:var(--surface);border-radius:18px;width:100%;max-width:760px;box-shadow:var(--shadow-lg);padding:20px 22px;position:relative}
.modal .x{position:absolute;right:12px;top:12px}
.modal .title-input{font-size:1.25rem;font-weight:700;border-color:transparent;padding-left:4px}
.modal .title-input:hover{border-color:var(--border)}
.modal-grid{display:grid;grid-template-columns:1fr 230px;gap:20px}
.check-item{display:flex;align-items:center;gap:10px;padding:6px 4px;border-radius:8px}.check-item input[type=checkbox]{width:20px;height:20px;min-height:0;flex:none}
.check-item.done span{text-decoration:line-through;color:var(--muted)}.check-item .btn{margin-left:auto;opacity:.5}
.photos{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.photos .stage{background:var(--surface2);border-radius:12px;padding:8px}
.photos img{width:100%;aspect-ratio:1;object-fit:cover;border-radius:8px;display:block;margin-top:6px}
.feed{list-style:none;padding:0;margin:0}.feed li{padding:8px 0;border-bottom:1px solid var(--border);font-size:.88rem}.feed li:last-child{border:0}
/* charts */
.chart svg{width:100%;height:auto;display:block}.chart text{fill:var(--muted);font-size:11px}
.legend{display:flex;flex-wrap:wrap;gap:10px;font-size:.8rem;color:var(--muted);margin-top:6px}
/* timeline */
.tl{overflow-x:auto}.tl-row{display:grid;grid-template-columns:180px 1fr;align-items:center;min-height:34px;border-bottom:1px solid var(--border)}
.tl-name{font-size:.86rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:8px}.tl-track{position:relative;height:34px}
.tl-bar{position:absolute;top:8px;height:18px;border-radius:6px;background:var(--accent);opacity:.9;cursor:pointer}.tl-bar.done{background:var(--ok)}
.tl-today{position:absolute;top:0;bottom:0;width:2px;background:var(--danger);opacity:.6}
/* calendar */
.cal{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}.cal .dow{font-size:.75rem;color:var(--muted);text-align:center;font-weight:600;padding:4px}
.cal .day{background:var(--surface);border:1px solid var(--border);border-radius:10px;min-height:96px;padding:6px;font-size:.78rem;overflow:hidden}
.cal .day.other{opacity:.45}.cal .day.today{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}.cal .day .num{font-weight:700;margin-bottom:4px}
.cal .ev{display:block;padding:2px 6px;border-radius:6px;margin-bottom:3px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
.agenda .item{display:flex;gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid var(--border)}
/* expenses */
.amount-input{font-size:1.6rem;font-weight:700;text-align:left;min-height:56px}
table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:9px 8px;border-bottom:1px solid var(--border);font-size:.9rem;vertical-align:middle}th{color:var(--muted);font-weight:600;font-size:.78rem;text-transform:uppercase;letter-spacing:.04em}
td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}
.exp-list .exp{display:flex;gap:12px;align-items:center;padding:11px 0;border-bottom:1px solid var(--border)}.exp .ic{width:38px;height:38px;border-radius:10px;background:var(--accent2);display:grid;place-items:center;flex:none}
.exp .amt{margin-left:auto;font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap}
#toast{position:fixed;left:50%;bottom:90px;transform:translateX(-50%);background:#1b1f2a;color:#fff;padding:10px 16px;border-radius:12px;font-weight:600;opacity:0;pointer-events:none;transition:opacity .2s;z-index:99}
#toast.show{opacity:1}
.auth-page{display:grid;place-items:center;min-height:100vh;padding:20px;background:radial-gradient(1200px 600px at 10% -10%,#dfe8ff,transparent),radial-gradient(900px 500px at 110% 110%,#efe3ff,transparent),var(--bg)}
:root[data-theme=dark] .auth-page{background:var(--bg)}
.auth-card{background:var(--surface);border:1px solid var(--border);padding:32px 28px;border-radius:20px;box-shadow:var(--shadow-lg);width:100%;max-width:400px;text-align:center}
.auth-card .brand-mark{width:52px;height:52px;font-size:30px;border-radius:14px;margin-bottom:10px}.auth-card input{margin:14px 0 10px;min-height:48px;font-size:1rem}
.page-pad{padding:20px;max-width:800px;margin:auto}
.empty{text-align:center;padding:30px;color:var(--muted)}
.fab{display:none}
@media (max-width:860px){
  .sidebar{display:none} main{padding:16px 14px calc(84px + env(safe-area-inset-bottom))}
  .bottomnav{display:flex;position:fixed;left:0;right:0;bottom:0;background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:blur(12px);border-top:1px solid var(--border);padding:6px 4px calc(6px + env(safe-area-inset-bottom));z-index:40}
  .bottomnav a{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:.7rem;font-weight:600;color:var(--muted);padding:4px 0}
  .bottomnav a .i{font-size:1.3rem;line-height:1}.bottomnav a.active{color:var(--accent)}
  .g2,.g3{grid-template-columns:1fr}.g4{grid-template-columns:repeat(2,1fr)}
  .col{flex-basis:84vw;max-height:none}.board{margin:0 -14px;padding:0 14px 12px}
  .backdrop{padding:0;align-items:flex-end}.modal{border-radius:20px 20px 0 0;max-height:92vh;overflow-y:auto;padding:18px 16px calc(24px + env(safe-area-inset-bottom))}
  .modal-grid{grid-template-columns:1fr}.drawer .kcard{width:100%}
  .cal .day{min-height:54px;padding:4px}.cal .ev{font-size:0;height:6px;padding:0;margin:2px 0}
  .tl-row{grid-template-columns:110px 1fr} h1{font-size:1.35rem}
  .fab{display:grid;place-items:center;position:fixed;right:16px;bottom:calc(78px + env(safe-area-inset-bottom));width:54px;height:54px;border-radius:50%;background:var(--accent);color:#fff;font-size:28px;border:0;box-shadow:var(--shadow-lg);z-index:41}
  .hide-m{display:none}
}
