/* Product surfaces share the terminal's colors; long-form editing uses native UI text. */
:root {
  --ui-font: 'Sen', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
}

.workspace-shortcuts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 32px; max-width: 780px; }
.workspace-shortcuts button { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 0; color: var(--muted); font-size: .8125rem; }
.workspace-shortcuts button:hover { color: var(--primary); }
.workspace-shortcuts code { color: var(--primary); font: 600 .8125rem/1.5 var(--mono); }
.workspace-shortcuts button:first-child { color: var(--primary); }
.profile-heading { margin-bottom: 12px; font-size: 1.25rem; font-weight: 600; }
.island-menu a:last-child { grid-column: auto; }
.input-row:has(input:focus-visible) { border-bottom: 2px solid var(--primary); }

.page-view.workspace-view { max-width: 1200px; padding-top: 128px; font-family: var(--ui-font); font-size: 1rem; }
.workspace-header { display: flex; gap: 24px; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.workspace-view h1 { font-family: var(--ui-font); font-size: 1.75rem; line-height: 1.3; letter-spacing: -.02em; margin: 0 0 8px; }
.workspace-subtitle { color: var(--muted); font-size: .875rem; line-height: 1.7; }
.connection-state { flex-shrink: 0; min-height: 44px; display: inline-flex; align-items: center; color: var(--subtle); text-decoration: none; font-size: .8125rem; }
.connection-state[data-ready='true'] { color: var(--primary); }
.connection-state:hover { text-decoration: underline; text-underline-offset: 4px; }
.workspace-tabs { display: flex; gap: 28px; align-items: center; border-bottom: 1px solid var(--line-focus); margin-bottom: 32px; }
.workspace-tabs a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 0 12px; color: var(--muted); text-decoration: none; font-size: .875rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.workspace-tabs a[aria-current='page'] { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.workspace-tabs a:hover { color: var(--primary); }
.workspace-view input, .workspace-view textarea, .workspace-view select, .workspace-view button { font-family: var(--ui-font); }
.workspace-view select { color: var(--foreground); }
.workspace-view option { color: var(--foreground); background: var(--background); }
.ws-input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-focus); border-radius: 6px; color: var(--foreground); background: var(--background); font: 1rem/1.5 var(--ui-font); }
.ws-input::placeholder { color: var(--subtle); opacity: 1; }
.ws-input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.field-label { display: block; margin-bottom: 8px; color: var(--foreground); font-size: .8125rem; font-weight: 600; }
.ws-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line-focus); border-radius: 6px; color: var(--foreground); background: var(--background); font-size: .875rem; line-height: 1.5; white-space: nowrap; }
.ws-button:hover { color: var(--primary); border-color: var(--primary); background: var(--soft); }
.ws-button.primary { color: var(--background); background: var(--primary); border-color: var(--primary); }
.ws-button.primary:hover { opacity: .88; }
.ws-button.compact { padding-inline: 12px; font-size: .8125rem; }
.ws-button:disabled:hover { color: var(--subtle); background: var(--background); border-color: var(--line-focus); }
.notes-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 490px; }
.note-sidebar { padding-right: 24px; border-right: 1px solid var(--line-focus); min-width: 0; }
.notes-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
#note-count { color: var(--subtle); font-size: .75rem; font-variant-numeric: tabular-nums; }
.note-list { display: grid; align-content: start; gap: 4px; margin: 20px -8px 16px; max-height: 480px; overflow-y: auto; }
.note-item { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; padding: 12px 8px; min-height: 84px; border-radius: 6px; text-align: left; color: var(--foreground); }
.note-item:hover, .note-item[aria-current='true'] { background: var(--soft); }
.note-item[aria-current='true'] strong { color: var(--primary); }
.note-item strong { font-size: .875rem; line-height: 1.6; font-weight: 600; overflow-wrap: anywhere; }
.note-excerpt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: .8125rem; line-height: 1.65; overflow-wrap: anywhere; }
.note-date { font: .6875rem/1.5 var(--mono); color: var(--subtle); }
.list-empty { padding: 16px 8px; font-size: .875rem; line-height: 1.8; color: var(--subtle); overflow-wrap: anywhere; }
.note-tools { display: flex; flex-wrap: wrap; gap: 8px 20px; border-top: 1px solid var(--line); padding-top: 8px; }
.note-tools button { min-height: 44px; padding: 0; font-size: .75rem; color: var(--subtle); }
.note-tools button:hover { color: var(--primary); }
.note-editor { display: flex; flex-direction: column; min-width: 0; padding-left: 32px; }
.editor-heading { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; align-items: baseline; }
.editor-shortcut { color: var(--subtle); font-size: .6875rem; }
.note-title-input { width: 100%; min-height: 48px; min-width: 0; border: 0; border-radius: 4px; color: var(--foreground); background: transparent; padding: 8px 0; margin: 0 0 12px; font: 600 1.25rem/1.5 var(--ui-font); }
.note-title-input::placeholder, .note-body-input::placeholder { color: var(--subtle); opacity: 1; }
.note-body-input { flex: 1; width: 100%; min-width: 0; min-height: 350px; padding: 4px 0; border: 0; border-radius: 4px; background: transparent; color: var(--foreground); resize: vertical; font: 1rem/1.9 var(--ui-font); }
.editor-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 20px; }
.workspace-notice { color: var(--subtle); font-size: .8125rem; line-height: 1.6; min-height: 21px; max-width: 65ch; }
.workspace-notice.is-error, .is-error { color: var(--error); }
.note-results { display: grid; gap: 4px; max-width: 650px; margin-top: 8px; }
.note-result { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; padding: 12px 8px; margin-left: -8px; text-align: left; border-radius: 6px; min-height: 60px; width: min(100%, 650px); }
.note-result:hover { background: var(--soft); }
.note-result strong { color: var(--primary); font-size: .875rem; font-weight: 600; overflow-wrap: anywhere; }
.note-result .note-excerpt { grid-row: 2; }
.note-result .note-date { grid-column: 2; grid-row: 1; }
.note-saved-message { color: var(--primary); font-size: .8125rem; }
.ask-form, .settings-form { width: 100%; max-width: 760px; }
.question-input { min-height: 156px; resize: vertical; line-height: 1.8; }
.ask-options { display: flex; gap: 24px; align-items: end; justify-content: space-between; margin-top: 24px; }
.ask-options > div { min-width: 0; flex: 1; max-width: 440px; }
.form-hint { color: var(--subtle); font-size: .75rem; line-height: 1.8; margin-top: 8px; }
.answer-output { max-width: 760px; margin-top: 32px; }
.answer-output:empty { display: none; }
.answer-meta { margin-bottom: 12px; font: .75rem/1.6 var(--mono); color: var(--primary); overflow-wrap: anywhere; }
.ai-answer { max-width: 72ch; white-space: pre-wrap; overflow-wrap: anywhere; font: 1rem/1.9 var(--ui-font); color: var(--foreground); }
.ai-loading { font-size: .875rem; color: var(--subtle); margin-bottom: 16px; animation: thinking 1600ms ease-in-out infinite; }
.answer-copy { margin-top: 20px; }
.last-question { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line-focus); color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.settings-form { max-width: 600px; display: grid; gap: 24px; }
.setup-guidance { font-size: .875rem; line-height: 1.9; color: var(--muted); }
.settings-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.settings-actions + .form-hint { margin-top: -16px; }

