/* FIELD 摄影账本 · v4「Linear」— dark-first developer-tool UI.
 * Near-black canvas, raised surfaces a few % lighter, 1px hairlines with a top-edge highlight, one indigo accent,
 * Vercel-style white primary buttons. Geist / Geist Mono are self-hosted (fonts/), so nothing loads from a CDN.
 * Icon motion lives in the "Icon motion" block; all motion is off under prefers-reduced-motion. */

@font-face{font-family:"Geist";src:url("fonts/Geist-Variable.woff2") format("woff2");font-weight:100 900;font-style:normal;font-display:swap}
@font-face{font-family:"Geist Mono";src:url("fonts/GeistMono-Variable.woff2") format("woff2");font-weight:100 900;font-style:normal;font-display:swap}

/* ============ Tokens ============ */
:root{
  --font:"Geist","Inter",-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans CJK SC",sans-serif;
  --mono:"Geist Mono",ui-monospace,"SF Mono",Menlo,Consolas,"PingFang SC","Hiragino Sans GB","Microsoft YaHei",monospace;
  --ease:cubic-bezier(.2,.8,.2,1);--spring:cubic-bezier(.34,1.4,.64,1);--out:cubic-bezier(.16,1,.3,1);
  --r-xs:5px;--r-s:7px;--r:10px;--r-l:14px;
  --sb:240px;--insp:440px;--tb:52px;
}
:root,:root[data-theme="dark"]{
  --bg:#08090a;--sidebar:#0b0c0e;--surface:#0f1012;--surface-2:#141518;--surface-3:#1c1d21;--input:#0c0d0f;
  --hover:rgba(255,255,255,.035);--hover-2:rgba(255,255,255,.06);
  --line:rgba(255,255,255,.07);--line-2:rgba(255,255,255,.1);--line-3:rgba(255,255,255,.16);
  --edge:inset 0 1px 0 rgba(255,255,255,.05);
  --text:#ededef;--text-2:#b4b5bc;--text-3:#8b8f98;
  --accent:#7c7cff;--accent-text:#a3a3ff;--accent-bg:rgba(124,124,255,.13);--accent-line:rgba(124,124,255,.45);
  --primary-bg:#ededef;--primary-hover:#ffffff;--primary-fg:#08090a;
  --amber:#f0a73a;--green:#45c486;--grey:#8b8f98;--danger:#ff6b6f;--danger-bg:rgba(255,107,111,.1);
  --bar:rgba(255,255,255,.13);--bar-hover:rgba(255,255,255,.24);
  --heat-0:rgba(255,255,255,.045);
  --glow:rgba(124,124,255,.2);
  --shadow:0 1px 2px rgba(0,0,0,.4);
  --pop:0 0 0 1px rgba(255,255,255,.09),0 24px 64px -12px rgba(0,0,0,.75),0 8px 20px rgba(0,0,0,.4);
  --backdrop:rgba(0,0,0,.55);
  --glass:rgba(11,12,14,.72);
}
:root[data-theme="light"]{
  --bg:#fafafa;--sidebar:#fafafa;--surface:#ffffff;--surface-2:#f5f5f5;--surface-3:#ededed;--input:#ffffff;
  --hover:rgba(0,0,0,.025);--hover-2:rgba(0,0,0,.045);
  --line:#eaeaea;--line-2:#e2e2e2;--line-3:#d0d0d0;
  --edge:none;
  --text:#0a0a0a;--text-2:#3f3f46;--text-3:#666666;
  --accent:#5b5bd6;--accent-text:#4646c2;--accent-bg:rgba(91,91,214,.08);--accent-line:rgba(91,91,214,.45);
  --primary-bg:#0a0a0a;--primary-hover:#2a2a2a;--primary-fg:#ffffff;
  --amber:#e69419;--green:#1f9d55;--grey:#8f8f8f;--danger:#d62a3d;--danger-bg:rgba(214,42,61,.07);
  --bar:#e4e4e7;--bar-hover:#cfcfd4;
  --heat-0:#efefef;
  --glow:rgba(91,91,214,.12);
  --shadow:0 1px 2px rgba(0,0,0,.04);
  --pop:0 0 0 1px rgba(0,0,0,.08),0 24px 64px -12px rgba(0,0,0,.22),0 8px 20px rgba(0,0,0,.06);
  --backdrop:rgba(0,0,0,.18);
  --glass:rgba(250,250,250,.8);
}

/* ============ Base ============ */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;background:var(--bg)}
body{margin:0;background:var(--bg);color:var(--text);font:400 14px/1.5 var(--font);letter-spacing:-.006em;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-feature-settings:"cv11","ss01"}
button,input,select,textarea{font:inherit;color:inherit;letter-spacing:inherit}
button{background:none;border:0;padding:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
h1,h2,h3,p,dl,dd,ul{margin:0;padding:0}
ul{list-style:none}
.num{font-family:var(--mono);font-variant-numeric:tabular-nums;font-feature-settings:"tnum","zero" 0;letter-spacing:-.02em}
kbd{display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 4px;border-radius:4px;border:1px solid var(--line-2);background:var(--surface-2);font:500 10.5px/1 var(--mono);color:var(--text-3);box-shadow:inset 0 -1px 0 var(--line)}
.not-mac .kbd-mod{font-size:0}.not-mac .kbd-mod::after{content:"Ctrl";font-size:10.5px}
.is-missing{color:var(--text-3);font-style:normal}
.nb{white-space:nowrap}
.sep{font-style:normal;opacity:.7}
.skip-link{position:fixed;left:12px;top:-60px;z-index:100;background:var(--surface-2);color:var(--text);padding:10px 14px;border-radius:var(--r-s);border:1px solid var(--line-2)}
.skip-link:focus{top:12px}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:var(--r-s)}
::selection{background:var(--accent-bg)}
.phone-only{display:none!important}
[hidden]{display:none!important}
.ai{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;overflow:visible}
.eyebrow{font:500 11px/1.4 var(--mono);text-transform:uppercase;letter-spacing:.04em;color:var(--text-3)}
.list-caption{font:500 11px/1.4 var(--mono);text-transform:uppercase;letter-spacing:.04em;color:var(--text-3);margin:0 0 8px}
.card{position:relative;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-l);box-shadow:var(--edge),var(--shadow)}

/* ============ Layout ============ */
.app{display:grid;grid-template-columns:var(--sb) minmax(0,1fr);height:100vh;height:100dvh}
#screen{position:relative;height:100vh;height:100dvh;overflow:auto;outline:none;transition:margin-right .32s var(--out);scrollbar-gutter:stable}
.sidebar{display:flex;flex-direction:column;gap:2px;height:100vh;height:100dvh;padding:10px 10px 12px;background:var(--sidebar);border-right:1px solid var(--line);overflow:auto}
.mhead,.tabbar{display:none}

