/* CrawlTroll app layer (on top of ct.css tokens) */
body { background:var(--bg); }
a { color:inherit; text-decoration:none; }
[hidden] { display:none !important; }
.muted { color:var(--muted); }
.subtle { color:var(--subtle); }
.mark { width:22px; height:22px; border-radius:6px; background:var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='24' cy='31' r='8' fill='%23fff'/%3E%3Ccircle cx='41' cy='31' r='9.5' fill='%23fff'/%3E%3Ccircle cx='26' cy='32' r='3.2' fill='%23141413'/%3E%3Ccircle cx='43' cy='32' r='4' fill='%23141413'/%3E%3Cpath d='M20 44 q12 9 24 0' stroke='%23fff' stroke-width='3.2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center/100% no-repeat; flex:none; display:inline-block; }

/* shell */
.shell { grid-template-columns:248px 1fr; }
.shell.collapsed { grid-template-columns:64px 1fr; }
.shell.collapsed .side b, .shell.collapsed .side .site-switch, .shell.collapsed .search-btn span, .shell.collapsed .nav span, .shell.collapsed .nav .cnt, .shell.collapsed .me div, .shell.collapsed .nav-group { display:none; }
.side { gap:2px; overflow-y:auto; }
.side .brand { display:flex; align-items:center; gap:10px; padding:4px 6px 14px; }
.side .brand b { flex:1; }
.btn.sm { height:28px; width:28px; }
.site-switch { position:relative; margin-bottom:8px; }
.site-switch select { width:100%; appearance:none; height:36px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--text); font:500 14px Inter,sans-serif; padding:0 32px 0 30px; cursor:pointer; }
.site-switch::before { content:""; position:absolute; left:11px; top:13px; width:10px; height:10px; border-radius:3px; background:var(--accent); }
.site-switch svg.lucide { position:absolute; right:10px; top:10px; color:var(--muted); pointer-events:none; }
.search-btn { display:flex; align-items:center; gap:8px; height:36px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--muted); padding:0 8px 0 10px; margin-bottom:12px; cursor:pointer; font:14px Inter,sans-serif; }
.search-btn span:first-of-type { flex:1; text-align:left; }
.nav { width:100%; border:0; background:none; text-align:left; font-family:Inter,sans-serif; }
.nav-group { font-size:12px; color:var(--subtle); padding:14px 10px 4px; font-weight:500; }
.nav .cnt.live { color:var(--live); display:inline-flex; align-items:center; gap:5px; }
.me { display:flex; align-items:center; gap:10px; padding:10px 8px; margin-top:6px; border-top:1px solid var(--border); }
.me .avatar { border-radius:8px; }

