:root {
  color-scheme: dark;
  --background: #15181e;
  --sidebar: #11141a;
  --surface: #1d222b;
  --raised: #252c37;
  --field: #171b22;
  --line: #333d4c;
  --text: #e5eaf2;
  --muted: #a0adbf;
  --blue: #2563eb;
  --blue-hover: #3474f5;
  --blue-subtle: #1b2c47;
  --blue-text: #97bfff;
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, .button { cursor: pointer; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 36px; padding: 7px 13px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--raised); color: var(--text); font-weight: 550;
}
button:hover, .button:hover { background: #303a49; }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
input, textarea, select {
  width: 100%; padding: 8px 11px; min-height: 37px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--field); color: var(--text);
}
input::placeholder, textarea::placeholder { color: #8491a4; opacity: 1; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid #76a7ff; outline-offset: 2px;
}
textarea { resize: vertical; line-height: 1.65; }
label { display: block; font-weight: 550; font-size: 12px; margin: 0 0 6px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0 0 5px; font-size: 25px; line-height: 1.3; letter-spacing: -.6px; font-weight: 650; }
h2 { margin: 0; font-size: 14px; line-height: 1.5; font-weight: 600; }
h3 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.5; }
.muted, .field-hint { color: var(--muted); }
.muted { line-height: 1.65; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 208px; display: flex; flex-direction: column;
  padding: 22px 14px; background: var(--sidebar); border-right: 1px solid #2a323f;
}
.brand { display: inline-block; font-size: 25px; line-height: 1.2; letter-spacing: -1px; font-weight: 700; }
.brand span { color: #6fa6ff; }
.sidebar > .brand { margin: 0 10px 28px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { display: block; padding: 9px 11px; color: var(--muted); border: 1px solid transparent; border-radius: 6px; font-size: 12px; }
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item.active { color: #b9d3ff; background: var(--blue-subtle); border-color: #2a4164; }
.sidebar-bottom { margin-top: auto; padding: 18px 10px 0; border-top: 1px solid #2a323f; }
.private-label { display: block; color: #96a4b8; font-size: 11px; }
.quiet { min-height: 30px; margin-top: 7px; padding: 3px 0; background: none; border: 0; color: var(--muted); font-size: 12px; }
.quiet:hover { background: none; color: var(--text); }
main { margin-left: 208px; width: calc(100% - 208px); max-width: 1600px; padding: 28px 32px; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 22px; }
.page-header .muted { margin: 0; font-size: 13px; }
.page-header .button { white-space: nowrap; }
.search { display: flex; gap: 7px; margin: 0 0 22px; }
.search input { min-width: 0; }
.search button { padding-right: 18px; padding-left: 18px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 11px; }
.section-heading > span { font-size: 11px; }
.note-grid { display: grid; gap: 8px; }
.note-card {
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
  padding: 13px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface);
}
.note-card:hover { border-color: #59739b; background: #222934; }
.note-content { min-width: 0; }
.note-card h3 { color: #edf2fb; }
.excerpt {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--muted); font-size: 12px; line-height: 1.6; margin: 4px 0 8px; white-space: normal;
}
.card-details { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 11px; }
.product { color: var(--blue-text); }
.card-date { color: #98a5b8; }
.tags { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.tags span { padding: 3px 7px; border: 1px solid #3b4657; border-radius: 4px; background: #282f3a; font-size: 10px; color: #bec8d7; }
.tags .shared { background: var(--blue-subtle); border-color: #314f7a; color: #b5d0ff; }
.empty-state { padding: 36px 20px; background: var(--surface); border: 1px dashed #435067; border-radius: 8px; text-align: center; }
.empty-state h2 { font-size: 16px; }
.empty-state p { margin: 9px 0 18px; color: var(--muted); font-size: 13px; }
.empty-state > a:not(.button) { color: var(--blue-text); text-decoration: underline; }
.back { display: inline-block; margin-bottom: 13px; font-size: 12px; color: var(--muted); }
.back:hover { color: var(--text); }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 248px; gap: 20px; }
.editor-main { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.editor-main > input { margin-bottom: 19px; }
.editor-main p { font-size: 13px; }
.required { margin-left: 5px; color: var(--muted); font-size: 10px; font-weight: 400; }
.field-hint { margin: 0 0 9px; font-size: 11px; line-height: 1.6; }
.editor-meta > input, .editor-meta > select { margin-bottom: 17px; }
.editor-meta > button { width: 100%; margin-bottom: 11px; }
.sharing-box { padding: 12px; margin: 1px 0 16px; border: 1px solid #314a6e; border-radius: 6px; background: #1c293d; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; }
.checkbox input { width: 15px; height: 15px; min-height: 0; margin: 0; flex-shrink: 0; accent-color: var(--blue); }
.sharing-box .field-hint { margin: 0; }
.connections-heading { margin-top: 24px; }
.connection-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 10px; }
.connection-row .muted { margin-bottom: 0; }
.editor-main code { display: inline-block; max-width: 100%; padding: 7px 10px; background: var(--field); border: 1px solid var(--line); border-radius: 5px; color: #a9c9ff; overflow-wrap: anywhere; }
.login-layout { width: 100%; max-width: 390px; margin: 38px auto; }
.login-layout > .brand { margin-bottom: 25px; }
.login-layout h1 { margin-bottom: 7px; }
.login-layout .intro { margin: 0; font-size: 13px; }
.login-card { padding: 20px; margin-top: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.login-card button { width: 100%; margin-top: 12px; }
.login-card .muted { font-size: 13px; }
.eyebrow { margin: 0 0 12px; color: var(--blue-text); font-size: 10px; letter-spacing: 1.1px; font-weight: 600; }
.connecting .sidebar, .sign-in .sidebar { display: none; }
.connecting main, .sign-in main { width: 100%; margin: 0; padding: 24px; }
.connecting .login-layout { max-width: 420px; margin: 12px auto; }
.connecting h1 { font-size: 23px; }
.connecting .login-card { margin-top: 17px; }
.sign-in .login-layout { margin-top: min(12vh, 100px); }
.error { margin-bottom: 18px; padding: 10px 13px; border: 1px solid #865649; border-radius: 6px; background: #362725; color: #ffd0c1; font-size: 13px; }
.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: 1050px) {
  .sidebar { width: 184px; padding-right: 10px; padding-left: 10px; }
  main { margin-left: 184px; width: calc(100% - 184px); padding: 24px; }
  .editor { grid-template-columns: minmax(0, 1fr) 224px; gap: 16px; }
}
@media (max-width: 820px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .note-card { gap: 14px; }
  .tags { max-width: 150px; }
}
@media (max-width: 600px) {
  .sidebar { position: static; width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 13px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar > .brand { margin: 0; align-self: center; font-size: 22px; }
  .sidebar nav { display: flex; grid-column: 1 / -1; grid-row: 2; gap: 6px; }
  .nav-item { padding: 7px 10px; font-size: 11px; }
  .sidebar-bottom { grid-column: 2; grid-row: 1; margin: 0; padding: 0; border: 0; }
  .private-label { display: none; }
  .quiet { margin: 0; }
  main { width: 100%; margin: 0; padding: 20px 16px; }
  h1 { font-size: 22px; }
  .page-header { gap: 12px; margin-bottom: 18px; align-items: flex-start; }
  .page-header .button { padding: 7px 9px; font-size: 11px; }
  .page-header .muted { font-size: 12px; }
  .section-heading > span { font-size: 10px; }
  .note-card { align-items: flex-start; flex-direction: column; gap: 9px; padding: 13px; }
  .tags { flex-direction: row; flex-wrap: wrap; align-items: flex-start; max-width: none; }
  .editor-main { padding: 14px; }
  .connection-row { align-items: flex-start; flex-direction: column; gap: 12px; }
  .connecting main, .sign-in main { padding: 20px; }
}

.search select { width: 165px; flex-shrink: 0; }
.pagination { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.notice { padding: 11px 14px; margin-bottom: 18px; background: var(--blue-subtle); border: 1px solid #314f7a; border-radius: 6px; color: #c4d8f7; font-size: 12px; }
.notice a, .job-status a { color: var(--blue-text); text-decoration: underline; }
.job-status { margin-top: 15px; }
.workflow-panel { margin-top: 16px; }
.workflow-panel pre { padding: 12px; border-radius: 6px; background: var(--field); font: 12px/1.7 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.proposal-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.proposal-content { min-width: 0; }
.proposal-content .excerpt { margin-bottom: 0; }
.proposal-actions { display: flex; gap: 8px; flex-shrink: 0; }
button:disabled { opacity: .6; cursor: wait; }
@media(max-width:600px) {
  .sidebar nav { overflow-x: auto; white-space: nowrap; }
  .nav-item { flex-shrink: 0; }
  .search { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .search select { width: 100%; grid-column: 1 / -1; grid-row: 2; }
  .proposal-row { align-items: flex-start; flex-direction: column; }
}

/* Keep two knowledge filters compact on narrow screens. */
@media (max-width: 720px) {
  .search select { grid-row: auto; }
}