/* sidebar */
.ws{display:flex;align-items:center;gap:10px;width:100%;padding:6px 8px;margin-bottom:6px;border-radius:var(--r-s);text-align:left;transition:background .15s}
.ws:hover{background:var(--hover-2)}
.ws-logo{display:grid;place-items:center;width:26px;height:26px;border-radius:7px;background:linear-gradient(140deg,#8b8bff,#5b4fe0 60%,#3b2fb8);box-shadow:inset 0 1px 0 rgba(255,255,255,.35),0 0 0 1px rgba(0,0,0,.2);flex:none}
.ws-logo svg{width:16px;height:16px;fill:none;stroke:#fff;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.ws-logo.sm{width:18px;height:18px;border-radius:5px}.ws-logo.sm svg{width:11px;height:11px}
.ws-text{display:flex;flex-direction:column;min-width:0;line-height:1.2}
.ws-name{font-weight:600;font-size:13.5px;letter-spacing:-.01em}
.ws-sub{font-size:11.5px;color:var(--text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ws-chev{margin-left:auto;width:14px;height:14px;color:var(--text-3)}
.sb-search{display:flex;align-items:center;gap:8px;height:32px;padding:0 8px;margin-bottom:12px;border-radius:var(--r-s);border:1px solid var(--line);background:var(--surface);color:var(--text-3);font-size:13px;box-shadow:var(--edge);transition:border-color .15s,background .15s}
.sb-search:hover{border-color:var(--line-3);color:var(--text-2)}
.sb-search .sb-kbd{margin-left:auto;display:flex;gap:3px}
.sb-caption{font:500 11px/1 var(--mono);text-transform:uppercase;letter-spacing:.05em;color:var(--text-3);padding:14px 8px 8px}
.nav,.year-row{display:flex;align-items:center;gap:10px;width:100%;height:30px;padding:0 8px;border-radius:var(--r-s);color:var(--text-2);font-size:13.5px;font-weight:450;text-align:left;transition:background .12s,color .12s}
.nav:hover,.year-row:hover{background:var(--hover-2);color:var(--text)}
.nav[aria-current="page"],.year-row[aria-pressed="true"]{background:var(--hover-2);color:var(--text);font-weight:500}
.nav .ai{color:var(--text-3)}
.nav[aria-current="page"] .ai{color:var(--text)}
.nav-kbd{margin-left:auto;opacity:0;transition:opacity .15s;font-size:9.5px;letter-spacing:.06em;min-width:0;height:16px;border:0;background:none;box-shadow:none}
.nav:hover .nav-kbd{opacity:1}
.badge{margin-left:auto;min-width:20px;height:18px;padding:0 6px;border-radius:9px;background:var(--surface-3);color:var(--text-2);font-size:11px;display:grid;place-items:center}
.year-row .yr-dot{width:7px;height:7px;border-radius:2px;border:1px solid var(--line-3)}
.year-row[aria-pressed="true"] .yr-dot{background:var(--accent);border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-bg)}
.year-row small{margin-left:auto;font-size:11.5px;color:var(--text-3)}
.sb-foot{margin-top:auto;padding-top:14px;display:flex;flex-direction:column;gap:12px}
.keys{display:flex;flex-direction:column;gap:6px;padding:12px 8px 12px;border-top:1px solid var(--line)}
.keys li{display:flex;align-items:center;justify-content:space-between;font-size:12px;color:var(--text-3)}
.keys li>span:first-child{flex:1}
.keys kbd+kbd{margin-left:3px}
.sb-row{display:flex;align-items:center;gap:8px;padding:0 4px}
.sb-row .seg{flex:1}
.icon-button{display:grid;place-items:center;width:30px;height:30px;border-radius:var(--r-s);color:var(--text-3);border:1px solid var(--line);transition:color .15s,background .15s}
.icon-button:hover{color:var(--text);background:var(--hover-2)}

/* page + toolbar */
.page{min-height:100%}
.page.enter .page-body>*{animation:rise .4s var(--out) both}
.page.enter .page-body>*:nth-child(2){animation-delay:.04s}
.page.enter .page-body>*:nth-child(3){animation-delay:.08s}
.page.enter .page-body>*:nth-child(4){animation-delay:.12s}
.page.enter .page-body>*:nth-child(n+5){animation-delay:.16s}
@keyframes rise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.toolbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:16px;height:var(--tb);padding:0 28px;background:var(--bg);border-bottom:1px solid transparent;transition:border-color .2s,background .2s}
.scrolled .toolbar{border-bottom-color:var(--line);background:var(--glass);-webkit-backdrop-filter:blur(16px) saturate(1.4);backdrop-filter:blur(16px) saturate(1.4)}
.tb-text{display:flex;align-items:baseline;gap:8px;min-width:0;flex:1;white-space:nowrap}
.crumb{display:flex;gap:8px;font-size:13px;color:var(--text-3)}
.crumb i{font-style:normal;opacity:.6}
.large-title{font-size:14px;font-weight:500;letter-spacing:-.01em}
.tb-sub{font-size:12px;color:var(--text-3);overflow:hidden;text-overflow:ellipsis;padding-left:6px}
.tb-actions{display:flex;align-items:center;gap:8px}
.page-body{display:flex;flex-direction:column;gap:16px;padding:16px 28px 64px;max-width:1280px;container-type:inline-size}

/* buttons */
.button{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:34px;padding:0 14px;border-radius:var(--r-s);font-size:13.5px;font-weight:500;white-space:nowrap;transition:background .15s,border-color .15s,color .15s,box-shadow .15s,transform .1s}
.button:active{transform:scale(.98)}
.button:disabled{opacity:.55;cursor:default}
.button.small{height:30px;padding:0 10px;font-size:13px}
.button.large{height:40px;padding:0 18px;font-size:14px}
.button.primary{background:var(--primary-bg);color:var(--primary-fg);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 0 0 1px var(--primary-bg)}
.button.primary:hover{background:var(--primary-hover)}
.button.primary kbd{background:rgba(0,0,0,.1);border-color:rgba(0,0,0,.14);color:var(--primary-fg);box-shadow:none;opacity:.7;height:17px}
:root[data-theme="light"] .button.primary kbd{background:rgba(255,255,255,.15);border-color:rgba(255,255,255,.2)}
.button.secondary,.button.tinted,.button.ghost,.conflict-button{background:var(--surface-2);color:var(--text);border:1px solid var(--line-2);box-shadow:var(--edge)}
.button.secondary:hover,.button.tinted:hover,.button.ghost:hover,.conflict-button:hover{border-color:var(--line-3);background:var(--surface-3)}
.button.ghost{background:transparent;box-shadow:none}
.button.ghost:hover{background:var(--hover-2)}
.button.ghost kbd{margin-left:2px}
.button.ghost kbd+kbd{margin-left:-3px}
.button.danger,.tb-icon.danger:hover{color:var(--danger)}
.button.ghost.danger:hover{background:var(--danger-bg);border-color:transparent}
.button.danger-fill{background:var(--danger);color:#fff;box-shadow:none}
.button.danger-fill:hover{background:color-mix(in srgb,var(--danger) 88%,#000)}
.conflict-button{display:flex;width:100%;height:auto;min-height:36px;padding:8px 12px;border-radius:var(--r-s);font-size:13px;margin-top:8px;white-space:normal;text-align:left}
.tb-icon{display:grid;place-items:center;width:30px;height:30px;border-radius:var(--r-s);color:var(--text-3);transition:background .15s,color .15s}
.tb-icon:hover{background:var(--hover-2);color:var(--text)}
.text-button,.link-button{display:inline-flex;align-items:center;gap:6px;color:var(--text-2);font-size:13px;border-radius:var(--r-s);transition:color .15s}
.text-button:hover,.link-button:hover{color:var(--text)}
.link-button{color:var(--accent-text)}
.link-button:hover{color:var(--accent-text);text-decoration:underline;text-underline-offset:3px}
body[data-panel="add"] .tb-add .rot{transform:rotate(45deg)}

/* segmented control */
.seg{position:relative;display:grid;grid-template-columns:repeat(var(--n),minmax(0,1fr));padding:2px;border-radius:8px;background:var(--surface);border:1px solid var(--line);isolation:isolate}
.seg-thumb{position:absolute;z-index:-1;top:2px;bottom:2px;left:2px;width:calc((100% - 4px)/var(--n));border-radius:6px;background:var(--surface-3);box-shadow:inset 0 1px 0 rgba(255,255,255,.06),0 0 0 1px var(--line-2);transform:translateX(calc(var(--at)*100%));transition:transform .28s var(--out)}
:root[data-theme="light"] .seg{background:var(--surface-2)}
:root[data-theme="light"] .seg-thumb{background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.08),0 0 0 1px var(--line-2)}
.seg button{min-height:26px;padding:0 12px;font-size:12.5px;color:var(--text-3);border-radius:6px;white-space:nowrap;transition:color .15s}
.seg button[aria-pressed="true"]{color:var(--text);font-weight:500}
.seg button:not([aria-pressed="true"]):hover{color:var(--text-2)}
.seg-icons button{display:grid;place-items:center;padding:0}
.seg-icons .ai{width:15px;height:15px}

/* ============ Heatmap card ============ */
.cal{display:grid;grid-template-columns:200px minmax(0,1fr);gap:24px;padding:18px 20px 16px}
.cal-side{display:flex;flex-direction:column;gap:2px;min-width:0}
.cal-big{display:flex;align-items:baseline;gap:6px;margin-top:6px}
.cal-big b{font-size:34px;font-weight:500;letter-spacing:-.05em;line-height:1}
.cal-big span{color:var(--text-3);font-size:13px}
.cal-sub{font-size:12px;color:var(--text-3)}
.cal-legend{display:flex;flex-direction:column;gap:5px;margin-top:auto;padding-top:14px}
.cal-legend li{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--text-2)}
.cal-legend b{margin-left:auto;font:500 12px var(--mono);color:var(--text)}
.film{min-width:0;overflow-x:auto;scrollbar-width:none}
.film::-webkit-scrollbar{display:none}
.film-inner{max-width:calc(var(--weeks)*17px + 24px)}
.heat-labels{display:grid;grid-template-columns:repeat(var(--weeks),minmax(0,1fr));gap:3px;margin-left:24px;height:20px}
.sm-label{display:flex;align-items:flex-start;gap:4px;font-size:10.5px;color:var(--text-3);text-align:left;white-space:nowrap;border-radius:4px;transition:color .15s}
.sm-label:hover{color:var(--text)}
.sm-n{display:none}
.heat-wrap{display:flex;gap:6px}
.heat-days{display:grid;grid-template-rows:repeat(7,minmax(0,1fr));gap:3px;width:18px;flex:none;font:400 10px/1 var(--mono);color:var(--text-3);text-align:right}
.heat-days span{display:flex;align-items:center;justify-content:flex-end}
.heat{flex:1;display:grid;grid-template-rows:repeat(7,auto);grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:3px}
.c{display:block;aspect-ratio:1;width:100%;border-radius:3px;background:var(--heat-0);border:0;padding:0;position:relative}
.c.pad{background:none}
.c.today{box-shadow:inset 0 0 0 1px var(--text-3)}
.c.on{cursor:pointer;transition:transform .15s var(--spring),box-shadow .15s,opacity .15s}
.c.on.tone-due{background:color-mix(in srgb,var(--amber) 72%,transparent)}
.c.on.tone-due.multi{background:var(--amber)}
.c.on.tone-paid{background:color-mix(in srgb,var(--green) 70%,transparent)}
.c.on.tone-paid.multi{background:var(--green)}
.c.on.tone-review{background:transparent;box-shadow:inset 0 0 0 1.5px var(--grey)}
.c.on:hover,.c.on.hl{transform:scale(1.25);z-index:1}
.c.on.sel.hl{transform:none}
.hover-cal .c.on:not(.hl),.hovering .c.on:not(.hl){opacity:.35}
.c.sel{box-shadow:0 0 0 1.5px var(--bg),0 0 0 3px var(--accent)}
.c.on.tone-review.sel{box-shadow:inset 0 0 0 1.5px var(--grey),0 0 0 1.5px var(--bg),0 0 0 3px var(--accent)}
.c.pulse{animation:pulse .5s var(--spring)}
@keyframes pulse{0%{transform:scale(.6)}60%{transform:scale(1.35)}100%{transform:scale(1)}}
.legend-note{grid-column:1/-1;font-size:12px;color:var(--text-3);margin-top:-6px}
@container (max-width:760px){
  .cal{grid-template-columns:1fr;gap:14px}
  .cal-side{flex-direction:row;flex-wrap:wrap;align-items:baseline;column-gap:12px}
  .cal-side .eyebrow{flex-basis:100%}
  .cal-big{margin:4px 0 0}
  .cal-legend{flex-direction:row;margin:0 0 0 auto;padding:0;gap:16px}
  .cal-legend b{margin-left:4px}
}

/* status dots + chips */
.dot{display:inline-block;width:7px;height:7px;border-radius:50%;flex:none}
.dot-due{background:var(--amber);box-shadow:0 0 0 3px color-mix(in srgb,var(--amber) 16%,transparent)}
.dot-paid{background:var(--green);box-shadow:0 0 0 3px color-mix(in srgb,var(--green) 16%,transparent)}
.dot-review{border:1.5px solid var(--grey);background:transparent}
.status{display:inline-flex;align-items:center;gap:7px;height:22px;padding:0 9px 0 8px;border-radius:11px;border:1px solid var(--line-2);font-size:12px;color:var(--text-2);white-space:nowrap;max-width:100%}
.status>span:last-child{overflow:hidden;text-overflow:ellipsis}

/* ============ Filter bar + table ============ */
.filterbar{display:flex;align-items:center;gap:10px;margin-top:4px}
.filterbar .seg{flex:0 0 auto}
.find{position:relative;display:flex;align-items:center;margin-left:auto;width:260px;color:var(--text-3)}
.find>.ai{position:absolute;left:10px;width:14px;height:14px;pointer-events:none}
.search{width:100%;height:32px;padding:0 30px 0 32px;border-radius:var(--r-s);border:1px solid var(--line-2);background:var(--input);color:var(--text);font-size:13px;outline:none;transition:border-color .15s,box-shadow .15s}
.search::placeholder{color:var(--text-3)}
.search:focus{border-color:var(--accent-line);box-shadow:0 0 0 3px var(--accent-bg)}
.search::-webkit-search-cancel-button{-webkit-appearance:none}
.find-kbd{position:absolute;right:8px}
.search:focus+.find-kbd,.search:not(:placeholder-shown)+.find-kbd{opacity:0}
.feed{border:1px solid var(--line);border-radius:var(--r-l);background:var(--surface);box-shadow:var(--edge),var(--shadow);overflow:clip}
.thead,.frame{display:grid;grid-template-columns:124px minmax(0,1fr) 132px 156px;align-items:center;column-gap:16px;padding:0 16px}
.thead{height:34px;font:500 11px/1 var(--mono);text-transform:uppercase;letter-spacing:.04em;color:var(--text-3);border-bottom:1px solid var(--line);background:var(--surface)}
.th-amt{text-align:right}
.group+.group{border-top:1px solid var(--line)}
.g-head{position:sticky;top:var(--tb);z-index:5;display:flex;align-items:center;gap:8px;height:30px;padding:0 16px;background:var(--surface-2);border-bottom:1px solid var(--line);font-size:12px;color:var(--text-2)}
.g-title{font-weight:500;color:var(--text)}
.g-count{display:grid;place-items:center;min-width:18px;height:16px;padding:0 5px;border-radius:8px;background:var(--hover-2);font-size:10.5px;color:var(--text-3)}
.frame{position:relative;width:100%;min-height:54px;padding-top:8px;padding-bottom:8px;text-align:left;border-bottom:1px solid var(--line);transition:background .12s}
.list>.frame:last-child{border-bottom:0}
.frame::before{content:"";position:absolute;left:0;top:8px;bottom:8px;width:2px;border-radius:0 2px 2px 0;background:var(--accent);transform:scaleY(0);transition:transform .2s var(--out)}
.frame:hover,.frame.hl{background:var(--hover)}
.frame.is-selected{background:var(--accent-bg)}
.frame.is-selected::before{transform:none}
.frame:focus-visible{outline:none;box-shadow:inset 0 0 0 1.5px var(--accent);border-radius:0}
.r-date{display:flex;flex-direction:column;gap:2px;min-width:0}
.r-big{display:flex;align-items:baseline;gap:7px;font-size:13.5px;color:var(--text);white-space:nowrap}
.r-wk{font:400 12px var(--font);color:var(--text-3);letter-spacing:0;white-space:nowrap}
.r-sub{font-size:11px;color:var(--text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.r-date.raw .r-big{white-space:normal}
.r-raw{font-size:12px;color:var(--text-2);line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all}
.r-main{display:flex;flex-direction:column;gap:2px;min-width:0}
.r-name{font-size:13.5px;font-weight:500;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.r-meta{font-size:12px;color:var(--text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.r-meta i{font-style:normal;opacity:.6}
.r-amount{text-align:right;font-size:13.5px;color:var(--text);white-space:nowrap}
.r-amount .cur{color:var(--text-3);margin-right:3px}
.r-amount .dec{color:var(--text-3)}
.r-st{min-width:0;display:flex}
.empty{display:flex;flex-direction:column;align-items:center;gap:6px;padding:48px 16px;text-align:center}
.empty-icon{width:28px;height:28px;color:var(--text-3);margin-bottom:6px;stroke-width:1.3}
.empty-title{font-weight:500}
.empty-sub{font-size:13px;color:var(--text-3)}
.page-foot{display:flex;flex-direction:column;gap:10px;font-size:12px;color:var(--text-3);padding:4px 2px}
.page-foot-note{font-size:12px;color:var(--text-3);margin-top:14px}

/* ============ Overview ============ */
.hero{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(280px,1fr);gap:24px 40px;align-items:end;padding:28px 28px 26px;overflow:hidden}
.hero::before{content:"";position:absolute;inset:0;pointer-events:none;background:radial-gradient(520px 240px at 12% -10%,var(--glow),transparent 70%),radial-gradient(380px 200px at 90% 120%,color-mix(in srgb,var(--green) 8%,transparent),transparent 70%)}
.hero::after{content:"";position:absolute;inset:0;pointer-events:none;background-image:linear-gradient(var(--line) 1px,transparent 1px),linear-gradient(90deg,var(--line) 1px,transparent 1px);background-size:28px 28px;-webkit-mask-image:radial-gradient(ellipse 60% 90% at 15% 0%,#000,transparent 75%);mask-image:radial-gradient(ellipse 60% 90% at 15% 0%,#000,transparent 75%);opacity:.6}
.hero>*{position:relative;z-index:1}
.hero-num-wrap{position:relative;margin:10px 0 8px}
.hero-number,.hero-ghost{font-size:clamp(40px,5.4vw,60px);font-weight:500;line-height:1;letter-spacing:-.055em;white-space:nowrap}
.hero-number .cur,.hero-ghost .cur{font-size:.5em;color:var(--text-3);margin-right:6px;vertical-align:.55em;letter-spacing:0}
.hero-number .dec,.hero-ghost .dec{color:var(--text-3)}
.hero-number.counting{color:transparent}.hero-number.counting *{color:transparent}
.hero-ghost{position:absolute;inset:0 auto auto 0}
.hero-sub{font-size:12px;color:var(--text-3)}
.split{display:flex;flex-direction:column;gap:12px}
.split-bar{display:flex;gap:3px;height:6px;border-radius:3px;overflow:hidden}
.split-bar span{width:var(--w);border-radius:3px;transform-origin:left;animation:growX .7s var(--out) both}
.split-due{background:var(--amber)}
.split-paid{background:var(--green);animation-delay:.08s!important}
.empty-bar{background:var(--heat-0)}
.split-legend{display:flex;flex-direction:column;gap:8px}
.sl{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--text-2)}
.sl b{margin-left:auto;font-weight:500;color:var(--text);font-size:13.5px}
.sl em{font-style:normal;font-size:12px;color:var(--text-3);width:38px;text-align:right}
@keyframes growX{from{transform:scaleX(0)}}
@container (max-width:640px){.hero{grid-template-columns:1fr;gap:20px}}

.months{padding:18px 20px 8px}
.card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:14px}
.card-stat{font-size:15px;font-weight:500;margin-top:4px}
.card-stat span{color:var(--text-3);font-weight:400}
.card-stat .cur{color:var(--text-3);margin-right:2px}
.month-readout{display:flex;flex-direction:column;align-items:flex-end;gap:2px;text-align:right}
.month-readout>span{font-size:11.5px;color:var(--text-3)}
.month-readout strong{font-size:22px;font-weight:500;letter-spacing:-.04em}
.month-readout .cur,.month-readout .dec{color:var(--text-3)}
.month-readout .cur{font-size:.65em;margin-right:3px}
.chart{position:relative;height:220px;padding-left:56px}
.chart-grid{position:absolute;inset:0 0 26px 0;display:flex;flex-direction:column;justify-content:space-between;pointer-events:none}
.chart-grid span{position:relative;border-top:1px dashed var(--line-2);height:0}
.chart-grid span:last-child{border-top-style:solid}
.chart-grid em{position:absolute;left:0;top:-7px;font-style:normal;font-size:10.5px;color:var(--text-3)}
.chart-bars{position:relative;display:grid;grid-template-columns:repeat(12,minmax(0,1fr));height:100%}
.bar{display:flex;flex-direction:column;align-items:center;height:100%;border-radius:var(--r-s)}
.bar-track{position:relative;flex:1;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:6px}
.bar-fill{display:block;width:min(60%,30px);height:max(var(--h),2px);border-radius:4px 4px 1px 1px;background:var(--bar);transform-origin:bottom;transition:background .15s,box-shadow .15s;animation:grow .6s var(--out) both;animation-delay:calc(var(--i)*30ms)}
@keyframes grow{from{transform:scaleY(0)}}
.bar:hover .bar-fill{background:var(--bar-hover)}
.bar.selected .bar-fill{background:linear-gradient(180deg,var(--accent-text),var(--accent));box-shadow:0 0 24px -4px var(--accent-line)}
.bar.zero .bar-fill{opacity:.6}
.bar-miss{order:-1;width:6px;height:6px;border-radius:50%;background:var(--amber);flex:none}
.bar-label{height:26px;display:grid;place-items:center;font-size:11px;color:var(--text-3)}
.bar.selected .bar-label{color:var(--text)}
.bar:focus-visible{outline-offset:-2px}
.contrib{border-top:1px solid var(--line);margin:12px -20px 0;padding:14px 20px 12px}
.contrib-row{display:grid;grid-template-columns:minmax(0,1fr) auto 120px 16px;align-items:center;gap:14px;width:100%;min-height:38px;padding:0 8px;margin:0 -8px;width:calc(100% + 16px);border-radius:var(--r-s);text-align:left;font-size:13.5px;transition:background .12s}
.contrib-row:hover{background:var(--hover-2)}
.c-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.c-days{font-size:12px;color:var(--text-3)}
.c-amt{text-align:right}
.r-chev{width:14px;height:14px;color:var(--text-3)}
.contrib-empty{font-size:13px;color:var(--text-3);padding:4px 0 6px}
.settle{display:flex;flex-direction:column;gap:12px;margin-top:8px}
.settle-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px}
.notes{padding:18px 20px}
.note-list{display:flex;flex-direction:column;gap:10px;margin-top:12px}
.note-row{display:flex;gap:10px;align-items:flex-start;font-size:13px;color:var(--text-2);line-height:1.55}
.note-row .dot{margin:7px 3px 0}
.note-icon{width:15px;height:15px;color:var(--text-3);margin-top:2px}
.note-row b{font-weight:500;color:var(--text);margin-right:8px}

/* ============ Inspector (slides in from the right) ============ */
#inspector{position:fixed;top:0;right:0;bottom:0;z-index:30;width:var(--insp);background:var(--sidebar);border-left:1px solid var(--line);box-shadow:-24px 0 48px -24px rgba(0,0,0,.5);overflow:auto;transform:translateX(102%);transition:transform .34s var(--out),visibility 0s .34s;visibility:hidden;overscroll-behavior:contain}
body:is([data-panel="detail"],[data-panel="form"],[data-panel="add"],[data-panel="trash"],[data-panel="confirm"]) #inspector{transform:none;visibility:visible;transition:transform .34s var(--out),visibility 0s}
@media (min-width:1180px){body:is([data-panel="detail"],[data-panel="form"],[data-panel="add"],[data-panel="trash"],[data-panel="confirm"]) #screen{margin-right:var(--insp)}}
.inspector-body{min-height:100%;padding:0 24px 40px}
.inspector-body.enter>*{animation:fadeIn .28s var(--out) both}
@keyframes fadeIn{from{opacity:0;transform:translateX(8px)}to{opacity:1;transform:none}}

/* detail */
.detail{display:flex;flex-direction:column;gap:20px}
.d-bar{position:sticky;top:0;z-index:4;display:flex;align-items:center;justify-content:space-between;height:52px;margin:0 -24px;padding:0 16px 0 24px;background:var(--glass);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);border-bottom:1px solid var(--line)}
.d-bar-title{display:flex;gap:8px;font-size:12.5px;color:var(--text-3)}
.d-bar-title i{font-style:normal;opacity:.6}
.d-bar-title span:last-child{color:var(--text-2)}
.d-bar-actions{display:flex;gap:2px}
.d-hero{display:flex;flex-direction:column;gap:8px;padding-top:4px}
.d-date{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;color:var(--text-2)}
.d-date>span{font-size:13px;color:var(--text)}
.d-date small{font-size:12px;color:var(--text-3)}
.d-date.raw>span{font-family:var(--mono);font-size:13px}
.d-hero h2{font-size:22px;font-weight:600;letter-spacing:-.025em;line-height:1.25}
.d-status{display:flex;align-items:center;gap:8px}
.st-icon{width:18px;height:18px;color:var(--green)}
.d-money{display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--line);border-radius:var(--r);background:var(--surface);box-shadow:var(--edge)}
.dm-cell{padding:12px 14px;display:flex;flex-direction:column;gap:6px;min-width:0}
.dm-cell+.dm-cell{border-left:1px solid var(--line)}
.dm-cell p{font-size:20px;font-weight:500;letter-spacing:-.04em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dm-cell .cur{font-size:.68em;color:var(--text-3);margin-right:3px}
.dm-cell .dec{color:var(--text-3)}
.dm-cell .is-missing{font-family:var(--font);font-size:15px;letter-spacing:0}
.callout{display:flex;gap:10px;padding:12px 14px;border-radius:var(--r);border:1px solid var(--line-2);background:var(--surface-2);font-size:13px;color:var(--text-2);line-height:1.55}
.callout .ai{margin-top:2px;color:var(--text-3)}
.callout b{display:block;color:var(--text);font-weight:500}
.alloc{display:flex;flex-direction:column;gap:8px}
.alloc-row{display:grid;grid-template-columns:62px minmax(0,1fr) 44px 92px;align-items:center;gap:10px;font-size:12.5px}
.a-m{color:var(--text-2)}
.alloc-bar{height:6px;border-radius:3px;background:var(--heat-0);overflow:hidden}
.alloc-bar i{display:block;height:100%;width:var(--w);border-radius:3px;background:var(--accent);transform-origin:left;animation:growX .6s var(--out) both}
.a-days{color:var(--text-3);text-align:right}
.alloc-row b{font-weight:500;text-align:right}
.props{display:flex;flex-direction:column}
.kv{display:grid;grid-template-columns:96px minmax(0,1fr);gap:12px;padding:7px 0;font-size:13px;border-bottom:1px solid var(--line)}
.kv:last-child{border-bottom:0}
.kv.stack{grid-template-columns:1fr;gap:3px}
.kv dt{color:var(--text-3)}
.kv dd{color:var(--text);word-break:break-word}
.kv dd.num{font-size:12.5px}
.d-notes{font-size:13.5px;color:var(--text-2);line-height:1.6;white-space:pre-wrap}
.tags{display:flex;flex-wrap:wrap;gap:6px}
.tag{height:22px;padding:0 8px;border-radius:5px;border:1px solid var(--line-2);background:var(--surface-2);font-size:12px;color:var(--text-2);display:inline-flex;align-items:center}
.list-foot{font-size:12px;color:var(--text-3);margin-top:8px}
.d-status-form{display:flex;flex-direction:column;gap:10px}
.d-status-form .settlement-field{display:block}
.d-status-form .settlement-field .form-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.sf-actions{display:flex}
.sf-actions .button{flex:1}
.d-actions{display:grid;grid-template-columns:1fr auto;gap:8px}
.d-actions+.list-foot{margin-top:-12px}
.readonly-note{font-size:12px;color:var(--text-3);border-top:1px solid var(--line);padding-top:14px}

/* ============ Forms ============ */
.form-top{position:sticky;top:0;z-index:4;display:flex;align-items:center;gap:12px;min-height:52px;margin:0 -24px 4px;padding:8px 16px 8px 24px;background:var(--glass);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);border-bottom:1px solid var(--line)}
.form-top .text-button{height:30px;padding:0 8px 0 4px;margin-left:-8px;border-radius:var(--r-s)}
.form-top .text-button:hover{background:var(--hover-2)}
.ft-text{display:flex;align-items:baseline;gap:10px;min-width:0;flex:1}
.ft-text h2{font-size:15px;font-weight:600;letter-spacing:-.015em;white-space:nowrap}
.ft-sub{font-size:12px;color:var(--text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.form-top .tb-icon{margin-left:auto}
#record-form{display:flex;flex-direction:column;gap:22px;padding-top:12px}
#record-form.is-saving{opacity:.7}
.step{border:0;margin:0;padding:0;min-width:0}
.step legend{display:flex;align-items:center;gap:8px;padding:0;margin-bottom:12px}
.step-n{display:grid;place-items:center;height:18px;padding:0 5px;border-radius:4px;background:var(--accent-bg);color:var(--accent-text);font-size:10.5px;letter-spacing:0}
.form-list{display:grid;grid-template-columns:1fr 1fr;gap:14px 12px}
.name-row,.project-dates,#segments-editor,.notes-field,.settlement-field,.row-hint{grid-column:1/-1}
#segments-editor:empty{display:none}
.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.form-label{display:flex;align-items:center;gap:8px;font-size:12.5px;font-weight:500;color:var(--text-2)}
.form-label span{font-weight:400;color:var(--text-3);font-size:12px}
.input{width:100%;height:36px;padding:0 11px;border-radius:var(--r-s);border:1px solid var(--line-2);background:var(--input);color:var(--text);font-size:13.5px;outline:none;box-shadow:inset 0 1px 1px rgba(0,0,0,.12);transition:border-color .15s,box-shadow .15s}
:root[data-theme="light"] .input{box-shadow:0 1px 1px rgba(0,0,0,.03)}
.input:hover{border-color:var(--line-3)}
.input:focus{border-color:var(--accent-line);box-shadow:0 0 0 3px var(--accent-bg),0 0 18px -6px var(--accent-line)}
.input::placeholder{color:var(--text-3)}
.input[aria-invalid="true"]{border-color:color-mix(in srgb,var(--danger) 70%,transparent);box-shadow:0 0 0 3px var(--danger-bg)}
.input-title{height:42px;font-size:16px;font-weight:500;letter-spacing:-.01em}
textarea.input{height:auto;min-height:92px;padding:9px 11px;line-height:1.55;resize:vertical}
.amount-wrap{position:relative;display:flex;align-items:center}
.amount-wrap>span{position:absolute;left:11px;font:400 13px var(--mono);color:var(--text-3);pointer-events:none}
.amount-wrap .input{padding-left:26px;font-family:var(--mono);letter-spacing:-.02em}
input[type=number]{-moz-appearance:textfield}
input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.mode-pill{height:18px;padding:0 6px;border-radius:4px;border:1px solid var(--line-2);font:500 10.5px/16px var(--font)!important;color:var(--text-3)!important}
.total-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:8px}
.field-hint{font-size:12px;color:var(--text-3);line-height:1.5}
.select-wrap{position:relative;display:flex;align-items:center}
.select-wrap select{appearance:none;-webkit-appearance:none;padding-right:32px;cursor:pointer}
.select-wrap .ai{position:absolute;right:10px;width:14px;height:14px;color:var(--text-3);pointer-events:none}
.legacy-date{font-size:14px;padding:8px 11px;border-radius:var(--r-s);border:1px dashed var(--line-3);color:var(--text-2)}
.date-pair{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:8px}
.date-arrow{color:var(--text-3);font-family:var(--mono)}
.date-cell{position:relative;display:flex;flex-direction:column;gap:2px;padding:10px 12px;border-radius:var(--r);border:1px solid var(--line-2);background:var(--input);cursor:pointer;transition:border-color .15s,box-shadow .15s}
.date-cell:hover{border-color:var(--line-3)}
.date-cell:focus-within{border-color:var(--accent-line);box-shadow:0 0 0 3px var(--accent-bg)}
.date-cell:has([aria-invalid="true"]){border-color:var(--danger)}
.dc-label{font:500 10.5px/1.3 var(--mono);text-transform:uppercase;letter-spacing:.04em;color:var(--text-3)}
.date-cell strong{font-size:20px;font-weight:500;letter-spacing:-.04em;line-height:1.2}
.date-cell small{font-size:11.5px;color:var(--text-3)}
.native-date{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer;border:0;font-size:16px}
.native-date::-webkit-calendar-picker-indicator{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
.project-dates>.form-label{margin-bottom:0}
.project-dates .field-hint{margin-top:2px}
.seg-add-link{margin-top:2px;align-self:flex-start}
.segments-summary{display:flex;align-items:center;gap:10px;width:100%;height:44px;padding:0 12px;border-radius:var(--r);border:1px solid var(--line-2);background:var(--input);text-align:left;transition:border-color .15s}
.segments-summary:hover{border-color:var(--line-3)}
.segments-summary strong{font-weight:500;font-size:14px}
.segments-summary .chev{margin-left:auto;color:var(--text-3);transition:transform .2s var(--out)}
.segments-summary[aria-expanded="true"] .chev{transform:rotate(180deg)}
.segments{display:flex;flex-direction:column;gap:8px;padding:12px;border-radius:var(--r);border:1px solid var(--line);background:var(--surface)}
.segments-head{display:flex;justify-content:space-between;gap:8px;font-size:12px;color:var(--text-3)}
.segments-head strong{color:var(--text);font-weight:500}
.segment{display:grid;grid-template-columns:52px minmax(0,1fr) 30px;align-items:center;gap:8px}
.seg-no{font:500 11px var(--mono);color:var(--text-3)}
.seg-inputs{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.seg-inputs label{display:flex;flex-direction:column;gap:3px;min-width:0;font-size:11px;color:var(--text-3)}
.seg-inputs .input{height:32px;padding:0 8px;font-size:12.5px}
.segments-actions{display:flex;justify-content:space-between}
.form-error{font-size:13px;color:var(--danger);min-height:0}
.form-error:empty{display:none}
.form-actions{position:sticky;bottom:0;padding:12px 0 4px;margin-top:-8px;background:linear-gradient(transparent,var(--sidebar) 30%)}
.form-actions .button{width:100%}

/* trash + confirm */
.trash-list{display:flex;flex-direction:column;border:1px solid var(--line);border-radius:var(--r);background:var(--surface);margin-top:14px}
.trash-row{display:flex;align-items:center;gap:12px;padding:12px 14px;border-bottom:1px solid var(--line)}
.trash-row:last-child{border-bottom:0}
.trash-text{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
.trash-text strong{font-weight:500;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.t-date,.t-meta{font-size:11.5px;color:var(--text-3)}
.t-when{white-space:nowrap}
.trash-list+.list-foot{margin-top:12px}
.confirm{display:flex;flex-direction:column;align-items:flex-start;gap:10px;padding:32px 0 8px}
.confirm-mark{display:grid;place-items:center;width:40px;height:40px;border-radius:10px;border:1px solid var(--line-2);background:var(--surface-2);color:var(--text-2);margin-bottom:6px;box-shadow:var(--edge)}
.confirm-mark.danger{color:var(--danger);background:var(--danger-bg);border-color:color-mix(in srgb,var(--danger) 30%,transparent)}
.confirm-mark .ai{width:20px;height:20px}
.confirm h2{font-size:18px;font-weight:600;letter-spacing:-.02em}
.confirm-name{font-weight:500;padding:6px 10px;border-radius:var(--r-s);background:var(--surface-2);border:1px solid var(--line)}
.lede{font-size:13.5px;color:var(--text-2);line-height:1.6}
.confirm-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;width:100%;margin-top:10px}

/* ============ Dialogs: sheet (≤1179), palette, toast, tooltip, menus ============ */
dialog{color:var(--text)}
#sheet{padding:0;border:0;background:var(--sidebar);color:var(--text)}
#sheet::backdrop{background:var(--backdrop);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
.sheet-bar{display:none}
#sheet-content{padding:0 24px 32px}
#sheet[open]{position:fixed;inset:0 0 0 auto;width:min(var(--insp),100vw);height:100dvh;max-height:none;max-width:none;margin:0;overflow:auto;border-left:1px solid var(--line);animation:slideIn .34s var(--out)}
@keyframes slideIn{from{transform:translateX(100%)}to{transform:none}}
#sheet .sheet-bar{display:flex;position:sticky;top:0;z-index:6;height:0;justify-content:flex-end}
.sheet-close{display:grid;place-items:center;width:30px;height:30px;margin:11px 12px 0 0;border-radius:var(--r-s);color:var(--text-3)}
.sheet-close:hover{background:var(--hover-2);color:var(--text)}
#sheet-content .d-bar,#sheet-content .form-top{padding-right:56px}
#sheet-content .d-bar .desk-only{display:none}
.sheet-grip{display:none}

#palette{width:min(640px,92vw);margin:13vh auto auto;padding:0;border:0;border-radius:14px;background:var(--surface);box-shadow:var(--pop),var(--edge);overflow:hidden}
:root[data-theme="dark"] #palette{background:rgba(18,19,22,.92);-webkit-backdrop-filter:blur(24px) saturate(1.4);backdrop-filter:blur(24px) saturate(1.4)}
#palette::backdrop{background:var(--backdrop)}
#palette[open]{animation:popIn .22s var(--out)}
@keyframes popIn{from{opacity:0;transform:scale(.98) translateY(-4px)}to{opacity:1;transform:none}}
.palette-field{display:flex;align-items:center;gap:12px;padding:0 16px 0 18px;height:56px;border-bottom:1px solid var(--line)}
.palette-field .ai{width:18px;height:18px;color:var(--text-3)}
#palette-input{flex:1;min-width:0;border:0;background:none;outline:none;font-size:16px;color:var(--text)}
#palette-input::placeholder{color:var(--text-3)}
#palette-list{max-height:min(400px,54vh);overflow:auto;padding:6px}
.p-sec{font:500 11px/1 var(--mono);text-transform:uppercase;letter-spacing:.04em;color:var(--text-3);padding:12px 10px 6px}
.p-item{display:grid;grid-template-columns:72px minmax(0,1fr) auto;align-items:center;gap:12px;min-height:44px;padding:6px 10px;border-radius:8px;cursor:pointer;position:relative}
.p-item.cmd{grid-template-columns:28px minmax(0,1fr) auto}
.p-item.active{background:var(--hover-2)}
.p-item.active::before{content:"";position:absolute;left:0;top:10px;bottom:10px;width:2px;border-radius:2px;background:var(--accent)}
.p-date{font-size:12.5px;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.p-name{display:flex;flex-direction:column;min-width:0;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.p-name small{font-size:12px;color:var(--text-3);overflow:hidden;text-overflow:ellipsis}
.p-icon{display:grid;place-items:center;width:26px;height:26px;border-radius:6px;border:1px solid var(--line-2);background:var(--surface-2);color:var(--text-2)}
.p-icon .ai{width:14px;height:14px}
.p-item kbd{font-family:var(--font);font-size:11px;min-width:0;padding:0 6px;height:20px}
.p-empty{padding:28px;text-align:center;color:var(--text-3);font-size:13px}
.palette-foot{display:flex;align-items:center;gap:16px;height:40px;padding:0 14px;border-top:1px solid var(--line);font-size:11.5px;color:var(--text-3);background:var(--hover)}
.palette-foot span{display:flex;align-items:center;gap:4px}
.palette-foot kbd{height:17px;min-width:17px}
.pf-brand{margin-right:auto;font-weight:500;color:var(--text-2);gap:7px!important}

#toast{position:fixed;right:20px;bottom:20px;z-index:200;display:flex;align-items:center;gap:10px;max-width:min(92vw,420px);padding:10px 16px 10px 12px;border-radius:10px;background:var(--surface-2);border:1px solid var(--line-2);box-shadow:var(--pop);font-size:13px;color:var(--text);opacity:0;transform:translateY(12px) scale(.98);pointer-events:none;transition:opacity .2s var(--ease),transform .3s var(--out)}
#toast.visible{opacity:1;transform:none}
.toast-icon{width:16px;height:16px;color:var(--text-3);stroke-width:2}
.toast-icon.ai-check{color:var(--green)}
dialog #toast{position:fixed}

#tip{position:fixed;left:0;top:0;z-index:300;display:flex;flex-direction:column;gap:2px;max-width:260px;padding:7px 10px;border-radius:8px;background:var(--surface-3);border:1px solid var(--line-2);box-shadow:var(--pop);font-size:12px;color:var(--text);pointer-events:none;opacity:0;transition:opacity .12s}
:root[data-theme="light"] #tip{background:#0a0a0a;color:#fff;border-color:#0a0a0a}
:root[data-theme="light"] #tip span{color:#b5b5b5}
#tip.on{opacity:1}
#tip b{font-weight:500;font-size:12px}
#tip span{color:var(--text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.year-chip{position:relative}
.year-chip summary{list-style:none;display:flex;align-items:center;gap:4px;height:44px;padding:0 6px 0 10px;border-radius:var(--r-s);font-size:14px;font-weight:500;cursor:pointer}
.year-chip summary::-webkit-details-marker{display:none}
.year-chip summary .ai{width:14px;height:14px;color:var(--text-3)}
.menu{position:absolute;top:calc(100% + 4px);left:0;z-index:60;min-width:180px;padding:4px;border-radius:10px;background:var(--surface-2);border:1px solid var(--line-2);box-shadow:var(--pop);animation:menuIn .18s var(--out);transform-origin:top left}
@keyframes menuIn{from{opacity:0;transform:scale(.96)}to{opacity:1;transform:none}}
.menu button{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:0 10px;border-radius:7px;font-size:14px;text-align:left}
.menu button:hover{background:var(--hover-2)}
.menu small{color:var(--text-3);font-size:12px}
.menu-check{margin-left:auto;color:var(--accent-text);opacity:0}
.menu [aria-pressed="true"] .menu-check{opacity:1}

.boot{display:grid;gap:10px;padding:90px 28px}
.boot span{height:52px;border-radius:var(--r);background:linear-gradient(90deg,var(--heat-0) 0%,var(--hover-2) 50%,var(--heat-0) 100%);background-size:200% 100%;animation:shimmer 1.2s var(--ease) 2 both}
.boot span:first-child{height:120px}
@keyframes shimmer{from{background-position:100% 0}to{background-position:-100% 0}}

/* ============ Icon motion (lucide-animated style) ============
 * Hover (pointer) and press (.did-run, set on pointerdown) play short one-shot moves; state changes draw once.
 * Nothing loops. 150–400 ms. */
.ai .rot,.ai .glass,.ai .arrow,.ai .lid,.ai .pen,.ai .nudge,.ai .nudge-l,.ai .drop,.ai .rays,.ai .rock,.ai .flip,.ai .spin{transform-box:view-box;transform-origin:center;transition:transform .3s var(--spring)}
.ai-trash .lid{transform-origin:85% 30%}
.ai .b{transform-box:view-box;transform-origin:50% 100%}
.ai .ln{stroke-dasharray:12;stroke-dashoffset:0}
@media (hover:hover){
  :is(button,summary,label):hover>.ai-plus .rot{transform:rotate(90deg)}
  :is(button,summary,label):hover>.ai-x .rot{transform:rotate(90deg)}
  :is(button,label):hover>.ai-trash .lid{transform:translateY(-1.5px) rotate(14deg)}
  :is(button,label):hover>.ai-download .arrow{transform:translateY(2px)}
  :is(button,label):hover>.ai-edit .pen{transform:rotate(-12deg) translate(-.5px,.5px)}
  :is(button,label):hover>.ai-chevron .nudge,.contrib-row:hover .r-chev .nudge{transform:translateX(2px)}
  :is(button,label):hover>.ai-back .nudge-l{transform:translateX(-2px)}
  :is(button,summary):hover>.ai-down .drop{transform:translateY(1.5px)}
  :is(button,label):hover>.ai-sun .rays{transform:rotate(45deg)}
  :is(button,label):hover>.ai-moon .rock{transform:rotate(-14deg)}
  :is(button,label):hover>.ai-auto .flip{transform:scale(.88)}
  :is(button,label):hover>.ai-search .glass,.find:hover .ai-search .glass{animation:nudge .4s var(--ease)}
  :is(button,label):hover>:is(.ai-restore,.ai-refresh) .spin{transform:rotate(-200deg)}
  button:hover>.ai-records .ln{animation:draw .34s var(--ease)}
  button:hover>.ai-records .ln2{animation-delay:.05s}
  button:hover>.ai-records .ln3{animation-delay:.1s}
  button:hover>.ai-overview .b{animation:grow .36s var(--spring) both}
  button:hover>.ai-overview .b2{animation-delay:.05s}
  button:hover>.ai-overview .b3{animation-delay:.1s}
}
.did-run>.ai-plus .rot{animation:spinQ .34s var(--spring)}
.did-run>.ai-search .glass{animation:nudge .4s var(--ease)}
.did-run>.ai-download .arrow{animation:dropDown .4s var(--spring)}
.did-run>.ai-trash .lid{animation:lid .4s var(--spring)}
.did-run>:is(.ai-restore,.ai-refresh) .spin{animation:spinFull .4s var(--out)}
.did-run>.ai-edit .pen{animation:scribble .4s var(--ease)}
.did-run>:is(.ai-sun,.ai-moon,.ai-auto) *{animation:popIcon .3s var(--spring)}
.tab[aria-current] .ai-overview .b,.nav[aria-current] .ai-overview .b{animation:grow .4s var(--spring) both}
.tab[aria-current] .ai-overview .b2,.nav[aria-current] .ai-overview .b2{animation-delay:.06s}
.tab[aria-current] .ai-overview .b3,.nav[aria-current] .ai-overview .b3{animation-delay:.12s}
.tab[aria-current] .ai-records .ln,.nav[aria-current] .ai-records .ln{animation:draw .36s var(--ease) both}
.tab[aria-current] .ai-records .ln2,.nav[aria-current] .ai-records .ln2{animation-delay:.06s}
.tab[aria-current] .ai-records .ln3,.nav[aria-current] .ai-records .ln3{animation-delay:.12s}
.ai .draw{stroke-dasharray:24;stroke-dashoffset:0}
.d-status .st-icon .draw,.visible .toast-icon .draw{animation:drawCheck .4s var(--ease) .1s both}
.d-status .st-icon circle{animation:popIcon .3s var(--spring) both}
@keyframes drawCheck{from{stroke-dashoffset:24}to{stroke-dashoffset:0}}
@keyframes draw{from{stroke-dashoffset:12}to{stroke-dashoffset:0}}
@keyframes nudge{0%,100%{transform:none}35%{transform:translate(-1.5px,-1.5px) rotate(-10deg)}70%{transform:translate(.5px,.5px) rotate(4deg)}}
@keyframes spinQ{from{transform:rotate(0)}to{transform:rotate(180deg)}}
@keyframes spinFull{from{transform:rotate(0)}to{transform:rotate(-360deg)}}
@keyframes dropDown{0%{transform:none}40%{transform:translateY(3px)}100%{transform:none}}
@keyframes lid{0%,100%{transform:none}45%{transform:translateY(-2px) rotate(18deg)}}
@keyframes scribble{0%,100%{transform:none}30%{transform:rotate(-14deg)}65%{transform:rotate(6deg)}}
@keyframes popIcon{0%{transform:scale(.7)}100%{transform:scale(1)}}

/* ============ 760–1179: sidebar + content; detail in a right drawer ============ */
@media (max-width:1179px){
  :root{--sb:216px}
  .page-body{padding:16px 22px 56px}
  .toolbar{padding:0 22px}
  .thead,.frame{grid-template-columns:108px minmax(0,1fr) 112px 140px;column-gap:12px}
    .tb-cmd{display:none}
}
@media (min-width:760px) and (max-width:1000px){
  .thead,.frame{grid-template-columns:100px minmax(0,1fr) 108px}
  .thead span:last-child,.r-st{display:none}
}

/* ============ Phone (<760) ============ */
@media (max-width:759px){
  :root{--tb:0px}
  body{font-size:15px;padding-top:calc(52px + env(safe-area-inset-top));padding-bottom:calc(96px + env(safe-area-inset-bottom))}
  .app{display:block;height:auto}
  .sidebar{display:none}
  #screen{height:auto;overflow:visible}
  .desk-only{display:none!important}
  .phone-only{display:flex!important}
  /* sticky compact header */
  .mhead{position:fixed;top:0;left:0;right:0;z-index:40;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;height:calc(52px + env(safe-area-inset-top));padding:env(safe-area-inset-top) 6px 0 6px;background:var(--bg);border-bottom:1px solid transparent;transition:background .2s,border-color .2s}
  .scrolled .mhead{background:var(--glass);-webkit-backdrop-filter:blur(18px) saturate(1.5);backdrop-filter:blur(18px) saturate(1.5);border-bottom-color:var(--line)}
  .mhead-title{font-size:15px;font-weight:600;letter-spacing:-.01em;opacity:0;transform:translateY(4px);transition:opacity .2s,transform .25s var(--out)}
  .title-collapsed .mhead-title{opacity:1;transform:none}
  .mhead-lead{justify-self:start}
  .mhead-actions{justify-self:end;display:flex}
  .nav-icon{display:grid;place-items:center;width:44px;height:44px;border-radius:12px;color:var(--text-2)}
  .nav-icon .ai{width:20px;height:20px}
  .nav-add{color:var(--text)}
  .nav-add .ai{width:16px;height:16px;padding:7px;box-sizing:content-box;border-radius:9px;background:var(--primary-bg);color:var(--primary-fg)}
  .year-chip summary{font-family:var(--mono);font-size:15px;letter-spacing:-.02em}
  /* page */
  .toolbar{position:static;height:auto;padding:6px 16px 4px;background:none!important;border:0!important;-webkit-backdrop-filter:none!important;backdrop-filter:none!important;align-items:flex-end}
  .tb-text{flex-direction:column;align-items:flex-start;gap:4px;white-space:normal}
  .crumb{display:none}
  .large-title{font-size:26px;font-weight:600;letter-spacing:-.035em;line-height:1.15}
  .tb-sub{padding:0;font-size:12.5px}
  .tb-actions .button{height:44px;padding:0 14px}
  .page-body{padding:12px 16px 24px;gap:14px}
  /* heatmap scrolls sideways; month labels become 44px chips */
  .cal{padding:16px 0 14px;gap:12px;border-radius:var(--r-l)}
  .cal-side{padding:0 16px}
  .film{padding:0 16px;scroll-padding:16px}
  .film-inner{width:calc(var(--weeks)*17px + 24px);max-width:none}
  .heat-labels{height:44px;margin-bottom:6px;column-gap:3px}
  .sm-label{flex-direction:column;justify-content:center;gap:1px;height:44px;padding:0 6px;margin-right:4px;border-radius:8px;border:1px solid var(--line);background:var(--surface-2);font-size:12px;color:var(--text-2)}
  .sm-label.has{color:var(--text);border-color:var(--line-2)}
  .sm-n{display:block;font-size:10.5px;color:var(--text-3)}
  .legend-note{padding:0 16px;margin:0}
  /* filter + rows */
  .filterbar{flex-direction:column;align-items:stretch;gap:10px}
  .filterbar .seg button{min-height:44px;font-size:13.5px}
  .find{width:auto;margin:0}
  .search{height:44px;font-size:16px;border-radius:10px}
  .find-kbd{display:none}
  .thead{display:none}
  .frame{grid-template-columns:62px minmax(0,1fr) auto;grid-template-areas:"date main amt" "date main st";align-items:center;row-gap:4px;column-gap:12px;min-height:68px;padding:10px 14px}
  .r-date{grid-area:date;align-self:start;padding-top:1px}
  .r-big{flex-direction:column;align-items:flex-start;gap:1px;font-size:14px}
  .r-wk{font-size:12px}
  .r-sub{display:none}
  .r-date.raw .r-raw{font-size:11px;-webkit-line-clamp:3}
  .r-main{grid-area:main;gap:3px}
  .r-name{font-size:15px;white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-height:1.3}
  .r-meta{font-size:12.5px}
  .r-amount{grid-area:amt;align-self:end;font-size:14px}
  .r-st{grid-area:st;justify-content:flex-end;align-self:start}
  .r-st .status{height:20px;padding:0 7px;font-size:11px;gap:5px;border:0;background:var(--hover-2)}
  .g-head{top:calc(52px + env(safe-area-inset-top));height:32px}
  .page-foot{gap:0;margin-top:6px}
  .page-foot>p{padding:4px 2px 10px}
  .foot-link{align-items:center;gap:12px;min-height:48px;padding:0 4px;border-top:1px solid var(--line);font-size:15px;color:var(--text);text-align:left}
  .foot-link .ai{color:var(--text-3)}
  .foot-chev{margin-left:auto}
  .foot-mode{align-items:center;justify-content:space-between;min-height:56px;padding:0 4px;border-top:1px solid var(--line);font-size:15px;color:var(--text)}
  .foot-mode .seg{width:156px}
  .foot-mode .seg button{min-height:44px}
  /* floating tab bar */
  .tabbar{position:fixed;left:50%;bottom:calc(14px + env(safe-area-inset-bottom));z-index:45;display:grid;grid-template-columns:1fr 1fr;width:min(280px,calc(100vw - 32px));padding:4px;transform:translateX(-50%);border-radius:16px;background:var(--glass);-webkit-backdrop-filter:blur(20px) saturate(1.6);backdrop-filter:blur(20px) saturate(1.6);border:1px solid var(--line-2);box-shadow:var(--pop),var(--edge);isolation:isolate}
  .tab-thumb{position:absolute;z-index:-1;top:4px;bottom:4px;left:4px;width:calc(50% - 4px);border-radius:12px;background:var(--hover-2);box-shadow:inset 0 1px 0 rgba(255,255,255,.06),0 0 0 1px var(--line);transform:translateX(calc(var(--at)*100%));transition:transform .3s var(--out)}
  .tab{display:flex;align-items:center;justify-content:center;gap:7px;height:48px;border-radius:12px;font-size:13.5px;color:var(--text-3);font-weight:500}
  .tab[aria-current="page"]{color:var(--text)}
  .tab .ai{width:18px;height:18px}
  /* overview */
  .hero{padding:22px 18px 20px;gap:18px}
  .hero-number,.hero-ghost{font-size:44px}
  .sl{font-size:13.5px}
  .months{padding:16px 16px 6px}
  .card-head{flex-direction:column;gap:10px}
  .month-readout{align-items:flex-start;text-align:left}
  .chart{height:190px;padding-left:44px}
  .bar-label{height:28px;font-size:10.5px}
  .bar{min-height:44px}
  .contrib{margin:12px -16px 0;padding:14px 16px 10px}
  .contrib-row{min-height:48px;grid-template-columns:minmax(0,1fr) auto auto 14px}
  .settle-head{flex-direction:column;align-items:stretch}
  .settle-head .seg button{min-height:44px}
  .notes{padding:16px}
  /* bottom sheets */
  #sheet[open]{inset:auto 0 0 0;width:100%;height:calc(100dvh - 12px - env(safe-area-inset-top));border-radius:16px 16px 0 0;border:1px solid var(--line-2);border-bottom:0;animation:sheetUp .4s var(--out)}
  @keyframes sheetUp{from{transform:translateY(100%)}to{transform:none}}
  #sheet .sheet-bar{height:0}
  .sheet-grip{display:block;position:absolute;left:50%;top:6px;width:36px;height:4px;margin-left:-18px;border-radius:2px;background:var(--line-3)}
  .sheet-close{width:44px;height:44px;margin:4px 6px 0 0}
  #sheet-content{padding:0 16px calc(28px + env(safe-area-inset-bottom))}
  #sheet-content .d-bar,#sheet-content .form-top{margin:0 -16px;padding:14px 56px 0 16px;min-height:60px;height:auto}
  .d-bar{background:var(--sidebar)}
  .d-hero h2{font-size:24px}
  .tb-icon{width:44px;height:44px}
  .button{height:44px;font-size:15px}
  .button.small{height:44px}
  .button.large{height:48px;font-size:15.5px}
  .form-list{grid-template-columns:1fr}
  .input{height:44px;font-size:16px}
  .input-title{height:48px;font-size:17px}
  .seg-inputs .input{height:44px;font-size:16px}
  textarea.input{font-size:16px}
  .form-label{font-size:13.5px}
  .text-button,.link-button{min-height:44px}
  .segments-summary{height:48px}
  .segment{grid-template-columns:minmax(0,1fr) 44px;grid-template-areas:"no del" "in in";row-gap:2px;padding-bottom:8px;border-bottom:1px solid var(--line)}
  .seg-no{grid-area:no}
  .seg-inputs{grid-area:in}
  .segment>.tb-icon{grid-area:del}
  .seg-inputs .input{min-width:0;width:100%;padding:0 6px}
  .kv{font-size:14px;grid-template-columns:92px minmax(0,1fr);padding:9px 0}
  .d-money .dm-cell p{font-size:19px}
  .alloc-row{grid-template-columns:52px minmax(0,1fr) 40px 84px}
  .confirm-actions{grid-template-columns:1fr}
  .confirm-actions .button.primary{order:-1}
  .trash-row{flex-wrap:wrap;justify-content:flex-end}
  .trash-text{flex-basis:100%}
  .trash-row .button{height:44px}
  #toast{left:50%;right:auto;bottom:calc(84px + env(safe-area-inset-bottom));transform:translate(-50%,12px);width:max-content}
  #toast.visible{transform:translate(-50%,0)}
  dialog #toast{bottom:calc(24px + env(safe-area-inset-bottom))}
  #palette{margin:calc(10px + env(safe-area-inset-top)) auto auto;width:calc(100vw - 20px)}
  .palette-foot{display:none}
  .p-item{grid-template-columns:54px minmax(0,1fr);min-height:52px}
  .p-item.cmd{grid-template-columns:28px minmax(0,1fr) auto}
  .p-item .status{display:none}
  #palette-input{font-size:16px}
  .boot{padding:20px 16px}
}
@media (hover:none){.frame:hover{background:none}}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
  .ai *{transform:none!important}
}
@media (forced-colors:active){.c.on,.dot,.bar-fill,.split-bar span{forced-color-adjust:none}.frame.is-selected{outline:2px solid Highlight}}
