:root { color-scheme:light; --ink:#111827; --muted:#556173; --line:#cbd1da; --surface:#f1f2f4; --band:#e3e6eb; --accent:#171717; font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif; color:var(--ink); background:#fff }
* { box-sizing:border-box }
[hidden] { display:none!important }
body { margin:0 }
button,input,select,textarea { font:inherit; color:inherit }
button,input,select,textarea { border:1px solid var(--line); border-radius:3px; background:#fff }
button,select,summary { cursor:pointer }
button,input,select { min-height:36px; padding:5px 10px; font-size:.875rem }
button:hover { background:var(--surface) }
button:disabled { cursor:default; opacity:.65 }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px }
.primary { background:var(--accent); color:white; border-color:var(--accent); font-weight:600 }
.primary:hover { background:#303030 }
header { height:56px; background:var(--surface); border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; padding:0 max(24px,calc((100vw - 1120px)/2)) }
.brand { white-space:nowrap; font-size:1.125rem; letter-spacing:.03em }
details { position:relative; font-size:.875rem }
details button { position:absolute; top:calc(100% + 8px); right:0; white-space:nowrap; z-index:2; box-shadow:0 4px 12px #18273818 }
#workspace { max-width:1168px; padding:0 24px 48px; margin:auto }
.toolbar { display:flex; justify-content:space-between; align-items:center; gap:16px; min-height:62px; margin-bottom:10px }
.tabs,.tools,.auth-actions,.note-actions { display:flex; align-items:center; gap:8px }
.tabs button { border:0; border-bottom:2px solid transparent; border-radius:0; min-height:42px; padding-inline:12px; color:var(--muted); white-space:nowrap }
.tabs button[aria-pressed=true] { border-bottom-color:var(--accent); color:var(--ink); font-weight:650 }
.tools input { width:190px }
.group { border:1px solid var(--line) }
.group + .group { border-top:0 }
.group-head { display:flex; align-items:center; gap:9px; background:var(--band); padding:8px 15px; min-height:40px }
h1,h2 { margin:0; font-weight:650 }
h2 { font-size:1rem }
.group-head h2 { font-weight:750; letter-spacing:.025em }
.count { color:var(--muted); font-size:.8125rem; font-variant-numeric:tabular-nums }
.group.drag-over { outline:2px solid var(--accent); outline-offset:2px }
.empty { min-height:42px; border-top:1px solid var(--line); display:grid; place-items:center; color:var(--muted); font-size:.875rem }
.stock { display:grid; grid-template-columns:20px minmax(220px,1.25fr) minmax(0,2fr) auto; align-items:center; gap:12px; padding:8px 13px; border-top:1px solid var(--line); min-height:49px }
.stock:hover { background:#f5f5f5 }
.grip { cursor:grab; color:var(--muted); user-select:none; text-align:center }
a,.quiet { color:var(--accent) }
a { font-weight:600; text-decoration:underline; text-decoration-color:#999; text-underline-offset:3px }
a:hover { text-decoration-color:currentColor }
.meta,.snippet { color:var(--muted); font-size:.875rem }
.identity { display:grid; grid-template-columns:minmax(0,1fr) 100px; align-items:center; gap:8px }
.identity a { overflow-wrap:anywhere }
.identity .meta { font-size:.8125rem; font-variant-numeric:tabular-nums; white-space:nowrap }
.snippet { overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
.row-actions { display:flex; align-items:center; gap:6px }
.row-actions button,.row-actions select { min-height:32px; font-size:.8125rem }
.auth-card { width:min(360px,calc(100% - 40px)); margin:12vh auto 0; border:1px solid var(--line); border-radius:3px; padding:24px }
.auth-card h1 { margin-bottom:18px; font-size:1.375rem }
label { display:grid; gap:5px; margin-bottom:14px; font-size:.875rem }
.quiet { border-color:transparent }
.error { color:#a1262d; font-size:.875rem }
dialog { border:1px solid var(--line); border-radius:3px; color:var(--ink); padding:0; width:min(480px,calc(100% - 32px)); max-height:85vh }
dialog::backdrop { background:#1b27354d }
.dialog-head { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; border-bottom:1px solid var(--line); background:var(--band) }
.close { padding:0 10px; font-size:1.25rem; border-color:transparent; background:transparent }
.picker-body,.drawer-body { padding:16px }
#query,textarea { width:100% }
#results { margin-top:8px }
.result { width:100%; display:flex; align-items:center; justify-content:space-between; gap:8px; text-align:left; border:0; border-bottom:1px solid var(--line); border-radius:0; min-height:44px }
.drawer { margin:0 0 0 auto; width:min(440px,100%); max-width:none; height:100%; max-height:none; border-radius:0 }
textarea { min-height:96px; padding:10px; resize:vertical }
.note-actions { justify-content:flex-end; margin:8px 0 16px }
.note { border-top:1px solid var(--line); padding:12px 0 }
.note-top { display:flex; justify-content:space-between; align-items:center; gap:8px }
.note p { margin:8px 0 0; white-space:pre-wrap; overflow-wrap:anywhere }
#toast { position:fixed; bottom:22px; left:50%; transform:translateX(-50%); z-index:5; max-width:calc(100% - 32px); padding:8px 13px; border:1px solid var(--line); border-radius:3px; background:white; box-shadow:0 5px 24px #18273826; white-space:nowrap; font-size:.875rem }
#toast button { margin-left:8px }
@media(max-width:680px) {
  header { padding:0 16px }
  #workspace { padding-inline:12px }
  .toolbar { align-items:stretch; flex-direction:column; gap:8px; padding:8px 0 }
  .tools { flex-wrap:wrap }
  .tools input { width:auto; flex:1; min-width:120px }
  .stock { grid-template-columns:minmax(75px,1fr) auto; gap:4px 8px; padding:7px 10px }
  .grip { display:none }
  .identity { display:block }
  .identity .meta { display:block }
  .snippet { grid-row:2; grid-column:1/-1 }
  .snippet:empty { display:none }
}

.thread { border:1px solid var(--line); border-radius:3px; margin-bottom:12px; padding:0 11px }
.thread > .note:first-child { border-top:0 }
.note.reply { margin-left:14px; padding-left:10px; border-left:2px solid var(--line) }
#reply-context { margin:0 0 6px }

.stock[data-drop="before"] { box-shadow:inset 0 2px var(--accent) }
.stock[data-drop="after"] { box-shadow:inset 0 -2px var(--accent) }

label[for="add-tier"] { display:flex; align-items:center; gap:8px; margin-bottom:10px }
