:root {
  color-scheme: light;
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --violet-600: #7c3aed;
  --violet-100: #ede9fe;
  --cyan-100: #cffafe;
  --ink: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --canvas: #f7f9fd;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --shadow: 0 18px 50px rgba(30, 64, 175, 0.08);
  --radius: 22px;
  --sidebar: 244px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: radial-gradient(circle at 80% 0, rgba(219, 234, 254, .7), transparent 29rem), var(--canvas); }
.environment-banner { position: fixed; inset: 0 0 auto; padding: 5px 12px; color: #fff; background: #b45309; font-size: 11px; font-weight: 850; letter-spacing: .11em; text-align: center; text-transform: uppercase; z-index: 100; }
.environment-banner + .app-shell .sidebar { top: 25px; }
.environment-banner + .app-shell .main-content { padding-top: 71px; }
.login-body:has(.environment-banner) { padding-top: 25px; }
button, input, textarea, select { font: inherit; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(59, 130, 246, .35); outline-offset: 2px; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 28px 20px; display: flex; flex-direction: column; background: rgba(255,255,255,.88); border-right: 1px solid rgba(226,232,240,.8); backdrop-filter: blur(18px); z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 12px; }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: white; background: linear-gradient(135deg, var(--blue-600), var(--violet-600)); font-size: 13px; font-weight: 800; box-shadow: 0 8px 20px rgba(37,99,235,.25); }
.brand-mark.large { width: 54px; height: 54px; border-radius: 18px; font-size: 16px; }
.main-nav { display: grid; gap: 7px; margin-top: 46px; }
.nav-link { padding: 12px 14px; border-radius: 13px; color: #475569; font-weight: 650; transition: .18s ease; }
.nav-link:hover { background: var(--blue-50); color: var(--blue-700); }
.nav-link.active { color: var(--blue-700); background: linear-gradient(110deg, var(--blue-100), rgba(237,233,254,.65)); }
.nav-more summary { list-style: none; cursor: pointer; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: "›"; float: right; transform: rotate(90deg); transition: transform .15s ease; }
.nav-more[open] summary::after { transform: rotate(-90deg); }
.nav-more-links { margin: 5px 0 0 10px; padding-left: 8px; display: grid; gap: 3px; border-left: 1px solid var(--line); }
.nav-more-links .nav-link { padding: 9px 11px; font-size: 13px; }
.logout-form { margin-top: auto; }
.main-content { margin-left: var(--sidebar); min-height: 100vh; padding: 46px clamp(28px, 5vw, 76px) 80px; }
.main-content > * { max-width: 1180px; margin-left: auto; margin-right: auto; }
.main-content, .capture-grid > *, .admin-grid > * { min-width: 0; }
.mobile-header, .mobile-nav { display: none; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header h1 { margin: 2px 0 7px; font-size: clamp(32px, 4vw, 48px); line-height: 1.05; letter-spacing: -.045em; }
.page-header p:not(.eyebrow) { max-width: 660px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.6; }
.eyebrow { margin: 0 0 5px; color: var(--blue-600); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.hero-header { margin-bottom: 22px; }
.content-card, .quick-card { background: rgba(255,255,255,.94); border: 1px solid rgba(226,232,240,.9); border-radius: var(--radius); box-shadow: var(--shadow); }
.content-card { padding: clamp(20px, 3vw, 32px); }
.quick-card { padding: 12px; margin-bottom: 24px; }
.quick-form textarea { width: 100%; min-height: 86px; padding: 14px 16px 8px; resize: vertical; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 17px; line-height: 1.55; }
.quick-actions { display: flex; justify-content: space-between; align-items: center; padding: 6px 6px 3px 14px; }
.input-hint { color: #94a3b8; font-size: 12px; }

.button { min-height: 43px; padding: 10px 17px; border: 1px solid transparent; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-weight: 750; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: linear-gradient(135deg, var(--blue-600), var(--blue-700)); box-shadow: 0 8px 22px rgba(37,99,235,.2); }
.button-primary:hover { color: white; box-shadow: 0 12px 28px rgba(37,99,235,.27); }
.button-secondary { color: var(--blue-700); border-color: var(--blue-100); background: white; }
.button-secondary:hover { background: var(--blue-50); }
.button-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button-danger { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); }
.button-small { min-height: 36px; padding: 7px 12px; border-radius: 10px; font-size: 13px; }
.button-large { min-height: 52px; font-size: 16px; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button-row, .recording-controls { display: flex; gap: 10px; flex-wrap: wrap; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.section-heading a { font-size: 14px; font-weight: 700; }
.note-card { min-height: 330px; }
.markdown-body { color: #27364a; font-family: ui-serif, Georgia, serif; font-size: 17px; line-height: 1.78; overflow-wrap: anywhere; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { color: var(--ink); font-family: Inter, ui-sans-serif, sans-serif; letter-spacing: -.03em; }
.markdown-body h1 { font-size: 30px; }
.markdown-body h2 { margin-top: 1.7em; padding-bottom: .35em; border-bottom: 1px solid var(--line); font-size: 22px; }
.markdown-body pre { overflow: auto; padding: 18px; border-radius: 14px; color: #e2e8f0; background: #111827; }
.markdown-body code { padding: 2px 6px; border-radius: 6px; color: #4338ca; background: var(--violet-100); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; }
.markdown-body pre code { padding: 0; color: inherit; background: transparent; }
.markdown-body blockquote { margin-left: 0; padding-left: 18px; border-left: 3px solid var(--blue-500); color: #475569; }
.note-image { max-width: 100%; max-height: 720px; border-radius: 16px; box-shadow: 0 10px 35px rgba(15,23,42,.12); }
.note-pdf { width: 100%; height: min(72vh, 840px); border: 1px solid var(--line); border-radius: 14px; }
.markdown-body audio { width: min(100%, 620px); }
.path-label { font-family: ui-monospace, monospace; font-size: 13px !important; }

.empty-state { min-height: 230px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.empty-state h3 { margin: 9px 0 3px; color: var(--ink); }
.empty-state p { margin: 0; }
.empty-state.compact { min-height: 110px; }
.empty-mark { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; color: var(--blue-600); background: var(--blue-50); font-size: 25px; }

.capture-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.capture-card { display: grid; align-content: start; gap: 18px; }
.capture-card.featured { border-color: #bfdbfe; background: linear-gradient(155deg, white 65%, #eff6ff); }
.capture-card h2 { margin: 0 0 5px; font-size: 22px; }
.capture-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.capture-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-weight: 850; }
.capture-icon.blue { color: var(--blue-700); background: var(--blue-100); }
.capture-icon.violet { color: var(--violet-600); background: var(--violet-100); }
.capture-icon.cyan { color: #0e7490; background: var(--cyan-100); }
.capture-icon.ink { color: white; background: var(--ink); font-size: 11px; }
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; color: #334155; font-size: 13px; font-weight: 750; }
.field span small { color: #94a3b8; font-weight: 500; }
.field input, .field textarea, .field select, .filter-bar select { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: white; transition: border .15s, box-shadow .15s; }
.field input[type="file"] { padding: 7px; color: var(--muted); font-size: 13px; }
.field input[type="file"]::file-selector-button { margin-right: 10px; padding: 7px 11px; border: 0; border-radius: 8px; color: var(--blue-700); background: var(--blue-50); cursor: pointer; font-weight: 750; }
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus, .filter-bar select:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59,130,246,.12); outline: 0; }
.drop-field { min-height: 108px; padding: 18px; display: grid; place-items: center; border: 1.5px dashed #bfdbfe; border-radius: 16px; color: var(--blue-700); background: var(--blue-50); cursor: pointer; text-align: center; }
.drop-field input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-field span { display: grid; gap: 5px; }
.drop-field small { color: var(--muted); font-weight: 500; }
.recorder { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fbfdff; }
.recorder-state { margin-bottom: 12px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.record-dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; }
.recorder.recording .record-dot { background: #ef4444; animation: pulse 1.1s infinite; }
.recorder.recording [data-recorder-label] { color: var(--danger); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(239,68,68,.12); } }
.voice-wave { height: 46px; margin-bottom: 10px; padding: 7px 3px; display: flex; align-items: center; justify-content: center; gap: 4px; overflow: hidden; }
.voice-wave span { width: 4px; height: 30px; border-radius: 999px; background: linear-gradient(180deg, var(--violet-600), var(--blue-500)); transform: scaleY(.18); transition: transform 80ms linear; transform-origin: center; }
.recorder.recording .voice-wave span:nth-child(3n+1) { animation: fake-wave .72s ease-in-out infinite alternate; }
.recorder.recording .voice-wave span:nth-child(3n+2) { animation: fake-wave .94s .12s ease-in-out infinite alternate-reverse; }
.recorder.recording .voice-wave span:nth-child(3n) { animation: fake-wave .58s .2s ease-in-out infinite alternate; }
@keyframes fake-wave { from { transform: scaleY(.25); } to { transform: scaleY(.92); } }
.recording-preview { width: 100%; margin: 0 0 12px; }
.record-stop { width: 44px; min-height: 43px; padding: 0; display: inline-grid; place-items: center; border: 1px solid #fecaca; border-radius: 13px; cursor: pointer; background: var(--danger-soft); }
.record-stop:hover { background: #fee2e2; }
.record-stop:disabled { opacity: .45; cursor: not-allowed; }
.record-stop > span:first-child { width: 12px; height: 12px; border-radius: 2px; background: var(--danger); }
.file-selection { min-height: 64px; padding: 10px 12px; display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: center; gap: 12px; border: 1px solid #bfdbfe; border-radius: 13px; background: var(--blue-50); }
.file-selection[hidden] { display: none; }
.file-selection img { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; }
.file-selection > span:not(.file-selection-icon) { min-width: 0; display: grid; gap: 3px; }
.file-selection strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-selection small { color: var(--muted); }
.file-selection-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 9px; color: var(--blue-700); background: white; font-size: 11px; font-weight: 850; }
.confirm-dialog { width: min(calc(100% - 32px), 460px); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 24px 80px rgba(15,23,42,.28); }
.confirm-dialog::backdrop { background: rgba(15,23,42,.48); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 24px; }
.confirm-dialog h3 { margin: 0 0 8px; font-size: 21px; }
.confirm-dialog p { margin: 0 0 20px; color: var(--muted); line-height: 1.55; }
.toast-region { position: fixed; top: 24px; right: 24px; z-index: 100; width: min(390px, calc(100vw - 32px)); display: grid; gap: 10px; pointer-events: none; }
.toast-region > * { pointer-events: auto; }
.status-card { padding: 16px 18px; display: flex; align-items: flex-start; gap: 12px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 18px 45px rgba(15,23,42,.13); }
.capture-toast { animation: toast-in .18s ease-out both; }
.capture-toast.is-leaving { animation: toast-out .18s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) translateX(10px); } to { opacity: 1; transform: translateY(0) translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px) translateX(10px); } }
.status-indicator { width: 11px; height: 11px; margin-top: 5px; flex: 0 0 auto; border-radius: 50%; background: #94a3b8; }
.status-pending .status-indicator, .status-running .status-indicator { background: var(--blue-500); animation: pulse 1.2s infinite; }
.status-succeeded .status-indicator { background: var(--success); }
.status-failed .status-indicator { background: var(--danger); }
.status-blocked .status-indicator { background: var(--warning); }
.status-copy { display: grid; gap: 3px; }
.status-copy span { color: var(--muted); font-size: 14px; }
.status-copy a { margin-top: 4px; font-size: 13px; font-weight: 750; }
.alert { padding: 14px 16px; display: grid; gap: 3px; border-radius: 13px; font-size: 14px; }
.alert-error { color: #991b1b; border: 1px solid #fecaca; background: var(--danger-soft); }

.segmented { padding: 4px; display: flex; gap: 3px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.segmented a { padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 750; }
.segmented a.active { color: var(--blue-700); background: var(--blue-50); }
.tree-card { padding: 12px; }
.vault-tree, .tree-children { display: grid; }
.tree-folder { min-width: 0; }
.tree-folder summary, .tree-file { min-height: 46px; padding: 7px 12px; display: grid; grid-template-columns: 18px 26px minmax(0, 1fr) auto; align-items: center; gap: 7px; border-radius: 10px; color: #334155; cursor: pointer; list-style: none; }
.tree-folder summary::-webkit-details-marker { display: none; }
.tree-folder summary:hover, .tree-file:hover { color: var(--blue-700); background: var(--blue-50); }
.tree-folder summary { font-weight: 780; }
.tree-folder summary small, .tree-file small { color: #94a3b8; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.tree-chevron { color: #94a3b8; font-size: 22px; line-height: 1; transition: transform .16s ease; }
.tree-folder[open] > summary .tree-chevron { transform: rotate(90deg); }
.tree-children { margin-left: 18px; padding-left: 8px; border-left: 1px solid var(--line); }
.tree-file { grid-template-columns: 18px minmax(0, 1fr) auto; }
.tree-file > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-icon { width: 24px; color: var(--blue-600); font-size: 12px; font-weight: 850; text-align: center; }

.quick-capture-body { min-height: 100vh; padding: 0; background: radial-gradient(circle at 50% -15rem, var(--blue-100), transparent 35rem), var(--canvas); }
.quick-capture-shell { width: min(100% - 32px, 680px); margin: 0 auto; padding: 22px 0 48px; }
.quick-capture-header { display: flex; align-items: center; justify-content: space-between; }
.quick-capture-header > a:last-child { font-size: 13px; font-weight: 750; }
.quick-intro { margin: clamp(60px, 12vh, 115px) 0 26px; text-align: center; }
.quick-intro h1 { margin: 4px 0 8px; font-size: clamp(36px, 8vw, 54px); letter-spacing: -.05em; }
.quick-intro > p:last-child { margin: 0; color: var(--muted); }
.quick-mode-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.quick-mode-buttons[hidden], .quick-panel[hidden] { display: none; }
.quick-mode { min-height: 180px; border: 1px solid var(--line); border-radius: 25px; display: grid; place-items: center; align-content: center; gap: 13px; cursor: pointer; background: rgba(255,255,255,.94); box-shadow: var(--shadow); color: var(--ink); }
.quick-mode span { width: 62px; height: 62px; border-radius: 20px; display: grid; place-items: center; color: var(--blue-700); background: var(--blue-100); font-size: 18px; font-weight: 850; }
.quick-mode.voice span { color: var(--violet-600); background: var(--violet-100); }
.quick-mode strong { font-size: 19px; }
.quick-panel { padding: clamp(20px, 5vw, 30px); border: 1px solid var(--line); border-radius: 25px; background: white; box-shadow: var(--shadow); }
.quick-panel h2 { margin: 10px 0 22px; font-size: 27px; letter-spacing: -.035em; }
.quick-back { padding: 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-weight: 700; }
.quick-minimal-form { display: grid; gap: 14px; }
.quick-minimal-form textarea { min-height: 190px; padding: 0; border: 0; outline: 0; resize: vertical; color: var(--ink); font-size: 20px; line-height: 1.55; }
.quick-result { margin-top: 14px; }

.danger-card { margin-bottom: 18px; border-color: #fecaca; }
.compact-callout { margin-bottom: 18px; }
.dirty-paths { max-height: 300px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.dirty-paths li { padding: 10px 2px; display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.dirty-paths li:last-child { border: 0; }
.dirty-paths span { color: var(--muted); white-space: nowrap; }
.diff-view { max-height: 520px; margin: 0; padding: 18px; overflow: auto; border-radius: 14px; color: #dbeafe; background: #111827; font-size: 12px; line-height: 1.55; }
.resolution-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.resolution-card { display: grid; align-content: start; gap: 12px; }
.resolution-card.recommended { border-color: #bfdbfe; background: linear-gradient(155deg, white 70%, var(--blue-50)); }
.resolution-card h2, .resolution-card p { margin: 0; }
.resolution-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.resolution-card form { margin-top: auto; padding-top: 14px; }
.warning-text { color: var(--warning); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { min-height: 145px; padding: 20px; display: flex; flex-direction: column; color: var(--ink); border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: var(--shadow); }
.metric-card:hover { color: var(--ink); border-color: #bfdbfe; transform: translateY(-2px); }
.metric-card span, .metric-card small { color: var(--muted); }
.metric-card strong { margin: auto 0 2px; font-size: 35px; letter-spacing: -.04em; }
.metric-card strong.metric-code { font-size: 17px; }
.metric-code { overflow-wrap: anywhere; }
.metric-danger { color: var(--danger); }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .8fr); gap: 18px; }
.action-row { padding: 15px 2px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--ink); border-bottom: 1px solid var(--line); }
.action-row:last-child { border-bottom: 0; }
.action-row span { display: grid; gap: 4px; }
.action-row small { color: var(--muted); }
.action-row b { color: var(--blue-600); }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 9px 11px; color: #94a3b8; font-size: 11px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 13px 11px; border-top: 1px solid var(--line); }
.data-table td:first-child { display: grid; gap: 2px; }
.data-table td small { color: #94a3b8; font-size: 11px; }
.badge { width: fit-content; padding: 5px 8px; border-radius: 999px; color: #475569; background: #f1f5f9; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.badge.large { padding: 8px 13px; font-size: 12px; }
.badge-succeeded, .badge-ok { color: #047857; background: var(--success-soft); }
.badge-failed, .badge-error { color: #b91c1c; background: var(--danger-soft); }
.badge-blocked, .badge-conflict { color: #b45309; background: var(--warning-soft); }
.badge-pending, .badge-running { color: var(--blue-700); background: var(--blue-50); }
.filter-bar { margin-bottom: 20px; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filter-bar label { min-width: 180px; display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.detail-card { display: grid; gap: 24px; }
.detail-list { margin: 0; display: grid; }
.detail-list > div { padding: 13px 0; display: grid; grid-template-columns: minmax(120px, .35fr) 1fr; gap: 18px; border-bottom: 1px solid var(--line); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.detail-list code { color: #4338ca; }
.callout { padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid #c7d2fe; border-radius: 16px; background: #eef2ff; }
.callout p { margin: 5px 0 0; color: #475569; line-height: 1.45; }
.manual-retry-callout { border-color: #fecaca; background: var(--danger-soft); }
.status-poll { padding: 12px; color: var(--muted); text-align: center; }
.spinner { width: 13px; height: 13px; display: inline-block; vertical-align: -2px; border: 2px solid #bfdbfe; border-top-color: var(--blue-600); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; min-height: 72px; padding: 2px 140px 20px 28px; border-left: 1px solid var(--line); }
.timeline li:last-child { border-left-color: transparent; }
.timeline-dot { position: absolute; left: -6px; top: 2px; width: 11px; height: 11px; border: 3px solid white; border-radius: 50%; background: var(--blue-500); box-shadow: 0 0 0 1px var(--blue-500); }
.event-warning .timeline-dot { background: var(--warning); box-shadow: 0 0 0 1px var(--warning); }
.event-error .timeline-dot { background: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.timeline p { margin: 4px 0; color: var(--muted); font-size: 13px; }
.timeline small { color: #94a3b8; }
.timeline time { position: absolute; top: 0; right: 0; color: #94a3b8; font-size: 12px; }
.sync-state { min-height: 180px; display: grid; place-items: center; align-content: center; gap: 7px; text-align: center; }
.sync-state strong { color: var(--blue-700); font-size: 25px; }.sync-state span { color: var(--muted); }.sync-state code { color: #64748b; }
.api-list { display: grid; }
.api-row { min-height: 66px; display: grid; grid-template-columns: 60px minmax(240px,.8fr) 1fr auto; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.method { padding: 5px 7px; border-radius: 7px; color: var(--blue-700); background: var(--blue-50); font: 800 11px ui-monospace, monospace; text-align: center; }
.method-post { color: var(--violet-600); background: var(--violet-100); }
.api-row p { color: var(--muted); }
.api-note { margin-top: 22px; }

.ai-search-header { align-items: center; }
.ai-search-header-actions { display: flex; align-items: center; gap: 9px; }
.ai-search-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; align-items: start; gap: 18px; }
.ai-chat-card { min-height: 650px; padding: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
.ai-chat-messages { min-height: 480px; max-height: calc(100vh - 270px); padding: 26px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; scroll-behavior: smooth; }
.ai-chat-empty { min-height: 430px; }
.ai-chat-empty h2 { margin: 0 0 7px; color: var(--ink); }
.ai-message { width: min(88%, 720px); padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; background: #f8fafc; overflow-wrap: anywhere; }
.ai-message-user { margin-left: auto; border-color: #bfdbfe; border-radius: 18px 18px 6px; background: var(--blue-50); }
.ai-message-label { margin: 0 0 7px; color: var(--blue-600); font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.ai-message > p:last-child, .ai-user-copy { margin: 0; line-height: 1.58; white-space: pre-wrap; }
.ai-answer { font-family: inherit; font-size: 15px; line-height: 1.65; white-space: pre-wrap; }
.ai-answer > :first-child { margin-top: 0; }
.ai-answer > :last-child { margin-bottom: 0; }
.ai-source-list { margin: 15px 0 0; padding: 13px 0 0 24px; display: grid; gap: 8px; border-top: 1px solid var(--line); }
.ai-source-list li { padding-left: 3px; color: var(--blue-600); }
.ai-source-list a { display: grid; gap: 2px; overflow-wrap: anywhere; }
.ai-source-list strong { color: #334155; font-size: 13px; }
.ai-source-list span { color: var(--muted); font-size: 11px; }
.ai-message-failed { border-color: #fecaca; background: var(--danger-soft); }
.ai-message-cancelled { color: var(--muted); background: #f8fafc; }
.ai-thinking { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; }
.ai-thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--blue-500); animation: ai-thinking 1s infinite ease-in-out; }
.ai-thinking span:nth-child(2) { animation-delay: .15s; }
.ai-thinking span:nth-child(3) { margin-right: 5px; animation-delay: .3s; }
.agent-worklog { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.agent-worklog ol { max-height: 150px; margin: 0; padding-left: 20px; display: grid; gap: 5px; overflow-y: auto; color: var(--muted); font-size: 12px; line-height: 1.45; }
@keyframes ai-thinking { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
.ai-chat-form { padding: 17px; display: grid; gap: 9px; border-top: 1px solid var(--line); background: white; }
.ai-chat-form label { color: #334155; font-size: 12px; font-weight: 780; }
.ai-chat-form textarea { width: 100%; min-height: 84px; padding: 13px 15px; resize: vertical; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fbfdff; line-height: 1.5; }
.ai-chat-form textarea:focus { outline: 0; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.ai-chat-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.ai-chat-form-footer small { color: #94a3b8; font-size: 11px; line-height: 1.4; }
.ai-search-settings { position: sticky; top: 28px; display: grid; gap: 22px; }
.ai-search-settings h2 { margin: 0 0 8px; font-size: 22px; }
.ai-search-settings .muted { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.ai-search-settings form { display: grid; gap: 9px; }
.ai-search-settings label { color: #334155; font-size: 12px; font-weight: 750; }
.ai-search-settings select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: white; }
.ai-search-settings small { color: #94a3b8; font-size: 11px; line-height: 1.45; }
.history-toolbar, .history-actions { margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 9px; }
.history-actions { margin-top: 14px; justify-content: space-between; }
.history-list { padding: 0; overflow: hidden; }
.history-row { padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.history-row span { min-width: 0; display: grid; gap: 4px; }
.history-row strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.history-row small, .history-row time { color: var(--muted); font-size: 12px; }
.history-row:hover { background: var(--blue-50); }
.history-conversation { display: grid; gap: 18px; }
.history-conversation .ai-message { max-width: 780px; }
.toggle-row { display: flex; align-items: center; gap: 9px; color: #334155; font-size: 13px; font-weight: 700; }
.toggle-row input { width: 17px; height: 17px; accent-color: var(--blue-600); }
.file-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.markdown-editor-card form { display: grid; gap: 12px; }
.markdown-editor-card label { color: #334155; font-size: 13px; font-weight: 750; }
.markdown-editor-card textarea { width: 100%; min-height: 62vh; padding: 16px; resize: vertical; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fbfdff; font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; }
.markdown-editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.markdown-editor-actions small { color: var(--muted); }

.login-body { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 0, #dbeafe, transparent 32rem), radial-gradient(circle at 100% 100%, #ede9fe, transparent 35rem), #f8fafc; }
.login-card { width: min(100%, 470px); padding: clamp(28px, 6vw, 48px); border: 1px solid rgba(255,255,255,.8); border-radius: 30px; background: rgba(255,255,255,.9); box-shadow: 0 30px 90px rgba(30,64,175,.15); backdrop-filter: blur(20px); }
.login-brand { margin-bottom: 42px; }
.login-copy { margin-bottom: 26px; }
.login-copy h1 { margin: 4px 0 10px; font-size: 37px; letter-spacing: -.045em; }
.login-copy p:not(.eyebrow), .login-note { color: var(--muted); line-height: 1.6; }
.login-note { margin: 22px 0 0; font-size: 12px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .ai-search-layout { grid-template-columns: 1fr; }
  .ai-search-settings { position: static; grid-template-columns: 1fr 1fr; align-items: end; }
}

@media (max-width: 760px) {
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); background: var(--canvas); }
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 0 16px 36px; }
  .environment-banner + .app-shell .main-content { padding-top: 25px; }
  .mobile-header { position: sticky; top: 0; max-width: none; margin: 0 -16px 24px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.9); border-bottom: 1px solid rgba(226,232,240,.8); backdrop-filter: blur(16px); z-index: 30; }
  .brand.compact { gap: 8px; font-size: 14px; }.brand.compact .brand-mark { width: 34px; height: 34px; border-radius: 11px; font-size: 10px; }
  .mobile-nav { position: fixed; inset: auto 0 0; min-height: 63px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5,1fr); gap: 4px; background: rgba(255,255,255,.94); border-top: 1px solid var(--line); backdrop-filter: blur(18px); z-index: 40; }
  .mobile-nav a, .mobile-more summary { padding: 9px 4px; border-radius: 10px; color: var(--muted); font-size: 11px; font-weight: 750; text-align: center; list-style: none; cursor: pointer; }
  .mobile-nav a.active, .mobile-more summary.active { color: var(--blue-700); background: var(--blue-50); }
  .mobile-more summary::-webkit-details-marker { display: none; }
  .mobile-more-menu { position: absolute; right: 10px; bottom: calc(58px + env(safe-area-inset-bottom)); width: min(220px, calc(100vw - 20px)); padding: 8px; display: grid; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: var(--shadow); }
  .mobile-more-menu a { padding: 12px 14px; text-align: left; }
  .page-header { align-items: flex-start; margin-bottom: 20px; }
  .page-header h1 { font-size: 34px; }.page-header p:not(.eyebrow) { font-size: 14px; }
  .desktop-only { display: none; }
  .content-card { padding: 20px; border-radius: 18px; }
  .quick-card { border-radius: 18px; }
  .input-hint { display: none; }.quick-actions { justify-content: flex-end; }
  .capture-grid { grid-template-columns: 1fr; }
  .capture-card { gap: 15px; }
  .toast-region { top: calc(12px + env(safe-area-inset-top)); right: 16px; }
  .segmented { align-self: flex-start; }
  .file-heading { display: grid; }
  .markdown-editor-actions { align-items: stretch; flex-direction: column; }
  .tree-folder summary, .tree-file { padding-left: 8px; }.tree-folder summary small, .tree-file small { display: none; }.tree-children { margin-left: 10px; padding-left: 3px; }
  .quick-capture-shell { padding-top: calc(14px + env(safe-area-inset-top)); }
  .quick-intro { margin-top: 56px; }
  .quick-mode { min-height: 155px; }
  .resolution-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2,1fr); gap: 10px; }
  .metric-card { min-height: 125px; padding: 15px; }.metric-card strong { font-size: 30px; }
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }.filter-bar label { min-width: 0; }.filter-bar button { grid-column: 1 / -1; }
  .data-table th:nth-child(2), .data-table td:nth-child(2), .data-table th:nth-child(4), .data-table td:nth-child(4) { display: none; }
  .detail-list > div { grid-template-columns: 1fr; gap: 5px; }
  .callout { align-items: stretch; flex-direction: column; }
  .timeline li { padding-right: 0; padding-bottom: 32px; }.timeline time { position: static; display: block; margin-top: 5px; }
  .api-row { padding: 14px 0; grid-template-columns: 60px 1fr; }.api-row p { grid-column: 1/-1; margin: 0; }.api-row .button { grid-column: 1/-1; }
  .ai-search-header { align-items: flex-start; flex-direction: column; }
  .ai-search-layout { margin-left: -4px; margin-right: -4px; }
  .ai-chat-card { min-height: calc(100vh - 190px); }
  .ai-chat-messages { min-height: 370px; max-height: none; padding: 16px; }
  .ai-message { width: 94%; padding: 14px; }
  .ai-chat-form-footer { align-items: stretch; flex-direction: column; }
  .ai-chat-form-footer .button { width: 100%; }
  .ai-search-settings { grid-template-columns: 1fr; }
  .login-card { border-radius: 24px; }.login-copy h1 { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
