:root{
  --bg:#F7F6F2;
  --bg-soft:#FBFAF7;
  --surface:#FFFFFF;
  --surface-2:#F2F0E9;
  --text:#22201C;
  --text-2:#6D695F;
  --text-3:#A8A397;
  --line:#E8E4DA;
  --line-strong:#D8D2C4;
  --accent:#DF5B3C;
  --accent-soft:#FCEDE7;
  --topbar:rgba(247,246,242,.88);
  --shadow:0 1px 2px rgba(40,35,25,.04),0 10px 28px rgba(40,35,25,.05);
  --shadow-hover:0 2px 6px rgba(40,35,25,.06),0 18px 42px rgba(40,35,25,.11);
  --radius:16px;
}
[data-theme="dark"]{
  --bg:#15161A;
  --bg-soft:#1B1D21;
  --surface:#212329;
  --surface-2:#2A2D34;
  --text:#F1EFE9;
  --text-2:#A8A59D;
  --text-3:#767872;
  --line:#32353C;
  --line-strong:#41454D;
  --accent:#F0795B;
  --accent-soft:#3B2823;
  --topbar:rgba(21,22,26,.88);
  --shadow:0 1px 2px rgba(0,0,0,.25),0 10px 28px rgba(0,0,0,.2);
  --shadow-hover:0 2px 6px rgba(0,0,0,.3),0 18px 42px rgba(0,0,0,.32);
}
*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{
  background:var(--bg);color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  -webkit-font-smoothing:antialiased;line-height:1.6;min-height:100vh;
}
button,input,textarea,select{font:inherit;color:inherit}
button{cursor:pointer;background:none;border:none}
svg{display:block;flex:none}
::selection{background:var(--accent-soft);color:var(--accent)}