/* page */
.main { overflow-y:auto; }
.page { padding:28px 32px 40px; max-width:1240px; width:100%; margin:0 auto; }
.page.wide { max-width:none; }
.page-h { display:flex; align-items:center; gap:10px; margin-bottom:20px; flex-wrap:wrap; }
.page-h h1 { font:400 28px/1.2 var(--serif); letter-spacing:-.01em; margin:0; flex:1; min-width:200px; }
.page-h .sub { width:100%; color:var(--muted); margin-top:-6px; }
.section-h { display:flex; align-items:center; margin:28px 0 12px; }
.section-h h2 { font-size:16px; font-weight:600; margin:0; flex:1; }
.grid { display:grid; gap:14px; }
.g4 { grid-template-columns:repeat(4,minmax(0,1fr)); }
.g3 { grid-template-columns:repeat(3,minmax(0,1fr)); }
.g2 { grid-template-columns:repeat(2,minmax(0,1fr)); }
.box { background:var(--surface); border:1px solid var(--border); border-radius:12px; }
.box-pad { padding:18px; }
.stat { padding:18px 18px 16px; display:flex; flex-direction:column; gap:6px; min-height:128px; }
.stat .lbl { display:flex; align-items:center; gap:6px; color:var(--text); }
.stat .lbl .tag { margin-left:auto; }
.stat .val { font:600 30px/36px Inter,sans-serif; letter-spacing:-.02em; margin-top:6px; }
.stat .foot { color:var(--muted); font-size:13px; }
.tag { display:inline-flex; align-items:center; gap:4px; height:22px; padding:0 8px; border-radius:6px; background:var(--surface-2); color:var(--text); font-size:12px; font-weight:500; white-space:nowrap; }
.tag.green { background:#E6F0E4; color:var(--success); }
.tag.red { background:#F6E3E0; color:var(--danger); }
.tag.orange { background:var(--accent-soft); color:var(--accent); }
.tag.blue { background:#DFE9FB; color:#2457C5; }
:root[data-theme="dark"] .tag.green { background:#2F3F30; } :root[data-theme="dark"] .tag.red { background:#4A2D2A; } :root[data-theme="dark"] .tag.blue { background:#26364F; color:#8AB4F8; }
.link { color:var(--link); text-decoration:underline; text-underline-offset:3px; cursor:pointer; background:none; border:0; font:inherit; padding:0; }

/* tables */
.tbl { width:100%; border-collapse:collapse; }
.tbl th { text-align:left; font-weight:500; color:var(--muted); font-size:13px; padding:10px 14px; border-bottom:1px solid var(--border); white-space:nowrap; }
.tbl td { padding:12px 14px; border-bottom:1px solid var(--border); vertical-align:middle; }
.tbl tr:last-child td { border-bottom:0; }
.tbl tbody tr { cursor:pointer; }
.tbl tbody tr:hover td { background:var(--surface-2); }
.tbl .num { text-align:right; }
.tbl .clip { max-width:280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mono { font-family:"JetBrains Mono",ui-monospace,monospace; font-size:12.5px; }
.empty { padding:48px 24px; text-align:center; color:var(--muted); }
.empty h3 { font:400 20px var(--serif); color:var(--text); margin:12px 0 6px; }
.empty .mark { width:44px; height:44px; border-radius:12px; }
.toolbar-row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-bottom:14px; }
.toolbar-row .grow { flex:1; }
.input { height:34px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--text); padding:0 10px; font:14px Inter,sans-serif; outline:none; }
.input:focus, textarea.input:focus { border-color:var(--text); }
textarea.input { height:auto; padding:8px 10px; min-height:70px; resize:vertical; }
.seg button { font:500 13px Inter,sans-serif; padding:5px 12px; }

/* bars chart */
.bars { display:flex; align-items:flex-end; gap:3px; height:120px; padding-top:8px; }
.bars div { flex:1; background:var(--surface-3); border-radius:3px 3px 0 0; min-height:2px; position:relative; }
.bars div.hl { background:var(--success); }
.bars div:hover::after { content:attr(data-tip); position:absolute; bottom:100%; left:50%; transform:translateX(-50%); background:var(--text); color:var(--bg); font-size:11px; padding:2px 6px; border-radius:4px; white-space:nowrap; margin-bottom:4px; z-index:2; }
.spark { display:flex; align-items:flex-end; gap:1px; height:22px; width:72px; }
.spark i { flex:1; background:var(--danger); opacity:.7; border-radius:1px; min-height:1px; }
.meter { height:8px; border-radius:4px; background:var(--surface-3); display:flex; overflow:hidden; }
.meter i { display:block; height:100%; }

/* auth */
.auth { min-height:100vh; display:grid; place-items:center; padding:24px; }
.auth-card { width:min(400px,100%); display:flex; flex-direction:column; gap:12px; }
.auth-brand { display:flex; align-items:center; gap:10px; font:500 20px var(--serif); margin-bottom:18px; }
.auth h1 { font:400 30px/1.2 var(--serif); margin:0; }
.auth label { display:flex; flex-direction:column; gap:6px; font-weight:500; font-size:13px; }
.auth input { height:40px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--text); padding:0 12px; font:15px Inter,sans-serif; outline:none; }
.auth input:focus { border-color:var(--text); }
.btn.big { height:42px; justify-content:center; font-size:15px; }
.form-err { color:var(--danger); min-height:20px; font-size:13px; }

/* toasts */
.toasts { position:fixed; right:20px; bottom:20px; display:flex; flex-direction:column; gap:8px; z-index:50; }
.toastx { width:320px; background:var(--surface); border:1px solid var(--border-strong); border-radius:12px; box-shadow:var(--sh-lg); padding:12px 14px; cursor:pointer; animation:pop .2s var(--ease); }
.toastx b { display:block; font-weight:600; }
.toastx p { margin:2px 0 0; color:var(--muted); font-size:13px; }

/* ⌘K */
.cmdk-bg { position:fixed; inset:0; background:rgba(20,20,19,.3); z-index:60; display:none; }
.cmdk-bg.on { display:block; }
.cmdk input { font-family:Inter,sans-serif; }
.cmdk .it { cursor:pointer; }

/* live page */
.live-wrap { display:grid; grid-template-columns:340px minmax(0,1fr) 320px; height:100vh; }
.live-list { border-right:1px solid var(--border); display:flex; flex-direction:column; min-height:0; background:var(--bg); }
.live-list .head { padding:20px 16px 12px; }
.live-list .head h1 { font:400 26px/1.2 var(--serif); margin:0 0 4px; display:flex; align-items:center; gap:10px; }
.vrows { overflow-y:auto; flex:1; }
.vrow { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:2px 10px; padding:12px 16px; border-bottom:1px solid var(--border); cursor:pointer; position:relative; }
.vrow:hover { background:var(--surface-2); }
.vrow.sel { background:var(--surface); box-shadow:inset 3px 0 0 var(--accent); }
.vrow.off { opacity:.55; }
.vrow .ava { grid-row:1/3; width:34px; height:34px; border-radius:10px; display:grid; place-items:center; font-weight:600; font-size:12px; color:#fff; position:relative; }
.vrow .ava .on { position:absolute; right:-2px; bottom:-2px; width:11px; height:11px; border-radius:50%; background:var(--success); border:2px solid var(--bg); }
.vrow .nm { font-weight:600; display:flex; gap:6px; align-items:center; min-width:0; }
.vrow .nm span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.vrow .pth { color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:13px; }
.vrow .rt { text-align:right; color:var(--muted); font-size:12px; }
.vrow .meta { grid-column:2/4; display:flex; gap:6px; align-items:center; margin-top:6px; flex-wrap:wrap; }
.vrow .msgq { position:absolute; right:12px; top:12px; opacity:0; }
.vrow:hover .msgq { opacity:1; }
.vrow:hover .rt { visibility:hidden; }
.live-center { display:flex; flex-direction:column; min-width:0; min-height:0; }
.live-bar { display:flex; align-items:center; gap:8px; padding:14px 18px; border-bottom:1px solid var(--border); min-height:64px; }
.live-bar .who { flex:1; min-width:0; }
.live-bar .who b { font-weight:600; font-size:15px; }
.live-bar .who div { color:var(--muted); font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stage2 { flex:1; position:relative; overflow:hidden; background:var(--surface-2); }
#player { position:absolute; top:50%; left:50%; transform-origin:center center; }
#player .replayer-wrapper { background:#fff; border-radius:10px; overflow:hidden; box-shadow:0 10px 30px -12px rgba(20,20,19,.35); }
#player iframe { border:0; display:block; }
.stage-msg { position:absolute; inset:0; display:grid; place-items:center; text-align:center; color:var(--muted); padding:24px; pointer-events:none; }
.stage-msg.dim { background:rgba(250,249,245,.7); color:var(--text); font-weight:500; }
:root[data-theme="dark"] .stage-msg.dim { background:rgba(38,38,36,.7); }
.live-side { border-left:1px solid var(--border); display:flex; flex-direction:column; min-height:0; background:var(--bg); }
.live-side .tabs { padding:0 16px; }
.live-side .pane { padding:14px 16px; }
.feed .ev { grid-template-columns:62px 18px minmax(0,1fr); }
.feed .ev span { word-break:break-word; }
.kv2 { display:grid; grid-template-columns:96px minmax(0,1fr); gap:8px 10px; font-size:13px; }
.kv2 span { color:var(--muted); }
.kv2 b { font-weight:500; word-break:break-word; }
.compose2 { display:flex; flex-direction:column; gap:10px; }
.compose2 .tpls { display:flex; gap:6px; flex-wrap:wrap; }
.pstatus { font-size:13px; color:var(--muted); min-height:18px; }

/* replay player */
.rp { display:grid; grid-template-columns:minmax(0,1fr) 360px; height:100vh; }
.rp-main { display:flex; flex-direction:column; min-width:0; min-height:0; }
.rp-head { display:flex; align-items:center; gap:10px; padding:14px 18px; border-bottom:1px solid var(--border); }
.rp-head .who { flex:1; min-width:0; }
.rp-ctrl { display:flex; align-items:center; gap:10px; padding:10px 18px 14px; border-top:1px solid var(--border); background:var(--bg); }
.rp-ctrl .time { font-variant-numeric:tabular-nums; color:var(--muted); font-size:13px; min-width:92px; }
.scrub { flex:1; height:28px; position:relative; cursor:pointer; }
.scrub .rail { position:absolute; left:0; right:0; top:11px; height:6px; border-radius:3px; background:var(--surface-3); overflow:hidden; }
.scrub .gap { position:absolute; top:0; bottom:0; background:repeating-linear-gradient(135deg,transparent 0 3px,var(--border-strong) 3px 5px); }
.scrub .done { position:absolute; left:0; top:0; bottom:0; background:var(--text); opacity:.75; }
.scrub .mk { position:absolute; top:6px; width:4px; height:16px; margin-left:-2px; border-radius:2px; }
.scrub .mk.m-click { background:var(--subtle); height:8px; top:10px; }
.scrub .mk.m-page { background:var(--text); }
.scrub .mk.m-err { background:var(--danger); }
.scrub .mk.m-rage { background:var(--accent); }
.scrub .mk.m-conv { background:var(--success); }
.scrub .head { position:absolute; top:7px; width:14px; height:14px; margin-left:-7px; border-radius:50%; background:var(--surface); border:3px solid var(--text); }
.rp-side { border-left:1px solid var(--border); display:flex; flex-direction:column; min-height:0; }
.rp-side .tabs { padding:0 16px; }
.rp-side .pane { padding:8px 16px 16px; }
.ev.cur { background:var(--surface-2); }
.ev.seekable { cursor:pointer; }
.ev.seekable:hover { background:var(--surface-2); }
.code { background:var(--surface-2); border:1px solid var(--border); border-radius:8px; padding:12px; overflow:auto; font:12px/18px "JetBrains Mono",monospace; white-space:pre; max-height:340px; }

@media (max-width:1200px) { .live-wrap { grid-template-columns:300px minmax(0,1fr); } .live-side { display:none; } .g4 { grid-template-columns:repeat(2,minmax(0,1fr)); } .rp { grid-template-columns:minmax(0,1fr); } .rp-side { display:none; } }
@media (max-width:1100px) {
  .shell, .shell.collapsed { grid-template-columns:64px minmax(0,1fr); }
  .side { display:flex !important; }
  .side b, .side .site-switch, .search-btn span, .side .nav span, .side .nav .cnt, .side .me div, .nav-group, #collapse { display:none !important; }
  .search-btn { justify-content:center; padding:0; }
  .side .nav { justify-content:center; }
}
@media (max-width:820px) { .shell, .shell.collapsed { grid-template-columns:1fr; } .side { display:none !important; } .live-wrap { grid-template-columns:1fr; grid-template-rows:40vh 1fr; height:auto; min-height:100vh; } .g3, .g2 { grid-template-columns:1fr; } .page { padding:20px 16px; } }
.fl2 { display:flex; flex-direction:column; gap:6px; font-weight:500; font-size:13px; }
.feed .ev.past time { color:var(--text); }
.help-card { border:1px solid var(--border); border-radius:12px; padding:12px; margin-bottom:10px; background:var(--surface); }
.hc-top { display:flex; align-items:center; gap:8px; }
.hc-sec { margin-top:8px; font-size:13px; }
.hc-sec b { font-weight:600; font-size:12.5px; }
.hc-sec p, .hc-sec ol { margin:3px 0 0; color:var(--muted); }
.hc-sec ol { padding-left:18px; }
.hc-actions { display:flex; gap:6px; flex-wrap:wrap; margin-top:10px; }
.btn.sm2 { height:30px; padding:0 10px; font-size:13px; }
.btn[disabled] { opacity:.45; cursor:default; }
.note { border-left:2px solid var(--border-strong); padding:4px 0 4px 10px; margin-bottom:8px; font-size:13px; }

.kb-row { display:flex; gap:10px; align-items:center; padding:8px 0; border-bottom:1px solid var(--border); }
.kb-row:last-child { border-bottom:0; }
