:root {
  --page: oklch(98.7% 0.003 150);
  --surface: oklch(100% 0 0);
  --surface-tint: oklch(96.8% 0.006 150);
  --surface-hover: oklch(95.3% 0.01 150);
  --line: oklch(90.5% 0.006 150);
  --line-strong: oklch(83% 0.01 150);
  --text: oklch(20% 0.015 150);
  --text-soft: oklch(48% 0.015 150);
  --text-faint: oklch(50% 0.012 150);
  --accent: oklch(43% 0.105 155);
  --accent-hover: oklch(37% 0.105 155);
  --accent-tint: oklch(43% 0.105 155 / 0.09);
  --danger: oklch(50% 0.17 25);
  --focus: oklch(49% 0.12 155 / 0.35);
  --radius-input: 6px;
  --radius-card: 10px;
  --radius-panel: 14px;
  --shadow-card: 0 0 0 1px oklch(0% 0 0 / 0.035), 0 2px 5px oklch(0% 0 0 / 0.05), 0 12px 30px oklch(0% 0 0 / 0.045);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--page); font: 14px/1.5 var(--font); }
button, input { font: inherit; }
button, a { touch-action: manipulation; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 20; left: 16px; top: -60px; padding: 9px 12px; color: white; background: var(--accent); border-radius: var(--radius-input); }
.skip-link:focus { top: 12px; }

.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 24px; background: color-mix(in oklch, var(--surface) 88%, transparent); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 31px; height: 31px; fill: var(--accent-tint); stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand > div { display: grid; line-height: 1.15; }
.brand-name { font-weight: 680; letter-spacing: -0.015em; }
.brand-context { margin-top: 4px; color: var(--text-faint); font-size: 12px; }
.session-actions { display: flex; align-items: center; gap: 12px; }
.session-state { color: var(--text-soft); font-size: 13px; }
.session-state::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--line-strong); }
.session-state.unlocked::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }

.button, .icon-button { min-height: 44px; border: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.button { padding: 0 16px; border-radius: var(--radius-input); font-weight: 620; transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, transform 80ms ease; }
.button:active, .icon-button:active { transform: scale(.98); }
.button-primary { color: white; background: var(--accent); box-shadow: 0 1px 2px oklch(0% 0 0 / .12); }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { color: var(--accent); background: var(--accent-tint); border: 1px solid color-mix(in oklch, var(--accent) 20%, var(--line)); }
.button-secondary:hover { background: color-mix(in oklch, var(--accent-tint) 74%, var(--accent) 8%); }
.button-quiet { min-height: 36px; padding-inline: 11px; color: var(--text-soft); background: transparent; }
.button-quiet:hover { color: var(--text); background: var(--surface-hover); }
.icon-button { width: 44px; color: var(--text-soft); background: transparent; border-radius: var(--radius-input); transition: color 120ms ease, background-color 120ms ease, transform 80ms ease; }
.icon-button:hover { color: var(--text); background: var(--surface-hover); }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button:disabled { cursor: wait; opacity: .65; }

.unlock-shell { display: grid; place-items: center; min-height: calc(100vh - 64px); padding: 32px 20px 64px; }
.unlock-panel { width: min(840px, 100%); display: grid; grid-template-columns: minmax(250px, .85fr) minmax(320px, 1.15fr); overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); box-shadow: var(--shadow-card); }
.unlock-copy { padding: 42px; background: var(--surface-tint); border-right: 1px solid var(--line); }
.lock-motif { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 34px; color: var(--accent); background: var(--accent-tint); border-radius: var(--radius-panel); }
.lock-motif svg { width: 46px; height: 46px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.unlock-copy h1 { margin: 0; font-size: clamp(26px, 3vw, 34px); line-height: 1.08; letter-spacing: -.03em; text-wrap: balance; }
.unlock-copy p { max-width: 34ch; margin: 17px 0 0; color: var(--text-soft); }
.unlock-form { align-self: center; padding: 42px; }
.unlock-form label { display: block; margin-bottom: 8px; font-weight: 630; }
.password-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.password-row input { width: 100%; min-width: 0; height: 44px; padding: 0 12px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-input); }
.password-row input:hover { border-color: var(--text-faint); }
.password-row input[aria-invalid="true"] { border-color: var(--danger); }
.field-hint, .field-error { margin: 9px 0 0; font-size: 12.5px; }
.field-hint { color: var(--text-faint); }
.field-error { min-height: 19px; color: var(--danger); }
.trust-note { position: absolute; align-self: end; margin-bottom: 24px; color: var(--text-faint); font-size: 12px; }

