:root {
  --bg: #0b1020;
  --sidebar: #0e1729;
  --surface: #121b2f;
  --surface-raised: #18243b;
  --surface-hover: #1d2c46;
  --ink: #f2f6ff;
  --muted: #aab7cc;
  --line: #2c3b55;
  --accent: #5eead4;
  --accent-ink: #063b3b;
  --warn: #f8c454;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans CJK SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--sans); }
button, input { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button:active { background: var(--surface-raised); }
button:disabled { cursor: wait; opacity: .55; }
[hidden] { display: none !important; }

.app { min-height: 100dvh; display: grid; grid-template-columns: 250px 320px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 14px 12px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.brand strong { display: block; font-size: 14px; }
.brand small, .inspector small, dialog small { display: block; color: var(--muted); font: 10px/1.3 var(--mono); letter-spacing: .08em; }

.access, .user-search { padding: 6px 12px 10px; }
.access label, .user-search label, .filters label { display: block; color: var(--muted); font-size: 12px; }
.access div, .user-search div { display: flex; gap: 6px; margin-top: 4px; }
input { min-width: 0; width: 100%; min-height: 40px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
button { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
button:hover { background: var(--surface-hover); }
.access button, .user-search button, .filters button { padding: 0 12px; color: var(--accent); }
.user-search { border-bottom: 1px solid var(--line); }
.status { margin: 0; padding: 9px 14px; color: var(--muted); font-size: 12px; }
.user-list { flex: 1; overflow: auto; padding: 0 8px 12px; }
.user-item { position: relative; width: 100%; min-height: 64px; margin: 2px 0; padding: 9px 9px 9px 46px; border: 0; text-align: left; background: transparent; }
.user-item:hover { background: var(--surface); }
.user-item[aria-current="true"] { background: var(--surface-raised); box-shadow: inset 2px 0 var(--accent); }
.user-avatar { position: absolute; left: 9px; top: 12px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-hover); color: var(--accent); font-size: 12px; font-weight: 700; }
.user-item strong, .user-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-item strong { font-size: 13px; }
.user-item small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.secondary { margin: 8px 12px 14px; color: var(--accent); }

.session-sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--sidebar) 82%, var(--surface)); }
.session-header { padding: 20px 16px 14px; border-bottom: 1px solid var(--line); }
.session-header h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.session-search { padding: 12px; border-bottom: 1px solid var(--line); }
.session-search label { display: block; color: var(--muted); font-size: 12px; }
.session-search div { display: flex; gap: 6px; margin-top: 4px; }
.session-search button { padding: 0 12px; color: var(--accent); }
.session-list { flex: 1; overflow: auto; padding: 4px 8px 12px; }
.session-item { width: 100%; min-height: 82px; margin: 2px 0; padding: 10px 11px; border: 0; text-align: left; background: transparent; }
.session-item:hover { background: var(--surface); }
.session-item[aria-current="true"] { background: var(--surface-raised); box-shadow: inset 2px 0 var(--accent); }
.session-item strong { display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 13px; line-height: 1.45; }
.session-item small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.session-kind { display: inline-block; margin-bottom: 5px; padding: 1px 6px; border: 1px solid var(--warn); border-radius: 999px; color: var(--warn); font-size: 10px; }

.workspace { min-width: 0; }
.workspace-header { padding: 24px clamp(20px, 4vw, 56px) 16px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 4px; color: var(--accent); font: 11px var(--mono); letter-spacing: .1em; }
.workspace h1 { margin: 0; font-size: clamp(22px, 2.5vw, 32px); line-height: 1.25; }
.summary { margin: 5px 0 0; color: var(--muted); }
.back-button { display: none; margin-bottom: 14px; padding: 0 12px; color: var(--accent); }
.filters { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(120px, 1fr)) auto; gap: 10px; align-items: end; padding: 14px clamp(20px, 4vw, 56px); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(12px); }
.filters input { margin-top: 4px; }
.filters button { padding: 0 16px; }
.input-status { padding-inline: clamp(20px, 4vw, 56px); }
.input-list { width: min(100%, 1080px); margin: 0 auto; padding: 8px clamp(20px, 5vw, 52px) 42px; }
.input-card { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); content-visibility: auto; contain-intrinsic-size: auto 170px; }
.input-head, .input-actions { display: flex; align-items: center; gap: 10px; padding: 9px 13px; color: var(--muted); font-size: 12px; }
.input-head { border-bottom: 1px solid var(--line); }
.observation-count { margin-left: auto; color: var(--warn); }
.input-body { padding: 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.65; }
.input-actions { justify-content: flex-end; border-top: 1px solid var(--line); }
.text-action { min-height: 32px; padding: 0 9px; border: 0; background: transparent; color: var(--accent); font-size: 12px; }
.load-inputs { display: block; margin: 0 auto 40px; padding: 0 16px; }
.empty { padding: 56px 16px; text-align: center; color: var(--muted); }

.inspector { position: fixed; z-index: 8; top: 0; right: 0; width: min(390px, 100%); height: 100dvh; overflow: auto; border-left: 1px solid var(--line); background: var(--sidebar); box-shadow: -18px 0 48px #0008; }
.inspector header, dialog header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.inspector h2, dialog h2 { margin: 0; font-size: 17px; }
.icon-button { width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 22px; }
.inspection { padding: 18px; }
.inspection dl { margin: 0; }
.inspection dt { margin-top: 13px; color: var(--muted); font-size: 11px; }
.inspection dd { margin: 2px 0; overflow-wrap: anywhere; }
.evidence-button { width: 100%; margin-top: 10px; padding: 7px 10px; color: var(--accent); text-align: left; }
dialog { width: min(880px, calc(100% - 32px)); max-height: 85dvh; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #020617bb; }
dialog pre { max-height: 65dvh; margin: 0; padding: 16px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.65 var(--mono); }
.notice { position: fixed; z-index: 12; bottom: 18px; left: 50%; transform: translateX(-50%); margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised); box-shadow: 0 10px 30px #0008; }
.skip { position: fixed; z-index: 20; top: -80px; left: 10px; padding: 9px; background: var(--accent); color: var(--accent-ink); }
.skip:focus { top: 10px; }

@media (max-width: 1280px) {
  .app { grid-template-columns: 230px 290px minmax(0, 1fr); }
  .filters { grid-template-columns: 2fr 1fr 1fr; }
}
@media (max-width: 720px) {
  html, body { font-size: 16px; }
  .app { display: block; }
  .sidebar, .session-sidebar { position: static; height: 100dvh; border-right: 0; }
  .session-sidebar, .workspace { display: none; }
  .app.has-user .sidebar { display: none; }
  .app.has-user .session-sidebar { display: flex; }
  .app.has-session .session-sidebar { display: none; }
  .app.has-session .workspace { display: block; }
  .back-button { display: inline-block; }
  .filters { position: static; grid-template-columns: 1fr 1fr; }
  .filters label:first-child { grid-column: 1 / -1; }
  .filters button { grid-column: 1 / -1; }
  .input-list { padding-inline: 14px; }
  button, input { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