/* topbar */
.topbar{position:sticky;top:0;z-index:50;background:var(--topbar);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border-bottom:1px solid var(--line)}
.topbar-inner{max-width:1280px;margin:0 auto;padding:13px 32px;display:flex;align-items:center;gap:14px}
.brand{display:flex;align-items:center;gap:11px;flex:none;margin-right:auto}
.brand-mark{width:36px;height:36px;border-radius:11px;background:var(--accent);color:#fff;display:grid;place-items:center;box-shadow:0 4px 12px rgba(223,91,60,.28)}
.brand-text{display:flex;flex-direction:column;line-height:1.15}
.brand-text strong{font-size:15px;letter-spacing:.5px}
.brand-text span{font-size:9px;letter-spacing:1.6px;color:var(--text-3);margin-top:4px;font-weight:600}
.sync{display:inline-flex;align-items:center;gap:7px;font-size:11.5px;color:var(--text-2);background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:6px 11px;white-space:nowrap;transition:.18s}
.sync:hover{border-color:var(--line-strong)}
.sync i{width:7px;height:7px;border-radius:50%;background:#B9B4A8;display:block}
.sync[data-state="online"] i{background:#3D9C70;box-shadow:0 0 0 3px rgba(61,156,112,.15)}
.sync[data-state="syncing"] i{background:#E5A33B;animation:pulse 1.2s infinite}
.sync[data-state="offline"] i{background:#E2563C}
@keyframes pulse{50%{opacity:.35}}
.search-wrap{display:flex;align-items:center;gap:9px;background:var(--surface);border:1px solid var(--line);border-radius:11px;padding:0 12px;height:38px;width:210px;color:var(--text-3);transition:border-color .2s,box-shadow .2s}
.search-wrap:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.search-wrap input{border:none;outline:none;background:transparent;width:100%;font-size:13px;color:var(--text)}
.search-wrap input::placeholder{color:var(--text-3)}
.icon-btn{width:38px;height:38px;border-radius:11px;border:1px solid var(--line);background:var(--surface);color:var(--text-2);display:grid;place-items:center;transition:.18s}
.icon-btn:hover{color:var(--accent);border-color:var(--line-strong);transform:translateY(-1px)}
.more-wrap{position:relative}
.dropdown{position:absolute;right:0;top:46px;width:210px;background:var(--surface);border:1px solid var(--line);border-radius:13px;box-shadow:var(--shadow-hover);padding:6px;opacity:0;visibility:hidden;transform:translateY(-6px);transition:.18s;z-index:60}
.dropdown.open{opacity:1;visibility:visible;transform:translateY(0)}
.dropdown button{width:100%;display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:8px;font-size:13px;color:var(--text-2);text-align:left}
.dropdown button:hover{background:var(--surface-2);color:var(--text)}
.dropdown hr{border:none;border-top:1px solid var(--line);margin:5px 4px}
.dropdown .danger:hover{color:var(--accent);background:var(--accent-soft)}
.primary-btn{display:inline-flex;align-items:center;gap:7px;background:var(--accent);color:#fff;border-radius:11px;padding:0 16px;height:38px;font-size:13px;font-weight:600;white-space:nowrap;box-shadow:0 4px 12px rgba(223,91,60,.22);transition:.18s}
.primary-btn:hover{transform:translateY(-1px);filter:brightness(1.06)}
.primary-btn:disabled{opacity:.55;cursor:wait;transform:none}
.ghost-btn{display:inline-flex;align-items:center;gap:7px;font-size:13px;color:var(--text-2);padding:9px 16px;border-radius:10px;border:1px solid var(--line);transition:.16s}
.ghost-btn:hover{background:var(--surface-2);color:var(--text)}

/* layout */
.wrap{max-width:1280px;margin:0 auto;padding:0 32px}
.hero{display:grid;grid-template-columns:minmax(0,1fr) 290px;gap:48px;align-items:center;padding:54px 0 34px;position:relative}
.hero::before{content:"";position:absolute;right:-90px;top:-60px;width:360px;height:360px;border-radius:50%;background:radial-gradient(circle,var(--accent-soft),transparent 68%);pointer-events:none;z-index:-1;opacity:.8}
.eyebrow{font-size:10px;letter-spacing:2.6px;color:var(--accent);font-weight:700;margin-bottom:16px}
.hero h1{font-size:44px;line-height:1.24;letter-spacing:-1.5px;font-weight:800;margin-bottom:16px}
.hero h1 em{font-style:normal;color:var(--accent)}
.hero-sub{color:var(--text-2);font-size:14px;max-width:560px;line-height:1.85}
.quote-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:22px;box-shadow:var(--shadow);position:relative;overflow:hidden}
.quote-card::after{content:"";position:absolute;right:-24px;bottom:-38px;width:120px;height:120px;border-radius:50%;background:var(--accent-soft);opacity:.75}
.quote-mark{font-size:44px;line-height:1;color:var(--accent);font-family:Georgia,serif;opacity:.6}
.quote-card p{font-size:14px;line-height:1.85;position:relative;z-index:1;margin:2px 0 12px}
.quote-card small{font-size:11px;color:var(--text-3);position:relative;z-index:1}

/* migration notice */
.notice{display:none;align-items:center;gap:11px;background:var(--accent-soft);border:1px solid var(--accent);border-color:color-mix(in srgb,var(--accent) 25%,transparent);color:var(--text-2);padding:12px 14px;border-radius:12px;font-size:12.5px;margin-bottom:22px;line-height:1.6}
.notice.show{display:flex}
.notice > span:nth-child(2){flex:1}
.notice b{color:var(--accent)}
.notice-btn{background:var(--accent);color:#fff;font-size:12px;font-weight:600;padding:7px 13px;border-radius:8px;white-space:nowrap}
.notice-link{color:var(--text-3);font-size:12px;white-space:nowrap;text-decoration:underline;text-underline-offset:3px}
.notice-link:hover{color:var(--text)}

/* stats */
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:34px}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:17px 20px;display:flex;align-items:center;gap:14px;box-shadow:var(--shadow)}
.stat-icon{width:38px;height:38px;border-radius:11px;display:grid;place-items:center;background:var(--surface-2);color:var(--text-2)}
.stat:nth-child(1) .stat-icon{background:var(--accent-soft);color:var(--accent)}
.stat:nth-child(3) .stat-icon{background:#E6F3EB;color:#2F7D5D}
.stat-num{font-size:22px;font-weight:800;line-height:1.1;letter-spacing:-.5px}
.stat-label{font-size:11px;color:var(--text-3);margin-top:3px}

/* toolbar */
.toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid var(--line);flex-wrap:wrap}
.tabs{display:flex;gap:4px;overflow-x:auto;scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tab{position:relative;padding:12px 14px 14px;font-size:13px;color:var(--text-3);white-space:nowrap;transition:.18s;font-weight:500}
.tab:hover{color:var(--text)}
.tab.active{color:var(--text);font-weight:700}
.tab.active::after{content:"";position:absolute;left:14px;right:14px;bottom:-1px;height:2px;background:var(--accent);border-radius:2px}
.tab .count{font-size:10px;color:var(--text-3);background:var(--surface-2);padding:1px 6px;border-radius:20px;margin-left:5px;vertical-align:1px}
.toolbar-right{display:flex;align-items:center;gap:10px;padding-bottom:8px}
.select{height:34px;border:1px solid var(--line);background:var(--surface);border-radius:9px;padding:0 28px 0 11px;font-size:12px;color:var(--text-2);outline:none;cursor:pointer;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A8A397' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 9px center}
.view-switch{display:flex;background:var(--surface);border:1px solid var(--line);border-radius:9px;padding:3px;gap:2px}
.view-switch button{width:28px;height:26px;border-radius:6px;color:var(--text-3);display:grid;place-items:center;transition:.15s}
.view-switch button.active{background:var(--surface-2);color:var(--accent)}
.tagbar{display:flex;align-items:center;gap:7px;flex-wrap:wrap;padding:16px 0 4px;min-height:46px}
.tagbar-label{font-size:11px;color:var(--text-3);margin-right:2px}
.tag-chip{font-size:11.5px;padding:5px 11px;border-radius:20px;border:1px solid var(--line);background:var(--surface);color:var(--text-2);transition:.16s}
.tag-chip:hover{border-color:var(--line-strong)}
.tag-chip.active{background:var(--text);color:var(--surface);border-color:var(--text)}
.tag-chip b{font-weight:600;opacity:.55;margin-left:4px;font-size:10px}

/* cards */
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(290px,1fr));gap:16px;padding:18px 0 46px;min-height:220px}
.cards.list-view{grid-template-columns:1fr}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:19px 20px 16px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:11px;position:relative;cursor:pointer;transition:transform .2s,box-shadow .2s,border-color .2s;min-height:196px;animation:cardIn .35s both}
@keyframes cardIn{from{opacity:0;transform:translateY(9px)}to{opacity:1;transform:translateY(0)}}
.card:hover{transform:translateY(-3px);box-shadow:var(--shadow-hover);border-color:var(--line-strong)}
.card.pinned{border-color:color-mix(in srgb,var(--accent) 35%,var(--line))}
.card-top{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:24px}
.badge{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:700;padding:4px 9px;border-radius:20px;color:var(--b);background:var(--bb)}
.badge i{width:5px;height:5px;border-radius:50%;background:currentColor;display:block}
.badge-spark{--b:#B0751C;--bb:#FCF1DC}
.badge-doing{--b:#3168B4;--bb:#E7F0FD}
.badge-done{--b:#2C7A59;--bb:#E3F3EA}
.badge-archived{--b:#807B6E;--bb:#EEECE6}
[data-theme="dark"] .badge-spark{--b:#E9B45E;--bb:#3A3020}
[data-theme="dark"] .badge-doing{--b:#7EAEF0;--bb:#202C3E}
[data-theme="dark"] .badge-done{--b:#71C79C;--bb:#1E332A}
[data-theme="dark"] .badge-archived{--b:#A6A198;--bb:#2C2E32}
.card-actions{display:flex;gap:2px}
.card-actions button{width:26px;height:26px;border-radius:7px;color:var(--text-3);display:grid;place-items:center;opacity:.55;transition:.15s}
.card:hover .card-actions button,.card:focus-within .card-actions button{opacity:1}
.card-actions button:hover{background:var(--surface-2);color:var(--text)}
.card-actions button[data-act="del"]:hover{background:var(--accent-soft);color:var(--accent)}
.card-actions button.pinned-btn{color:var(--accent);opacity:1}
.card-title{font-size:16px;font-weight:700;line-height:1.45;word-break:break-word}
.card-desc{font-size:12.5px;color:var(--text-2);line-height:1.75;flex:1;white-space:pre-wrap;word-break:break-word;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.card-tags{display:flex;gap:6px;flex-wrap:wrap}
.tag{font-size:10.5px;color:var(--text-3);background:var(--surface-2);padding:3px 8px;border-radius:6px}
.card-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px dashed var(--line);padding-top:11px;margin-top:2px;font-size:10.5px;color:var(--text-3)}
.prio{display:inline-flex;align-items:center;gap:5px}
.prio .dot{width:6px;height:6px;border-radius:50%;background:#B9B4A8}
.prio.p3 .dot{background:#E2563C}
.prio.p3{color:var(--accent)}
.prio.p2 .dot{background:#E5A33B}
.cards.list-view .card{min-height:0;display:grid;grid-template-columns:110px minmax(0,1fr) auto;grid-template-areas:"top title title" "top desc desc" "top foot foot";column-gap:18px;row-gap:5px;align-items:start}
.cards.list-view .card-top{grid-area:top;align-self:start}
.cards.list-view .card-title{grid-area:title}
.cards.list-view .card-desc{grid-area:desc;-webkit-line-clamp:2}
.cards.list-view .card-tags{display:none}
.cards.list-view .card-foot{grid-area:foot;border:none;padding-top:2px;margin-top:0;justify-content:flex-start;gap:18px}
.cards.list-view .card-actions{position:absolute;right:14px;top:14px}

/* empty */
.empty{display:none;text-align:center;padding:56px 20px 70px}
.empty.show{display:block}
.empty-ill{width:72px;height:72px;border-radius:22px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;margin:0 auto 20px;transform:rotate(-8deg)}
.empty h3{font-size:18px;margin-bottom:8px}
.empty p{font-size:13px;color:var(--text-2);margin-bottom:20px}
.empty-actions{display:flex;justify-content:center;gap:10px;flex-wrap:wrap}
.empty-actions.hidden{display:none}

/* footer */
.footer{border-top:1px solid var(--line);padding:22px 0 36px;display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;font-size:11px;color:var(--text-3)}
.kbd{border:1px solid var(--line-strong);border-bottom-width:2px;border-radius:5px;padding:1px 5px;font-size:10px;color:var(--text-2);background:var(--surface)}

/* overlays */
.overlay{position:fixed;inset:0;background:rgba(28,25,20,.42);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);z-index:100;display:none;align-items:center;justify-content:center;padding:20px}
[data-theme="dark"] .overlay{background:rgba(0,0,0,.62)}
.overlay.open{display:flex}
.modal{background:var(--surface);border:1px solid var(--line);border-radius:20px;width:100%;max-width:560px;max-height:calc(100vh - 40px);overflow-y:auto;box-shadow:0 24px 70px rgba(0,0,0,.2);animation:modalIn .22s both}
@keyframes modalIn{from{opacity:0;transform:translateY(12px) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}
.modal-head{padding:24px 26px 16px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;border-bottom:1px solid var(--line)}
.modal-head h2{font-size:19px}
.modal-head p{font-size:11.5px;color:var(--text-3);margin-top:4px}
.modal-body{padding:22px 26px 24px;display:flex;flex-direction:column;gap:19px}
.field label{display:block;font-size:12px;font-weight:700;margin-bottom:8px}
.field label span{font-weight:400;color:var(--text-3);font-size:11px;margin-left:5px}
.input,.textarea{width:100%;background:var(--bg-soft);border:1px solid var(--line);border-radius:11px;padding:11px 13px;font-size:13px;outline:none;transition:.18s;color:var(--text)}
.input:focus,.textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft);background:var(--surface)}
.input::placeholder,.textarea::placeholder{color:var(--text-3)}
.textarea{resize:vertical;min-height:96px;line-height:1.7}
.chips{display:flex;gap:8px;flex-wrap:wrap}
.chip{position:relative;display:inline-flex;cursor:pointer}
.chip input{position:absolute;opacity:0;width:0;height:0}
.chip span{display:inline-block;font-size:12px;padding:7px 14px;border-radius:9px;border:1px solid var(--line-strong);color:var(--text-2);transition:.16s;background:var(--surface)}
.chip:hover span{border-color:var(--text-3)}
.chip input:checked + span{background:var(--text);border-color:var(--text);color:var(--surface);font-weight:600}
.modal-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 26px 22px;border-top:1px solid var(--line)}
.hint{font-size:10.5px;color:var(--text-3)}
.foot-actions,.confirm-btns{display:flex;gap:9px;align-items:center}
.confirm{background:var(--surface);border:1px solid var(--line);border-radius:18px;padding:26px;max-width:380px;width:100%;box-shadow:0 24px 70px rgba(0,0,0,.2);animation:modalIn .22s both}
.confirm h3{font-size:17px;margin-bottom:8px}
.confirm p{font-size:13px;color:var(--text-2);margin-bottom:22px;line-height:1.7}
.confirm-btns{justify-content:flex-end}
.danger-btn{background:var(--accent);color:#fff;font-size:13px;font-weight:600;padding:10px 18px;border-radius:10px}
.danger-btn:hover{filter:brightness(1.08)}

/* toast */
.toasts{position:fixed;right:22px;top:76px;z-index:200;display:flex;flex-direction:column;gap:9px;pointer-events:none}
.toast{background:var(--surface);border:1px solid var(--line);border-left:3px solid var(--accent);border-radius:11px;padding:11px 16px;font-size:12.5px;box-shadow:var(--shadow-hover);animation:toastIn .25s both;max-width:320px}
.toast.ok{border-left-color:#3D9C70}
.toast.out{animation:toastOut .25s both}
@keyframes toastIn{from{opacity:0;transform:translateX(20px)}to{opacity:1;transform:translateX(0)}}
@keyframes toastOut{to{opacity:0;transform:translateX(20px)}}

@media(max-width:960px){
  .hero{grid-template-columns:1fr;gap:24px;padding:38px 0 28px}
  .quote-card{display:none}
  .hero h1{font-size:36px}
  .stats{grid-template-columns:repeat(2,1fr)}
  .search-wrap{width:170px}
}
@media(max-width:700px){
  .topbar-inner{padding:11px 16px;gap:9px;flex-wrap:wrap}
  .wrap{padding:0 16px}
  .brand-text span{display:none}
  .sync{order:5}
  .search-wrap{order:6;width:100%;flex:1 0 100%}
  .primary-btn{padding:0 12px}
  .hero h1{font-size:30px;letter-spacing:-.8px}
  .hero-sub{font-size:13px}
  .stats{gap:9px}
  .stat{padding:13px 14px;gap:10px}
  .stat-icon{width:32px;height:32px}
  .stat-num{font-size:19px}
  .cards{grid-template-columns:1fr;padding-bottom:32px}
  .cards.list-view .card{display:flex;min-height:0}
  .cards.list-view .card-actions{position:static}
  .cards.list-view .card-tags{display:flex}
  .toolbar-right{width:100%;justify-content:space-between;padding-bottom:10px}
  .modal-body,.modal-head,.modal-foot{padding-left:18px;padding-right:18px}
  .notice{flex-wrap:wrap}
  .toasts{right:12px;left:12px;top:70px}
  .toast{max-width:none}
}