@keyframes thinking { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }

@media (max-width: 1023px) {
  .notes-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .note-sidebar { padding-right: 20px; }
  .note-editor { padding-left: 24px; }
  .editor-shortcut { display: none; }
}
@media (max-width: 767px) {
  .page-view.workspace-view { padding: 96px 16px 64px; }
  .workspace-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
  .workspace-view h1 { font-size: 1.5rem; }
  .connection-state { min-height: 36px; }
  .workspace-tabs { gap: 24px; margin-bottom: 24px; }
  .notes-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .note-sidebar { padding-right: 0; padding-bottom: 16px; border-right: 0; border-bottom: 1px solid var(--line-focus); }
  .note-list { max-height: 200px; margin-top: 12px; margin-bottom: 8px; }
  .note-editor { padding-left: 0; }
  .notes-toolbar { margin-bottom: 12px; }
  .note-body-input { min-height: 300px; }
  .ask-options { flex-direction: column; align-items: stretch; gap: 16px; }
  .ask-options > div { max-width: none; }
  .workspace-shortcuts { gap: 4px 20px; margin-top: 24px; }
  .editor-footer { align-items: flex-start; }
  .note-result { grid-template-columns: minmax(0, 1fr); }
  .note-result .note-date { grid-column: 1; grid-row: 3; }
}
@media (prefers-reduced-motion: reduce) { .ai-loading { animation: none; } }