.browser-shell { min-height: calc(100vh - 64px); display: grid; grid-template-columns: 286px minmax(0, 1fr); }
.sidebar { padding: 20px 16px; background: var(--surface-tint); border-right: 1px solid var(--line); }
.mode-tabs { display: grid; gap: 4px; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.mode-tab { min-height: 54px; display: grid; justify-items: start; align-content: center; padding: 7px 10px; color: var(--text-soft); text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--radius-card); cursor: pointer; }
.mode-tab:hover { color: var(--text); background: color-mix(in oklch, var(--surface) 68%, transparent); }
.mode-tab.active { color: var(--text); background: var(--surface); border-color: var(--line); box-shadow: 0 1px 2px oklch(0% 0 0 / .045); }
.mode-tab span { font-weight: 680; }
.mode-tab small { margin-top: 2px; color: var(--text-faint); font: 11px/1.3 var(--mono); }
.sidebar-section-label { margin: 0 0 8px 10px; color: var(--text-faint); font-size: 12px; font-weight: 650; }
.repository-tabs { display: grid; gap: 3px; }
.repo-tab { min-height: 52px; display: grid; grid-template-columns: 8px minmax(0, 1fr); align-items: center; gap: 10px; padding: 7px 10px; color: var(--text-soft); text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--radius-card); cursor: pointer; }
.repo-tab:hover { background: color-mix(in oklch, var(--surface) 68%, transparent); }
.repo-tab[aria-selected="true"] { color: var(--text); background: var(--surface); border-color: var(--line); box-shadow: 0 1px 2px oklch(0% 0 0 / .045); }
.repo-status { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.repo-tab[aria-selected="true"] .repo-status { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.repo-copy { min-width: 0; display: grid; line-height: 1.25; }
.repo-label { overflow: hidden; color: inherit; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.repo-meta { margin-top: 3px; overflow: hidden; color: var(--text-faint); font: 11px/1.2 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 8px 10px; }
.sidebar-heading h2 { margin: 0; font-size: 13px; font-weight: 650; color: var(--text-soft); }
.snapshot-list { display: grid; gap: 3px; }
.snapshot-item { width: 100%; min-height: 62px; padding: 9px 10px; text-align: left; color: var(--text); background: transparent; border: 1px solid transparent; border-radius: var(--radius-card); cursor: pointer; }
.snapshot-item:hover { background: color-mix(in oklch, var(--surface) 65%, transparent); }
.snapshot-item[aria-current="true"] { background: var(--accent-tint); border-color: color-mix(in oklch, var(--accent) 18%, var(--line)); }
.snapshot-date { display: block; font-weight: 650; font-variant-numeric: tabular-nums; }
.snapshot-meta { display: flex; gap: 7px; margin-top: 3px; color: var(--text-faint); font: 12px/1.4 var(--mono); }
.sidebar-message { padding: 14px 10px; color: var(--text-soft); font-size: 13px; }

.workspace { min-width: 0; padding: 26px 28px 48px; }
.section-heading { min-height: 60px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading h1 { margin: 0; font-size: 25px; line-height: 1.15; letter-spacing: -.025em; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font: 650 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.section-lead { max-width: 76ch; margin: 8px 0 22px; color: var(--text-soft); }
.document-layout { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); gap: 16px; min-height: 560px; }
.document-list, .document-reader, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: 0 1px 2px oklch(0% 0 0 / .025); }
.document-list { align-self: start; display: grid; gap: 2px; padding: 7px; }
.document-item { min-height: 56px; display: grid; align-content: center; padding: 8px 10px; color: var(--text-soft); text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--radius-input); cursor: pointer; }
.document-item:hover { background: var(--surface-tint); }
.document-item.active { color: var(--text); background: var(--accent-tint); border-color: color-mix(in oklch, var(--accent) 18%, var(--line)); }
.document-item span { font-weight: 650; overflow-wrap: anywhere; }
.document-item small { margin-top: 3px; color: var(--text-faint); font: 11px/1.3 var(--mono); }
.document-reader { min-width: 0; overflow: hidden; }
.document-reader-head { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.document-reader h2 { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.document-reader pre { min-height: 480px; max-height: calc(100vh - 260px); margin: 0; padding: 20px; overflow: auto; color: var(--text); background: color-mix(in oklch, var(--surface-tint) 55%, var(--surface)); font: 12.5px/1.62 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.panel { padding: 20px; }
.panel h2 { margin: 0; font-size: 16px; }
.panel > p, .panel-heading p { margin: 7px 0 0; color: var(--text-soft); }
.wide-button { width: 100%; margin-top: 16px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.token-reveal { margin-top: 18px; padding: 14px; background: var(--accent-tint); border: 1px solid color-mix(in oklch, var(--accent) 20%, var(--line)); border-radius: var(--radius-input); }
.token-reveal label { display: block; margin-bottom: 8px; font-weight: 650; }
.copy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.copy-row input { min-width: 0; height: 44px; padding: 0 11px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-input); font: 12px/1 var(--mono); }
.token-list { display: grid; gap: 6px; margin-top: 18px; }
.token-item { min-height: 54px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 8px 10px; background: var(--surface-tint); border-radius: var(--radius-input); }
.token-item strong { display: block; font: 650 12px/1.3 var(--mono); }
.token-item small { color: var(--text-faint); }
.token-item button { min-height: 36px; padding: 0 10px; color: var(--danger); background: transparent; border: 0; border-radius: var(--radius-input); cursor: pointer; }
.token-item button:hover { background: color-mix(in oklch, var(--danger) 7%, var(--surface)); }
.command-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-top: 16px; padding: 10px; background: oklch(23% .018 150); border-radius: var(--radius-input); }
.command-box code { min-width: 0; overflow: auto; color: oklch(92% .02 150); font: 12px/1.5 var(--mono); white-space: nowrap; }
.example-code { margin: 12px 0 0; padding: 14px; overflow: auto; color: var(--text); background: var(--surface-tint); border: 1px solid var(--line); border-radius: var(--radius-input); font: 12px/1.65 var(--mono); }
.panel-links { display: flex; gap: 18px; }
.panel-links a { color: var(--accent); text-underline-offset: 3px; }
.agent-guide { margin-top: 16px; }
.agent-guide .section-heading { min-height: 48px; }
.access-methods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.access-methods > div { padding: 14px; background: var(--surface-tint); border: 1px solid var(--line); border-radius: var(--radius-input); }
.access-methods h3, .prompt-heading h3 { margin: 0; font-size: 14px; }
.access-methods ol { margin: 10px 0 0; padding-left: 20px; color: var(--text-soft); }
.access-methods li + li { margin-top: 6px; }
.access-methods p { margin: 10px 0 0; color: var(--text-faint); font-size: 12.5px; }
.access-methods code { font: 12px/1.4 var(--mono); overflow-wrap: anywhere; }
.prompt-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-top: 20px; }
.prompt-heading p { margin: 4px 0 0; color: var(--text-faint); }
.prompt-template { width: 100%; min-height: 330px; margin-top: 10px; padding: 14px; resize: vertical; color: var(--text); background: color-mix(in oklch, var(--surface-tint) 55%, var(--surface)); border: 1px solid var(--line-strong); border-radius: var(--radius-input); font: 12.5px/1.6 var(--mono); }
.compact-prompt { min-height: 240px; }
.copy-status { min-height: 22px; color: var(--accent); }
.workspace-header { min-height: 66px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.context-line { margin: 0 0 5px; color: var(--text-faint); font: 12px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-height: 32px; }
.crumb { min-height: 32px; padding: 0 5px; color: var(--text-soft); background: transparent; border: 0; border-radius: 4px; cursor: pointer; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.crumb:hover { color: var(--accent); background: var(--accent-tint); }
.crumb-separator { color: var(--line-strong); font-size: 18px; }
.notice { margin: 8px 0 14px; padding: 10px 12px; color: var(--text-soft); background: var(--surface-tint); border: 1px solid var(--line); border-radius: var(--radius-input); }
.notice.error { color: var(--danger); background: color-mix(in oklch, var(--danger) 6%, var(--surface)); border-color: color-mix(in oklch, var(--danger) 20%, var(--line)); }
.table-wrap { position: relative; min-height: 280px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: 0 1px 2px oklch(0% 0 0 / .025); }
.file-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.file-table th { height: 42px; padding: 0 14px; color: var(--text-faint); background: var(--surface-tint); border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; font-weight: 620; }
.file-table th:nth-child(1) { width: auto; }
.file-table th:nth-child(2) { width: 185px; }
.file-table th:nth-child(3) { width: 115px; }
.file-table th:nth-child(4) { width: 72px; }
.file-table td { height: 48px; padding: 0 14px; border-bottom: 1px solid color-mix(in oklch, var(--line) 70%, transparent); vertical-align: middle; }
.file-table tr:last-child td { border-bottom: 0; }
.file-table tbody tr:hover { background: color-mix(in oklch, var(--surface-tint) 70%, transparent); }
.numeric { text-align: right !important; font-variant-numeric: tabular-nums; }
.file-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-name svg { flex: 0 0 auto; width: 19px; height: 19px; fill: none; stroke: var(--text-faint); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.file-link { min-width: 0; padding: 4px 0; overflow: hidden; color: var(--text); background: transparent; border: 0; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; text-align: left; }
.file-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.file-detail { color: var(--text-faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.download-link { width: 40px; height: 40px; display: grid; place-items: center; margin-left: auto; color: var(--text-soft); border-radius: var(--radius-input); }
.download-link:hover { color: var(--accent); background: var(--accent-tint); }
.download-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty-state { min-height: 280px; display: grid; place-content: center; justify-items: center; color: var(--text-faint); }
.empty-state svg { width: 42px; height: 42px; fill: var(--surface-tint); stroke: var(--line-strong); stroke-width: 1.6; stroke-linejoin: round; }
.loading-row { color: var(--text-faint); }

@media (max-width: 820px) {
  .topbar { padding-inline: 16px; }
  .brand-context, .session-state { display: none; }
  .unlock-panel { grid-template-columns: 1fr; max-width: 520px; }
  .unlock-copy { padding: 30px; border-right: 0; border-bottom: 1px solid var(--line); }
  .lock-motif { width: 52px; height: 52px; margin-bottom: 22px; }
  .unlock-form { padding: 30px; }
  .browser-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .repository-tabs { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .snapshot-list { grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); }
  .workspace { padding: 20px 16px 36px; }
  .document-layout, .agent-grid, .access-methods { grid-template-columns: 1fr; }
  .document-reader pre { max-height: none; }
  .file-table th:nth-child(2), .file-table td:nth-child(2) { display: none; }
}

@media (max-width: 520px) {
  .password-row { grid-template-columns: 1fr; }
  .workspace-header { align-items: stretch; flex-direction: column; gap: 10px; }
  .workspace-header .button { align-self: flex-start; }
  .file-table th:nth-child(3), .file-table td:nth-child(3) { display: none; }
  .file-table th:nth-child(4) { width: 58px; }
  .crumb { font-size: 17px; }
  .panel-heading, .prompt-heading, .copy-row, .command-box { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
