﻿:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --panel: #ffffff;
  --ink: #202720;
  --muted: #667064;
  --line: #d8ded5;
  --brand: #1f766b;
  --brand-strong: #155c54;
  --soft: #e8efe9;
  --warn: #ad4e37;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.email-center {
  --email-ink: #17191f;
  --email-muted: #6f747c;
  --email-soft: #f4f5f7;
  --email-card: #ffffff;
  --email-line: #e6e8ec;
  --email-line-strong: #cfd3da;
  --email-accent: #111827;
  --email-accent-soft: #eef0f4;
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  gap: 16px;
  min-height: calc(100vh - 150px);
  color: var(--email-ink);
}

.email-account-panel,
.email-inbox-panel,
.email-detail-panel {
  min-width: 0;
  border: 1px solid var(--email-line);
  border-radius: 10px;
  background: var(--email-card);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.email-account-panel,
.email-inbox-panel {
  padding: 18px;
  height: calc(100vh - 112px);
  overflow: hidden;
}

.email-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.email-back-btn {
  min-height: 40px;
  padding: 0 16px;
  border-color: var(--email-accent);
  background: var(--email-accent);
  color: #fff;
  font-weight: 800;
  white-space: nowrap;
}

.email-add-toggle {
  width: 100%;
  min-height: 40px;
  margin: 14px 0 0;
  border: 1px solid var(--email-line);
  border-radius: 8px;
  background: #fff;
  color: var(--email-ink);
  cursor: pointer;
  font-weight: 800;
}

.email-add-toggle:hover {
  border-color: var(--email-line-strong);
  background: #fbfbfc;
}

.email-content-grid.detail-open {
  grid-template-columns: 1fr;
}

.email-content-grid.detail-open .email-message-list {
  display: none;
}

.email-content-grid:not(.detail-open) .email-detail-panel {
  display: none;
}

.email-account-panel {
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  overscroll-behavior: contain;
}

.email-panel-head,
.email-toolbar,
.email-message-line,
.email-account-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.email-panel-head {
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--email-line);
}

.email-panel-head .primary {
  min-width: 88px;
  min-height: 36px;
  padding: 0 12px;
  line-height: 1.15;
  white-space: nowrap;
}

.email-panel-head h3,
.email-toolbar h3,
.email-detail-head h3 {
  margin: 0;
  color: var(--email-ink);
  font-size: 18px;
  line-height: 1.25;
}

.email-panel-head p,
.email-toolbar span,
.email-account-card p,
.email-account-card small,
.email-message-row p,
.email-message-row small,
.email-detail-head p {
  color: var(--email-muted);
}

.email-panel-head p,
.email-detail-head p {
  margin: 6px 0 0;
  line-height: 1.45;
}

.email-account-form {
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.email-account-form .field {
  gap: 6px;
  color: #535862;
  font-size: 12px;
  font-weight: 700;
}

.email-account-form input:not([type="checkbox"]),
.email-filters select,
.email-filters input[type="search"] {
  min-height: 36px;
  border-color: var(--email-line);
  background: #fff;
  padding: 8px 10px;
}

.email-account-form input:not([type="checkbox"]):focus,
.email-filters select:focus,
.email-filters input[type="search"]:focus {
  border-color: var(--email-accent);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.email-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
}

.email-checkbox-row,
.email-unread-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.email-checkbox-row {
  width: fit-content;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--email-line);
  border-radius: 8px;
  background: #fff;
  color: #3d424b;
  font-size: 13px;
  font-weight: 700;
}

.email-checkbox-row input,
.email-unread-filter input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--email-accent);
}

.email-account-form .secondary {
  min-height: 38px;
  border-color: var(--email-accent);
  background: var(--email-accent);
  color: #fff;
}

.email-account-list {
  display: grid;
  gap: 8px;
  padding-bottom: 4px;
}

.email-account-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: start;
  gap: 10px;
  border: 1px solid var(--email-line);
  border-radius: 10px;
  background: #fff;
  padding: 12px 10px 12px 12px;
}

.email-account-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.email-account-card strong {
  display: block;
  color: var(--email-ink);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.email-account-card p {
  margin: 0;
  overflow-wrap: anywhere;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.35;
}

.email-account-card small {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  line-height: 1.35;
  font-size: 12px;
}

.email-account-card .danger {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid #f0c8c0;
  border-radius: 8px;
  background: #fff5f3;
  color: #9f3e31;
}

.email-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, auto) minmax(0, 1fr);
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--email-line);
}

.email-toolbar span {
  display: inline-flex;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.email-filters {
  display: grid;
  grid-template-columns: minmax(150px, 200px) auto minmax(240px, 360px);
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.email-filters select {
  width: 160px;
}

.email-filters input[type="search"] {
  width: min(280px, 100%);
}

.email-unread-filter {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--email-line);
  border-radius: 6px;
  background: #fff;
  color: #3d424b;
  font-size: 13px;
  font-weight: 700;
}

.email-content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
  height: calc(100% - 100px);
  min-height: 0;
}

.email-content-grid.is-empty {
  grid-template-columns: 1fr;
}

.email-content-grid.is-empty .email-detail-panel {
  display: none;
}

.email-message-list {
  display: grid;
  align-content: start;
  gap: 0;
  height: 100%;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--email-line);
  border-radius: 10px;
  background: #fff;
  padding: 0;
}

.email-content-grid.is-empty .email-message-list {
  min-height: calc(100vh - 360px);
  place-items: center;
  padding-right: 0;
}

.email-empty-state {
  width: min(430px, 100%);
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--email-muted);
  text-align: center;
}

.email-empty-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--email-line);
  border-radius: 12px;
  background: var(--email-accent-soft);
  color: var(--email-accent);
  font-size: 21px;
  line-height: 1;
}

.email-empty-state strong {
  color: var(--email-ink);
  font-size: 18px;
}

.email-empty-state p {
  max-width: 360px;
  margin: 0;
  line-height: 1.65;
}

.email-message-row {
  min-width: 0;
  overflow: visible;
  display: grid;
  gap: 6px;
  border: 0;
  border-bottom: 1px solid var(--email-line);
  border-radius: 0;
  padding: 14px 18px 13px;
  cursor: pointer;
  background: #fff;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.email-message-row:last-child {
  border-bottom: 0;
}

.email-message-row:hover,
.email-message-row.active {
  background: #fbfbfc;
}

.email-message-row.active {
  box-shadow: inset 4px 0 var(--email-accent);
}

.email-message-row.unread .email-message-sender::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 999px;
  background: #4f46e5;
}

.email-message-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.email-message-row h4 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  margin: 0;
  color: var(--email-ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.email-message-row p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin: 0;
  color: var(--email-muted);
  line-height: 1.4;
}

.email-message-line {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  color: var(--email-muted);
  font-size: 12px;
}

.email-message-sender {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #6b7280;
  font-size: 12.5px;
  font-weight: 800;
}

.email-message-line time {
  flex: 0 0 auto;
  color: #6b7280;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.email-message-account {
  min-width: 0;
  overflow: hidden;
  color: #7b818b;
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-detail-panel {
  padding: 18px;
  height: 100%;
  overflow: auto;
}

.email-detail-meta {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--email-line);
  border-radius: 10px;
  background: var(--email-soft);
}

.email-detail-meta div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
}

.email-detail-meta dt {
  color: var(--email-muted);
}

.email-detail-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.email-detail-body {
  overflow: visible;
  border: 1px solid var(--email-line);
  border-radius: 10px;
  background: #fff;
  padding: 16px;
  line-height: 1.65;
}

.email-detail-body * {
  max-width: 100%;
}

.email-detail-body table {
  width: 100% !important;
}

.email-detail-body img {
  max-width: 100%;
  height: auto;
}

.email-detail-body pre {
  white-space: pre-wrap;
  font-family: inherit;
}

.email-attachments {
  margin-top: 14px;
}

.email-attachments h4 {
  margin: 0;
}

.email-attachments ul {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 8px 0 0;
  list-style: none;
}

.email-attachments li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--email-line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

@media (max-width: 980px) {
  .email-center,
  .email-content-grid {
    grid-template-columns: 1fr;
  }

  .email-toolbar {
    align-items: flex-start;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .email-filters {
    width: 100%;
    grid-template-columns: 1fr;
    justify-content: flex-start;
  }

  .email-filters select,
  .email-filters input[type="search"] {
    width: 100%;
  }

  .email-message-list,
  .email-detail-body {
    max-height: none;
  }
}

/* Thought image preview lightbox: keep desktop image previews in-page. */
.thought-image {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}

.inbox-transfer-image {
  display: inline-block;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
  line-height: 0;
}

.thought-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.84);
  padding: 40px;
}

.thought-image-lightbox.hidden {
  display: none !important;
}

.thought-image-lightbox img {
  display: block;
  max-width: min(1120px, 94vw);
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.thought-image-lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

#videoView {
  min-height: calc(100vh - 112px);
  display: grid;
  gap: 16px;
  align-content: start;
}

.video-capability-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.video-capability-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #ebe5dc;
  border-radius: 16px;
  background: linear-gradient(180deg, #fffaf3 0%, #ffffff 100%);
  color: #211b15;
  box-shadow: 0 12px 28px rgba(40, 31, 20, 0.08);
}

.video-capability-index {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: #1a1a1c;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.video-capability-card h3 {
  font-size: 16px;
  line-height: 1.2;
}

.video-capability-card p {
  color: #786d63;
  font-size: 13px;
  line-height: 1.45;
}

.video-analyzer-frame-shell {
  min-height: calc(100vh - 112px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #13100c;
  box-shadow: 0 18px 48px rgba(40, 31, 20, 0.12);
}

.video-analyzer-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 280px);
  border: 0;
  background: #13100c;
}

@media (max-width: 1180px) {
  .video-capability-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  #videoView {
    padding: 12px;
  }

  .video-capability-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .video-analyzer-frame-shell,
  .video-analyzer-frame {
    min-height: calc(100dvh - var(--mobile-bottom-nav-total, 82px) - 260px);
  }
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
}

.auth-card h1 {
  font-size: 42px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
}

.sidebar {
  background: #1f2b25;
  color: #f9fbf7;
  padding: 22px 16px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 20px;
}

.brand h1 {
  font-size: 30px;
}

.brand p {
  margin-top: 6px;
  color: #b8c5ba;
  overflow-wrap: anywhere;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.nav {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #dfe8e1;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav.active,
.nav:hover {
  background: #314139;
  color: #ffffff;
}

.content {
  padding: 24px;
  overflow: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: 28px;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 18px 42px rgba(34, 44, 35, 0.07);
}

.panel-head,
.reader-head,
.subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.toolbar-actions button,
.subhead button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ede8dd;
  color: var(--ink);
  cursor: pointer;
  padding: 0 10px;
  font-weight: 700;
}

.panel-head span,
.subhead {
  color: var(--muted);
  font-size: 13px;
}

form,
.config-block {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea,
.search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  color: var(--ink);
  outline: none;
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 118, 107, 0.14);
}

.primary,
.secondary,
.danger,
.icon-btn {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.primary {
  min-height: 44px;
  background: var(--brand);
  color: white;
}

.primary:hover {
  background: var(--brand-strong);
}

.secondary {
  min-height: 36px;
  background: #ede8dd;
  color: var(--ink);
  padding: 0 12px;
}

.danger {
  min-height: 36px;
  background: #f6e5e0;
  color: #9d3f2e;
  padding: 0 12px;
}

.danger:hover {
  background: #efd4cc;
}

.icon-btn {
  width: 42px;
  height: 42px;
  background: #ede8dd;
  color: var(--ink);
  font-size: 22px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.workspace-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}

.workspace-create {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.workspace-list,
.workspace-files {
  display: grid;
  gap: 8px;
}

.workspace-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  color: var(--ink);
  text-align: left;
  padding: 10px;
  cursor: pointer;
}

.workspace-card.active,
.workspace-card:hover {
  border-color: var(--brand);
  background: #edf5f1;
}

.workspace-card strong,
.workspace-card small {
  display: block;
  overflow-wrap: anywhere;
}

.workspace-card small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.workspace-main {
  min-width: 0;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.25fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.workspace-meta,
.workspace-memory {
  min-width: 0;
}

.workspace-meta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-upload {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
}

.compact-dropzone {
  min-height: 112px;
}

.bound-head {
  margin: 16px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.workspace-file {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  padding: 10px;
}

.workspace-file label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: start;
  min-width: 0;
}

.workspace-file input {
  width: auto;
  margin-top: 3px;
}

.workspace-file strong,
.workspace-file small {
  display: block;
  overflow-wrap: anywhere;
}

.workspace-file small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 4px;
}

.workspace-chat-panel {
  min-height: 720px;
}

.chat-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.workspace-messages {
  height: 440px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  padding: 12px;
}

.workspace-message {
  max-width: 92%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 10px;
}

.workspace-message.user {
  justify-self: end;
  background: #edf5f1;
}

.workspace-message.assistant {
  justify-self: start;
}

.message-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.message-body {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.62;
  font-size: 13px;
}

.plain-content {
  white-space: pre-wrap;
}

.markdown-content {
  overflow-wrap: anywhere;
  line-height: 1.68;
}

.markdown-content > :first-child {
  margin-top: 0;
}

.markdown-content > :last-child {
  margin-bottom: 0;
}

.markdown-content h1 {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 750;
}

.markdown-content h2 {
  margin: 18px 0 8px;
  font-size: 17px;
  line-height: 1.45;
  font-weight: 720;
}

.markdown-content h3 {
  margin: 14px 0 6px;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 700;
}

.markdown-content p {
  margin: 0 0 10px;
}

.markdown-content ul,
.markdown-content ol {
  margin: 0 0 12px;
  padding-left: 1.5em;
}

.markdown-content li {
  margin: 4px 0;
  padding-left: 2px;
}

.markdown-content strong {
  font-weight: 740;
}

.markdown-content code {
  border-radius: 4px;
  background: #eef1ed;
  padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.markdown-content mark {
  border-radius: 3px;
  background: #fff2a8;
  padding: 0 2px;
}

.markdown-content hr {
  border: 0;
  border-top: 1px solid #e2e6df;
  margin: 18px 0;
}

.markdown-content pre {
  margin: 12px 0;
  overflow: auto;
  white-space: pre;
  border: 1px solid #e2e6df;
  border-radius: 6px;
  background: #f6f7f4;
  padding: 10px;
}

.markdown-content pre code {
  display: block;
  background: transparent;
  padding: 0;
}

.message-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e8edf3;
}

.message-files {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.message-files strong {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.message-files div {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.message-files span {
  max-width: 220px;
  overflow: hidden;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  padding: 4px 9px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 8px;
}

.message-actions .secondary {
  min-height: 32px;
  border-radius: 9px;
  padding: 0 12px;
  font-size: 13px;
}

.workspace-chat-form {
  margin-top: 12px;
  grid-template-columns: 1fr auto;
  align-items: stretch;
}

.workspace-chat-form textarea {
  min-height: 92px;
}

.workspace-chat-form button {
  width: 104px;
}

.memory-candidate {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.compact-list,
.file-list,
.todo-list,
.output-list,
.picked {
  display: grid;
  gap: 8px;
}

.compact-item,
.file-row,
.todo-item,
.output-item,
.file-item,
.picked-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  padding: 10px;
}

.compact-item {
  width: 100%;
  text-align: left;
  color: var(--ink);
}

button.compact-item {
  cursor: pointer;
}

button.compact-item:hover {
  border-color: var(--brand);
}

.compact-item small,
.file-row small,
.todo-item small,
.meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.split {
  display: grid;
  grid-template-columns: 0.9fr 1.3fr;
  gap: 16px;
  align-items: start;
}

.notes-shell {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.notes-sidebar,
.note-editor-panel {
  min-height: calc(100vh - 48px);
}

.notes-sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: stretch;
  gap: 12px;
}

.notes-list {
  overflow: auto;
  align-content: start;
}

.note-editor-panel {
  display: grid;
  align-content: start;
}

.analysis-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(0, 1.35fr);
  gap: 16px;
  align-items: start;
}

.config-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.dropzone {
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px dashed #9ca89f;
  border-radius: 8px;
  background: var(--soft);
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  padding: 18px;
}

.dropzone input {
  display: none;
}

.dropzone strong {
  color: var(--ink);
}

.dropzone em {
  display: inline-flex;
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff;
  color: var(--brand);
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
}

.dropzone.dragover {
  border-color: var(--brand);
  background: #dce9e4;
}

.file-row,
.todo-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.form-grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.note-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 6px 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
}

.note-toolbar button,
.note-toolbar select,
.note-color-tool {
  flex: 0 0 auto;
  min-height: 34px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0 10px;
  font-weight: 800;
  font-size: 18px;
}

.note-toolbar button:hover,
.note-toolbar select:hover,
.note-color-tool:hover {
  background: #ede8dd;
}

.note-toolbar select {
  max-width: 96px;
  appearance: none;
  font-size: 16px;
}

.toolbar-separator {
  flex: 0 0 1px;
  width: 1px;
  height: 24px;
  margin: 0 6px;
  background: #e6e3d8;
}

.note-color-tool {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.note-color-tool input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.note-editor {
  min-height: 560px;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  padding: 14px;
  color: var(--ink);
  outline: none;
}

.note-editor:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 118, 107, 0.14);
}

.note-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.note-editor blockquote {
  margin: 10px 0;
  border-left: 3px solid var(--brand);
  padding-left: 10px;
  color: var(--muted);
}

.note-item {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) auto;
}

.note-item.active {
  border-color: var(--brand);
  background: #edf5f1;
}

.note-open {
  display: grid;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  padding: 0;
}

.note-open strong {
  font-size: 15px;
  line-height: 1.35;
}

.note-open strong,
.note-open small,
.note-open span {
  overflow-wrap: anywhere;
}

.note-open small,
.note-open span {
  color: var(--muted);
  font-size: 12px;
}

.row-actions,
.reader-actions,
.button-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.button-row {
  justify-content: flex-end;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.file-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
}

.file-name,
.output-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.short {
  max-height: 280px;
  overflow: auto;
}

.browser-box {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.pathbar {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.pathbar span {
  min-height: 36px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.webdav-browser {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.browser-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  padding: 10px;
  color: var(--ink);
  text-align: left;
}

.browser-row.folder {
  cursor: pointer;
}

.browser-row span {
  color: var(--muted);
  font-size: 12px;
}

.browser-row strong {
  overflow-wrap: anywhere;
}

.browser-row small {
  grid-column: 3;
  color: var(--muted);
  font-size: 12px;
}

.reader {
  min-height: 680px;
}

#readerContent {
  min-height: 560px;
  max-height: 68vh;
  overflow: auto;
  overflow-wrap: anywhere;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  font-size: 14px;
}

.saved-path,
.state-line,
.empty-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 10px;
  overflow-wrap: anywhere;
}

.output-item {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.output-preview {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
  line-height: 1.5;
}

.check {
  color: var(--muted);
  font-size: 13px;
}

.check input {
  width: auto;
  margin-right: 6px;
}

.toast {
  color: var(--warn) !important;
}

.history-dialog {
  width: min(980px, calc(100vw - 40px));
  max-height: 86vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
}

.history-dialog::backdrop {
  background: rgba(20, 28, 23, 0.38);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-actions {
  display: flex;
  gap: 8px;
}

#dialogContent {
  margin: 0;
  padding: 18px;
  max-height: calc(70vh - 76px);
  overflow: auto;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.dialog-files {
  border-top: 1px solid var(--line);
  padding: 10px 18px 14px;
  color: var(--muted);
  font-size: 12px;
}

.dialog-files > span {
  display: block;
  margin-bottom: 6px;
}

#dialogFiles {
  display: grid;
  gap: 8px;
}

.dialog-file {
  padding: 2px 0;
}

.dialog-file strong,
.dialog-file small {
  display: block;
  overflow-wrap: anywhere;
}

.dialog-file small {
  color: var(--muted);
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .split,
  .analysis-layout,
  .config-cols,
  .workspace-layout,
  .workspace-grid,
  .notes-shell {
    grid-template-columns: 1fr;
  }

  .notes-sidebar,
  .note-editor-panel {
    min-height: auto;
  }

  .workspace-chat-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .content {
    padding: 16px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .file-row,
  .todo-item {
    grid-template-columns: 1fr;
  }

  .workspace-upload,
  .workspace-chat-form,
  .chat-controls,
  .workspace-file {
    grid-template-columns: 1fr;
  }

  .workspace-chat-form button {
    width: 100%;
  }
}

/* Knowledge base workbench */
.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
  background: #ffffff;
}

.sidebar {
  background: #f7f8f5;
  color: var(--ink);
  border-right: 1px solid #e7ebe4;
  padding: 24px 18px 18px;
  gap: 18px;
}

.brand h1 {
  font-size: 32px;
  letter-spacing: 0;
}

.brand p {
  color: #6d756c;
}

.kb-nav {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.kb-nav-head,
.sidebar-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kb-nav-head {
  color: #3d473f;
  font-size: 14px;
  font-weight: 800;
  margin-top: 2px;
}

.kb-nav-head .icon-btn {
  width: 30px;
  height: 30px;
  font-size: 18px;
  background: transparent;
}

.sidebar-bottom {
  display: grid;
  gap: 8px;
}

.sidebar .nav {
  color: #3e473f;
  background: transparent;
}

.sidebar .nav.active,
.sidebar .nav:hover {
  background: #e8f3e9;
  color: #16221b;
}

.sidebar .primary {
  min-height: 42px;
}

.sidebar .secondary {
  background: #eef0eb;
}

.content {
  padding: 0;
  background: #ffffff;
}

.topbar {
  display: none;
}

.kb-workbench {
  min-height: 100vh;
  background: #ffffff;
}

.kb-empty {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
}

#workspaceEmpty.hidden {
  display: none !important;
}

.kb-empty h3 {
  color: var(--ink);
  font-size: 22px;
}

.kb-detail {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(180px, 1fr) auto;
  padding: 28px 44px 24px;
}

.kb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
}

.kb-header h2 {
  font-size: 24px;
  line-height: 1.25;
}

.kb-header p {
  color: var(--muted);
  margin-top: 7px;
}

.kb-header-actions,
.kb-section-head,
.kb-chat-actions,
.file-card-actions,
.kb-composer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kb-header-actions {
  justify-content: flex-end;
}

.kb-file-section {
  min-width: 0;
  padding-bottom: 20px;
}

.kb-section-head {
  justify-content: space-between;
  padding-bottom: 14px;
}

.kb-section-head h3 {
  font-size: 18px;
}

.kb-section-head p,
.kb-section-head span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.kb-file-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workspace-file-search {
  width: min(220px, 34vw);
  min-width: 150px;
  min-height: 30px;
  padding: 6px 10px;
  font-size: 13px;
}

.kb-file-actions .secondary {
  min-height: 30px;
  border-radius: 7px;
  padding: 0 12px;
  font-size: 13px;
}

.kb-upload {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  max-width: 680px;
  margin-bottom: 18px;
}

.compact-dropzone {
  min-height: 76px;
  border-style: dashed;
  background: #fbfcfa;
}

.workspace-files {
  grid-template-columns: repeat(auto-fill, minmax(174px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.workspace-file-card {
  position: relative;
  min-height: 230px;
  display: grid;
  grid-template-rows: 104px 1fr auto;
  gap: 10px;
  border: 1px solid #e4e8e1;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  box-shadow: 0 12px 30px rgba(41, 52, 43, 0.06);
}

.file-thumb {
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #f3f5f1;
  color: #6c736a;
  font-size: 20px;
  font-weight: 900;
}

.file-thumb.pdf {
  color: #d33838;
}

.file-thumb.word {
  color: #2869bd;
}

.file-thumb.excel {
  color: #1c7a49;
}

.file-thumb.image {
  color: #9a5a1f;
}

.file-thumb.markdown,
.file-thumb.text {
  color: #45515d;
}

.file-select {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
}

.file-select input {
  width: auto;
}

.file-card-body {
  min-width: 0;
}

.file-card-body strong {
  display: block;
  min-height: 44px;
  color: #151c17;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.file-card-body small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.file-card-actions {
  justify-content: flex-end;
}

.file-card-actions .secondary {
  min-height: 30px;
  padding: 0 9px;
}

.kb-bind-panel {
  margin-top: 18px;
  color: var(--muted);
}

.kb-bind-panel summary {
  cursor: pointer;
  width: fit-content;
  font-weight: 700;
  color: #445044;
}

.kb-bind-panel .browser-box {
  margin-top: 12px;
}

.kb-chat-panel {
  min-height: 220px;
  display: grid;
  align-content: start;
  gap: 12px;
  padding-bottom: 18px;
}

.kb-chat-actions {
  justify-content: flex-end;
}

.workspace-messages {
  height: min(38vh, 440px);
  border: 0;
  background: transparent;
  padding: 0;
}

.workspace-message {
  max-width: min(760px, 86%);
  border-color: #e7ebe4;
  border-radius: 8px;
  box-shadow: none;
}

.workspace-message.user {
  background: #eef7ef;
}

.workspace-message.assistant {
  background: #ffffff;
}

.workspace-message .message-body {
  font-size: 14px;
}

.kb-composer {
  position: sticky;
  bottom: 22px;
  width: min(980px, 100%);
  justify-self: center;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0 auto;
  padding: 16px;
  border: 1px solid #dfe5dc;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 48px rgba(43, 54, 45, 0.12);
}

.kb-composer textarea {
  min-height: 74px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  padding: 4px 6px;
  box-shadow: none;
}

.kb-composer textarea:focus {
  box-shadow: none;
}

.kb-composer-bar {
  justify-content: space-between;
}

.kb-composer .chat-controls {
  grid-template-columns: 160px 220px;
  margin-bottom: 0;
}

.kb-composer .field {
  gap: 4px;
}

.kb-composer .field span {
  font-size: 12px;
}

.kb-composer button {
  width: auto;
  min-width: 86px;
}

.workspace-settings-drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 28, 23, 0.18);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(440px, 100%);
  height: 100%;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 18px;
  background: #ffffff;
  border-left: 1px solid var(--line);
  padding: 22px;
  box-shadow: -18px 0 44px rgba(34, 44, 35, 0.12);
}

.workspace-dialog {
  width: min(460px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(32, 39, 32, 0.18);
}

.workspace-dialog::backdrop {
  background: rgba(32, 39, 32, 0.2);
}

.workspace-dialog .workspace-create {
  border-bottom: 0;
  padding: 20px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workspace-asset-dialog {
  width: min(920px, calc(100vw - 56px));
  max-height: min(780px, calc(100vh - 56px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(32, 39, 32, 0.18);
}

.workspace-asset-dialog::backdrop {
  background: rgba(32, 39, 32, 0.2);
}

.workspace-asset-dialog .kb-upload-panel,
.workspace-asset-dialog .kb-bind-panel {
  max-width: none;
  margin-top: 16px;
}

.workspace-asset-dialog .webdav-browser {
  max-height: 360px;
  overflow: auto;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .kb-detail {
    padding: 22px;
  }

  .kb-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .kb-composer .chat-controls {
    grid-template-columns: 1fr;
  }
}

/* ima-like refinement */
.app-shell {
  grid-template-columns: 296px minmax(0, 1fr);
}

.sidebar {
  padding: 26px 0 16px;
  background: #fafbf9;
  border-right: 1px solid #e6e9e4;
  grid-template-rows: auto auto auto auto;
  align-content: start;
  gap: 18px;
}

.brand {
  padding: 0 22px;
}

.brand h1 {
  font-size: 30px;
  line-height: 1;
}

.brand p {
  margin-top: 14px;
  font-size: 13px;
}

.kb-header-actions .icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #edeade;
  font-size: 19px;
}

.kb-nav {
  gap: 18px;
  overflow: auto;
  padding: 0 16px 12px;
}

.kb-nav-group {
  display: grid;
  gap: 8px;
}

.kb-nav-head {
  padding: 0 4px;
  font-size: 15px;
  color: #2e382f;
}

.kb-group-toggle {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: #2e382f;
  cursor: pointer;
  padding: 0;
  font-weight: 800;
}

.kb-group-arrow {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #6f786f;
  font-size: 12px;
  transition: transform 0.15s ease;
}

.kb-group-toggle:hover .kb-group-arrow {
  background: #edf1ec;
}

.kb-group-toggle.collapsed .kb-group-arrow {
  transform: rotate(-90deg);
}

.kb-nav-head .icon-btn {
  width: 26px;
  height: 26px;
  color: #7b8479;
}

.workspace-list {
  gap: 6px;
}

.workspace-project {
  display: grid;
  gap: 6px;
}

.workspace-project + .workspace-project {
  margin-top: 8px;
}

.workspace-project-head {
  width: 100%;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 0 7px;
  color: #5f6a60;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.workspace-project-head:hover {
  color: #263228;
}

.workspace-project-name::before {
  content: '鈻?;
  display: inline-block;
  margin-right: 7px;
  color: #7a847a;
  font-size: 10px;
  transition: transform 0.15s ease;
}

.workspace-project.expanded .workspace-project-name::before {
  transform: rotate(90deg);
}

.workspace-project-head small {
  min-width: 22px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eef2ed;
  color: #7a847a;
  font-size: 11px;
}

.workspace-project-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.workspace-project-tools .ghost-icon {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: #9c6a60;
  font-size: 16px;
}

.workspace-project-list {
  display: grid;
  gap: 5px;
}

.workspace-project-empty {
  padding: 8px 11px 10px 34px;
  color: #899187;
  font-size: 12px;
}

.workspace-card {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 9px 11px;
}

.workspace-card.active {
  border-color: #b8d6cf;
  background: #e9f7ef;
}

.workspace-card:hover {
  background: #f0f4ef;
  border-color: transparent;
}

.workspace-icon {
  color: #30a386;
  font-size: 14px;
  line-height: 1.5;
}

.workspace-card strong {
  font-size: 15px;
  line-height: 1.35;
}

.workspace-card small {
  margin-top: 4px;
  font-size: 12px;
}

.sidebar-bottom {
  padding: 0 18px;
  align-content: start;
}

.sidebar-bottom .nav,
.sidebar-bottom .secondary {
  min-height: 34px;
  border-radius: 7px;
  font-size: 15px;
}

.sidebar-bottom #logoutBtn {
  width: fit-content;
  min-height: 30px;
  justify-self: start;
  background: transparent;
  color: #2e382f;
  padding: 0 12px;
}

.sidebar-bottom #logoutBtn:hover {
  background: #edf1ec;
}

.kb-detail {
  grid-template-rows: auto auto minmax(260px, 1fr) auto auto;
  padding: 18px 28px 22px;
  gap: 18px;
}

.kb-header {
  min-height: 48px;
  padding-bottom: 28px;
}

.kb-title-wrap {
  display: grid;
  gap: 5px;
}

.kb-title-wrap h2 {
  font-size: 18px;
  font-weight: 800;
}

.kb-title-wrap p {
  max-width: 520px;
  font-size: 13px;
}

.ghost-icon {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8d958c;
  cursor: pointer;
  font-size: 20px;
  font-weight: 800;
}

.ghost-icon:hover {
  background: #f0f2ee;
  color: #1f2a22;
}

.kb-file-section {
  align-self: start;
  max-width: none;
  width: 100%;
  padding: 20px 22px;
  border: 1px solid #ecefeb;
  border-radius: 12px;
  background: #fbfcfa;
}

.kb-section-head {
  max-width: none;
  padding-bottom: 14px;
  border-bottom: 1px solid #edf0ec;
  margin-bottom: 14px;
}

.kb-section-head h3 {
  font-size: 19px;
}

.kb-upload-panel,
.kb-bind-panel {
  margin-top: 10px;
  max-width: 980px;
  border-top: 1px solid #edf0ec;
  padding-top: 12px;
}

.kb-upload-panel summary,
.kb-bind-panel summary {
  font-size: 16px;
  color: #263228;
}

.kb-upload {
  margin-top: 12px;
}

.workspace-files {
  width: 100%;
  max-width: none;
  grid-template-columns: repeat(auto-fill, 178px);
  gap: 22px 28px;
}

.workspace-file-card {
  min-height: 224px;
  grid-template-rows: 104px 1fr;
  border-color: #e7eae5;
  padding: 10px;
  box-shadow: none;
}

.workspace-file-card:hover {
  border-color: #cfd8cf;
  box-shadow: 0 10px 24px rgba(36, 45, 38, 0.07);
}

.file-thumb {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  overflow: hidden;
  background: #f5f7f4;
  border: 1px solid #ecefeb;
  padding: 12px;
}

.file-type-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e4e8e1;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(36, 45, 38, 0.05);
}

.file-type-name {
  color: #727b73;
  font-size: 12px;
  font-weight: 800;
}

.file-thumb.pdf .file-type-mark {
  color: #d44338;
  background: #fff7f6;
}

.file-thumb.word .file-type-mark {
  color: #2f6fc2;
  background: #f5f8ff;
}

.file-thumb.excel .file-type-mark {
  color: #1c7a49;
  background: #f4fbf7;
}

.file-thumb.image .file-type-mark {
  color: #9a5a1f;
  background: #fff8ef;
}

.file-select {
  top: 9px;
  right: 9px;
  left: auto;
  gap: 7px;
  padding: 6px 9px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.file-select input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.workspace-file-card:hover .file-select,
.file-select:has(input:checked) {
  opacity: 1;
}

.file-card-body strong {
  min-height: 42px;
  font-size: 14px;
}

.file-card-body small {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.file-card-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  opacity: 0;
}

.workspace-file-card:hover .file-card-actions {
  opacity: 1;
}

.file-card-actions .ghost-icon {
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.86);
  font-size: 18px;
}

.kb-chat-panel {
  max-width: none;
  width: 100%;
  align-self: stretch;
  justify-self: start;
  display: grid;
  grid-template-rows: auto minmax(140px, 1fr);
  gap: 12px;
  padding: 18px 22px;
  border: 1px solid #ecefeb;
  border-radius: 12px;
  background: #ffffff;
}

.kb-chat-launcher {
  position: sticky;
  bottom: 18px;
  width: min(980px, 100%);
  min-height: 82px;
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  padding: 0 18px 0 22px;
  border: 1px solid #dcdeda;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  color: #7d867d;
  cursor: text;
  text-align: left;
}

.launcher-placeholder {
  font-size: 16px;
}

.launcher-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
}

.launcher-send {
  width: 54px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #c8c9c4;
  color: #ffffff;
  font-size: 17px;
}

.kb-chat-float {
  position: fixed;
  z-index: 18;
  left: calc(296px + 24px);
  right: 24px;
  top: 72px;
  bottom: 22px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 18px;
  max-width: none;
  margin: 0 auto;
  padding: 28px;
  border: 1px solid #e3e7e1;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 70px rgba(36, 45, 38, 0.16);
}

.kb-chat-float .kb-chat-panel {
  max-width: none;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.kb-chat-float .workspace-messages {
  max-height: none;
  min-height: 0;
  height: auto;
}

.kb-chat-float .kb-input-section {
  max-width: none;
  justify-self: stretch;
}

.kb-chat-float .kb-composer {
  width: 100%;
  position: static;
}

.kb-chat-float .saved-path {
  min-height: 18px;
}

.kb-chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf0ec;
}

.kb-chat-head h3 {
  font-size: 18px;
}

.kb-chat-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.kb-chat-actions {
  padding-right: 0;
}

.workspace-messages {
  height: auto;
  min-height: 170px;
  max-height: 34vh;
  padding-right: 8px;
}

.workspace-message {
  max-width: min(720px, 72%);
  padding: 12px 14px;
}

.workspace-message.user {
  justify-self: end;
  background: #e5f6e8;
}

.workspace-message.assistant {
  justify-self: start;
  background: #ffffff;
}

.workspace-messages > .empty-note {
  align-self: center;
  justify-self: center;
  color: #8a9388;
  font-size: 14px;
}

.kb-input-section {
  width: 100%;
  max-width: none;
  justify-self: start;
  padding-top: 2px;
}

.kb-composer {
  bottom: 18px;
  width: min(960px, 100%);
  min-height: 94px;
  padding: 14px 18px 12px;
  border: 1px solid #dcdeda;
  border-radius: 28px;
  box-shadow: none;
}

.kb-composer textarea {
  min-height: 34px;
  font-size: 16px;
  color: #202720;
}

.inline-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 0 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid #ecefeb;
}

.inline-image-chip {
  position: relative;
  width: 112px;
  height: 72px;
  margin: 0;
  border: 1px solid #e4e8e1;
  border-radius: 8px;
  overflow: hidden;
  background: #f6f7f4;
}

.inline-image-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.inline-image-chip button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  min-width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(32, 39, 32, 0.72);
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.kb-composer-bar {
  gap: 18px;
}

.kb-composer .chat-controls {
  display: flex;
  gap: 8px;
}

.kb-composer select {
  width: auto;
  max-width: 210px;
  min-height: 34px;
  border: 1px solid #e7e9e4;
  border-radius: 999px;
  background: #fbfcfa;
  padding: 0 32px 0 14px;
  font-size: 14px;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.composer-icon {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #4c554f;
  cursor: pointer;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}

.composer-icon:hover {
  background: #f0f2ee;
}

.composer-icon.send {
  background: #c8c9c4;
  color: #ffffff;
  font-size: 17px;
}

.composer-icon.send:hover {
  background: var(--brand);
}

@media (max-width: 1180px) {
  .kb-composer {
    width: calc(100vw - 340px);
  }
}

/* Design language: elevated iOS + professional local tool */
:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d8d8dc;
  --line-soft: #ececf0;
  --brand: #16756f;
  --brand-strong: #0f5f5a;
  --soft: #f2f4f3;
  --control: #f1f1f4;
  --control-hover: #e8e8ec;
  --selected: #e8f3f1;
  --warn: #b44a3a;
  --shadow-subtle: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 18px 42px rgba(0, 0, 0, 0.13);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, "Segoe UI", sans-serif;
}

body {
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-shell {
  background: var(--bg);
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  background: rgba(247, 247, 249, 0.94);
  border-right: 1px solid var(--line-soft);
  color: var(--ink);
}

.brand h1 {
  font-size: 28px;
  font-weight: 760;
  letter-spacing: 0;
}

.brand p {
  color: var(--muted);
}

.kb-nav-head,
.kb-group-toggle {
  color: #2b2b2f;
}

.kb-nav-head .icon-btn,
.icon-btn {
  background: var(--control);
  color: #4f4f55;
}

.icon-btn:hover,
.secondary:hover,
.toolbar-actions button:hover,
.subhead button:hover {
  background: var(--control-hover);
}

.sidebar .nav,
.sidebar-bottom #logoutBtn {
  color: #333338;
  border-radius: 8px;
  font-weight: 580;
}

.sidebar .nav.active,
.sidebar .nav:hover,
.sidebar-bottom #logoutBtn:hover {
  background: #ececef;
  color: #111114;
}

.workspace-project-head {
  color: #6f6f76;
  font-weight: 680;
}

.workspace-project-head:hover {
  color: #2f2f34;
}

.workspace-project-head small {
  background: #eeeeF1;
  color: #66666d;
}

.workspace-project-tools .ghost-icon {
  color: #9b5a52;
}

.workspace-project-tools .ghost-icon[data-delete-workspace-group] {
  display: none;
}

.workspace-card,
.note-item,
.file-row,
.compact-item,
.output-item,
.file-item,
.picked-item,
.workspace-file-card {
  border-radius: 8px;
}

.workspace-card {
  color: var(--ink);
}

.workspace-card.active {
  border-color: rgba(22, 117, 111, 0.32);
  background: var(--selected);
}

.workspace-card:hover {
  background: #efeff2;
}

.workspace-icon,
.file-select {
  color: var(--brand);
}

.content,
.kb-workbench {
  background: var(--bg);
}

.kb-detail,
.notes-shell,
.split,
.config-cols,
.analysis-layout {
  padding: 18px 22px 22px;
}

.panel,
.kb-file-section,
.workspace-file-card,
.kb-chat-panel,
.notes-sidebar,
.note-editor-panel,
.workspace-dialog,
.workspace-asset-dialog,
.drawer-panel {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-subtle);
}

.panel,
.notes-sidebar,
.note-editor-panel {
  padding: 16px;
}

.kb-header {
  padding: 2px 0 6px;
}

.kb-header h2,
.topbar h2,
.panel-head h3,
.kb-section-head h3,
.note-form h3 {
  color: var(--ink);
  font-weight: 720;
  letter-spacing: 0;
}

.kb-header p,
.topbar p,
.kb-section-head p,
.panel-head span,
.field,
.compact-item small,
.file-row small,
.todo-item small,
.workspace-card small,
.workspace-file-card small,
.meta {
  color: var(--muted);
}

input,
select,
textarea,
.search,
.workspace-file-search,
.note-editor,
.workspace-messages,
.webdav-browser,
.browser-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

input,
select,
textarea,
.search {
  min-height: 38px;
  padding: 9px 11px;
}

input:focus,
select:focus,
textarea:focus,
.note-editor:focus {
  border-color: rgba(22, 117, 111, 0.58);
  box-shadow: 0 0 0 3px rgba(22, 117, 111, 0.13);
}

.primary,
.secondary,
.danger,
.toolbar-actions button,
.subhead button {
  border-radius: 8px;
  font-weight: 650;
}

.primary {
  min-height: 40px;
  background: var(--brand);
  color: #ffffff;
  box-shadow: none;
}

.primary:hover {
  background: var(--brand-strong);
}

.secondary,
.toolbar-actions button,
.subhead button {
  background: var(--control);
  color: var(--ink);
}

.danger {
  background: #fff0ee;
  color: var(--warn);
}

.danger:hover {
  background: #ffe3df;
}

.dropzone {
  border-color: #c8c8ce;
  border-radius: 8px;
  background: #f7f7f9;
}

.dropzone strong {
  font-weight: 680;
}

.dropzone em,
.message-files span {
  background: var(--control);
  color: var(--muted);
}

.workspace-file-card {
  background: #ffffff;
  border-color: var(--line-soft);
  box-shadow: none;
}

.workspace-file-card:hover {
  border-color: #d0d0d6;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.file-preview {
  background: #f6f6f7;
  border-color: var(--line-soft);
}

.note-toolbar {
  border-color: var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.note-toolbar button,
.note-toolbar select,
.note-color-tool {
  border-radius: 7px;
  color: #2a2a2e;
  font-weight: 680;
}

.note-toolbar button:hover,
.note-toolbar select:hover,
.note-color-tool:hover {
  background: var(--control);
}

.toolbar-separator {
  background: var(--line-soft);
}

.note-editor {
  background: #ffffff;
  line-height: 1.72;
}

.note-item.active {
  border-color: rgba(22, 117, 111, 0.32);
  background: var(--selected);
}

.workspace-message {
  border-color: var(--line-soft);
  border-radius: 8px;
  box-shadow: none;
}

.workspace-message.user {
  background: var(--selected);
}

.workspace-message.assistant {
  background: #ffffff;
}

.kb-chat-float,
.workspace-dialog,
.workspace-asset-dialog,
.drawer-panel {
  box-shadow: var(--shadow-float);
}

.workspace-dialog::backdrop,
.workspace-asset-dialog::backdrop,
.drawer-backdrop {
  background: rgba(30, 30, 34, 0.18);
}

.kb-composer {
  border-color: var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-subtle);
}

.kb-composer textarea {
  color: var(--ink);
}

.composer-icon.send {
  background: var(--brand);
}

.composer-icon.send:hover {
  background: var(--brand-strong);
}

.markdown-content code,
.markdown-content pre {
  background: #f3f3f5;
}

.markdown-content pre {
  border-color: var(--line-soft);
}

.toast {
  color: var(--warn);
}

@media (max-width: 760px) {
  .kb-detail,
  .notes-shell,
  .split,
  .config-cols,
  .analysis-layout {
    padding: 14px;
  }
}

/* Stronger visual reset: unmistakable iOS-style local app */
:root {
  --bg: #f2f2f7;
  --panel: #ffffff;
  --ink: #111113;
  --muted: #77777e;
  --line: #d1d1d6;
  --line-soft: #e7e7ec;
  --brand: #007aff;
  --brand-strong: #0066d6;
  --soft: #f5f5f7;
  --control: #e9e9ee;
  --control-hover: #dedee5;
  --selected: #e8f1ff;
  --shadow-subtle: none;
  --shadow-float: 0 22px 60px rgba(0, 0, 0, 0.18);
}

.app-shell {
  background: #f2f2f7;
}

.sidebar {
  background: #f2f2f7;
  border-right: 1px solid #d9d9de;
}

.brand h1 {
  font-size: 27px;
  font-weight: 760;
}

.kb-nav {
  gap: 14px;
}

.kb-nav-head {
  color: #303035;
  font-size: 14px;
}

.kb-nav-head .icon-btn {
  background: #e5e5ea;
}

.sidebar .nav,
.sidebar-bottom #logoutBtn {
  min-height: 36px;
  border-radius: 9px;
  padding: 0 12px;
  color: #242428;
  font-weight: 620;
}

.sidebar .nav.active,
.sidebar .nav:hover,
.sidebar-bottom #logoutBtn:hover {
  background: #e1e1e7;
  color: #000000;
}

.workspace-card {
  border-radius: 9px;
  padding: 10px 11px;
}

.workspace-card.active {
  border-color: transparent;
  background: #dcecff;
}

.workspace-card:hover {
  background: #e8e8ed;
}

.content,
.kb-workbench {
  background: #f7f7fa;
}

.split,
.notes-shell,
.config-cols,
.analysis-layout,
.kb-detail {
  gap: 18px;
  padding: 22px 28px 28px;
}

.panel,
.kb-file-section,
.notes-sidebar,
.note-editor-panel,
.workspace-file-card,
.kb-chat-panel {
  border-color: #e1e1e6;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: none;
}

.panel {
  padding: 20px;
}

.panel-head h3,
.kb-section-head h3,
.note-form h3 {
  font-size: 20px;
  font-weight: 740;
}

.panel-head span,
.field,
.kb-section-head p {
  color: #77777e;
}

input,
select,
textarea,
.search,
.workspace-file-search {
  min-height: 40px;
  border-color: #d1d1d6;
  border-radius: 9px;
  background: #fbfbfd;
}

input:focus,
select:focus,
textarea:focus,
.note-editor:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
}

.primary {
  min-height: 42px;
  border-radius: 9px;
  background: #007aff;
  font-weight: 700;
}

.primary:hover {
  background: #0066d6;
}

.secondary,
.toolbar-actions button,
.subhead button,
.icon-btn {
  border-radius: 9px;
  background: #e9e9ee;
  color: #19191d;
}

.secondary:hover,
.toolbar-actions button:hover,
.subhead button:hover,
.icon-btn:hover {
  background: #dedee5;
}

.danger {
  border-radius: 9px;
  background: #fff1f0;
  color: #d70015;
}

.dropzone {
  border-color: #c7c7cc;
  border-radius: 10px;
  background: #fbfbfd;
}

.dropzone em {
  border-radius: 8px;
  background: #eeeeF3;
  color: #636366;
}

.compact-item,
.file-row,
.todo-item,
.output-item,
.file-item,
.picked-item {
  border-color: #e1e1e6;
  border-radius: 10px;
  background: #ffffff;
}

.note-toolbar {
  min-height: 46px;
  border-color: #d1d1d6;
  border-radius: 10px;
  background: #ffffff;
}

.note-toolbar button,
.note-toolbar select,
.note-color-tool {
  border-radius: 8px;
}

.note-toolbar button:hover,
.note-toolbar select:hover,
.note-color-tool:hover {
  background: #eeeeF3;
}

.note-editor {
  border-color: #d1d1d6;
  border-radius: 10px;
  background: #ffffff;
  padding: 18px 20px;
}

.note-item.active {
  border-color: transparent;
  background: #dcecff;
}

.workspace-file-card {
  border-radius: 10px;
}

.workspace-file-card:hover {
  border-color: #c7c7cc;
  box-shadow: none;
}

.file-preview {
  border-radius: 9px;
  background: #f5f5f7;
}

.workspace-message.user {
  background: #e8f1ff;
}

.workspace-message,
.workspace-messages,
.kb-composer {
  border-radius: 10px;
}

.composer-icon.send {
  background: #007aff;
}

.composer-icon.send:hover {
  background: #0066d6;
}

.workspace-dialog,
.workspace-asset-dialog,
.drawer-panel,
.kb-chat-float {
  border-radius: 12px;
}

/* Recall workspace redesign: modern personal AI knowledge desk */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e5e7eb;
  --line-soft: #eef2f7;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --selected: #eff6ff;
  --control: #f1f5f9;
  --control-hover: #e2e8f0;
  --shadow-subtle: 0 10px 30px rgba(15, 23, 42, 0.04);
  --shadow-float: 0 24px 80px rgba(15, 23, 42, 0.14);
}

.app-shell {
  min-height: 100vh;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  height: 100vh;
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  padding: 28px 20px 20px;
  background: rgba(248, 250, 252, 0.94);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.brand {
  padding: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand);
  color: #ffffff;
  font-size: 15px;
  font-weight: 760;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.brand h1 {
  font-size: 21px;
  font-weight: 760;
  line-height: 1;
}

.brand p {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.sidebar-search {
  height: 40px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  margin-top: 18px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: #94a3b8;
}

.sidebar-search input {
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.kb-nav {
  gap: 12px;
  overflow: auto;
  padding: 0 2px 8px 0;
}

.sidebar .nav {
  min-height: 38px;
  border-radius: 12px;
  padding: 0 12px;
  color: #334155;
  font-size: 14px;
  font-weight: 650;
}

.sidebar .nav.active,
.sidebar .nav:hover {
  background: #e8f0ff;
  color: var(--brand);
}

.kb-nav-group {
  gap: 8px;
}

.kb-nav-head {
  min-height: 30px;
  padding: 0 2px;
  color: #64748b;
  font-size: 12px;
  font-weight: 760;
}

.kb-group-toggle {
  color: #64748b;
  font-size: 12px;
}

.kb-nav-head .icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.workspace-project {
  gap: 6px;
}

.workspace-project-head {
  min-height: 28px;
  padding: 0 6px;
  color: #64748b;
}

.workspace-project-head small {
  background: #edf2f7;
  color: #64748b;
}

.workspace-card {
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 9px 10px;
  background: transparent;
}

.workspace-card.active {
  background: #e8f0ff;
}

.workspace-card:hover {
  background: #f1f5f9;
}

.workspace-icon {
  color: var(--brand);
}

.workspace-card strong {
  font-size: 14px;
  font-weight: 700;
}

.workspace-card small {
  display: none;
}

.workspace-project-empty {
  padding: 8px 10px 8px 28px;
  color: #94a3b8;
}

.sidebar-bottom {
  padding: 0;
  gap: 6px;
}

.sidebar-user {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
  overflow-wrap: anywhere;
}

.sidebar-user strong {
  font-size: 14px;
}

.sidebar-user small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.content {
  min-width: 0;
  background: var(--bg);
}

.view {
  min-height: 100vh;
}

.kb-workbench {
  min-height: 100vh;
  background: var(--bg);
}

.kb-detail {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 20px;
  padding: 34px 36px 20px;
}

.kb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 0;
}

.kb-header h2 {
  font-size: 32px;
  line-height: 1.12;
  font-weight: 780;
  color: var(--ink);
}

.kb-header p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

.kb-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kb-header-actions .primary {
  min-width: 96px;
  border-radius: 12px;
}

.icon-btn.subtle {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: #64748b;
  font-size: 19px;
}

.kb-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kb-stat-card {
  min-height: 118px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow-subtle);
}

.kb-stat-card span,
.kb-stat-card small {
  color: var(--muted);
  font-size: 13px;
}

.kb-stat-card strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.kb-workspace-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: start;
}

.kb-main-column {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.kb-tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid var(--line);
}

.kb-tabs button {
  height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font-weight: 700;
}

.kb-tabs button.active {
  border-color: var(--brand);
  color: var(--brand);
}

.kb-file-section,
.kb-chat-panel,
.kb-memory-rail {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: var(--shadow-subtle);
}

.kb-file-section {
  padding: 20px;
}

.kb-section-head {
  margin-bottom: 18px;
}

.kb-section-head h3,
.kb-chat-head h3,
.memory-rail-head h3 {
  color: var(--ink);
  font-size: 22px;
  font-weight: 760;
}

.kb-file-actions {
  display: grid;
  grid-template-columns: auto minmax(180px, 280px) auto auto;
  align-items: center;
  gap: 10px;
}

.workspace-file-search {
  height: 40px;
  border-radius: 12px;
}

.workspace-files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.workspace-file-card {
  position: relative;
  min-height: 188px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: none;
}

.workspace-file-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.07);
}

.file-thumb {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #eef2ff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.file-thumb.pdf { background: #fee2e2; color: #dc2626; }
.file-thumb.word { background: #dbeafe; color: #2563eb; }
.file-thumb.excel { background: #dcfce7; color: #16a34a; }
.file-thumb.image { background: #ede9fe; color: #7c3aed; }
.file-thumb.markdown { background: #f1f5f9; color: #334155; }
.file-thumb.text { background: #fef3c7; color: #d97706; }

.file-select {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.file-select input {
  width: 14px;
  height: 14px;
  accent-color: var(--brand);
}

.file-card-body strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.42;
}

.file-card-body small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.file-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.file-card-tags span {
  border-radius: 999px;
  background: #eff6ff;
  color: var(--brand);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 650;
}

.file-card-actions {
  display: flex;
  justify-content: flex-end;
}

.workspace-upload-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 10px;
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  background: #ffffff;
  text-align: center;
  color: var(--muted);
}

.workspace-upload-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.kb-chat-panel {
  padding: 20px;
}

.workspace-messages {
  max-height: 360px;
  min-height: 180px;
  border: 0;
  background: transparent;
  padding: 0;
}

.workspace-message {
  border-radius: 16px;
}

.workspace-message.user {
  background: #eff6ff;
}

.kb-memory-rail {
  position: sticky;
  top: 28px;
  max-height: calc(100vh - 56px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 20px;
}

.memory-rail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.memory-rail-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.memory-card-list {
  display: grid;
  gap: 14px;
  overflow: auto;
}

.memory-info-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.memory-info-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.memory-info-head strong {
  color: var(--ink);
  font-size: 15px;
}

.memory-info-head small,
.memory-info-card p {
  color: var(--muted);
  font-size: 13px;
}

.memory-info-card p {
  line-height: 1.62;
}

.memory-info-card span {
  width: fit-content;
  border-radius: 999px;
  background: #ecfeff;
  color: #0e7490;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 650;
}

.memory-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.memory-all-btn {
  width: 100%;
}

.kb-chat-dock {
  position: sticky;
  bottom: 18px;
  z-index: 5;
}

.kb-input-section {
  padding: 0;
}

.kb-composer {
  width: min(940px, 100%);
  margin: 0 auto;
  padding: 14px 16px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 46px rgba(37, 99, 235, 0.12);
}

.kb-composer textarea {
  min-height: 48px;
  border: 0;
  background: transparent;
  padding: 0;
  resize: none;
  box-shadow: none;
  font-size: 15px;
}

.kb-composer textarea:focus {
  box-shadow: none;
}

.kb-composer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}

.kb-composer .chat-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.kb-composer .secondary,
.kb-composer select {
  min-height: 34px;
  border-radius: 999px;
}

.composer-icon.send {
  width: 38px;
  min-width: 38px;
  height: 38px;
  background: var(--brand);
  color: #ffffff;
}

.saved-path {
  color: var(--muted);
  font-size: 12px;
}

.empty-state-panel {
  width: min(680px, calc(100vw - 360px));
  margin: 42px auto;
  text-align: center;
}

.empty-state-panel p {
  margin-top: 10px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .kb-workspace-grid {
    grid-template-columns: 1fr;
  }

  .kb-memory-rail {
    position: static;
    max-height: none;
  }

  .kb-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    position: static;
  }

  .kb-detail {
    padding: 18px;
  }

  .kb-stats {
    grid-template-columns: 1fr;
  }

  .kb-file-actions {
    grid-template-columns: 1fr;
  }
}

/* Sidebar refinement: compact source-list like the reference */
.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  padding: 22px 18px 18px;
  gap: 16px;
  background: #f8fbff;
}

.brand-row {
  gap: 9px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 13px;
}

.brand h1 {
  font-size: 18px;
}

.brand p {
  margin-top: 8px;
  font-size: 12px;
}

.sidebar-search {
  height: 36px;
  margin-top: 16px;
  border-radius: 10px;
  font-size: 13px;
}

.kb-nav {
  gap: 10px;
  padding-right: 4px;
}

.sidebar .nav {
  min-height: 34px;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 650;
}

.sidebar .nav::before {
  display: inline-block;
  width: 18px;
  margin-right: 8px;
  color: #64748b;
  font-weight: 700;
}

.sidebar .nav[data-view="dashboard"]::before { content: '鈱?; }
.sidebar .nav[data-view="todos"]::before { content: '鈻?; }
.sidebar .nav[data-view="settings"]::before { content: '鈿?; }

.sidebar .nav.active,
.sidebar .nav:hover {
  background: #edf4ff;
}

.kb-nav-group {
  position: relative;
  gap: 5px;
}

.kb-nav-group::before {
  content: '';
  position: absolute;
  top: 34px;
  bottom: 8px;
  left: 9px;
  width: 1px;
  background: #e3eaf5;
}

.kb-nav-head {
  min-height: 30px;
  padding: 0;
}

.kb-group-toggle {
  min-height: 30px;
  font-size: 13px;
  color: #475569;
}

.kb-group-arrow {
  width: 18px;
  color: #64748b;
}

.kb-nav-head .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 18px;
}

.workspace-project {
  margin-left: 18px;
}

.workspace-project + .workspace-project {
  margin-top: 5px;
}

.workspace-project-head {
  min-height: 28px;
  padding: 0 4px;
  font-size: 12px;
}

.workspace-project-name::before {
  margin-right: 6px;
}

.workspace-project-head small {
  min-width: 22px;
  height: 22px;
  font-size: 12px;
}

.workspace-project-list {
  gap: 4px;
}

.workspace-card {
  min-height: 38px;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  margin-left: 0;
  border-radius: 10px;
  padding: 8px 9px;
}

.workspace-card strong {
  font-size: 13px;
}

.workspace-icon {
  font-size: 12px;
}

.workspace-card.active {
  background: #dbeafe;
}

.workspace-project-empty {
  padding: 7px 8px 7px 24px;
  font-size: 12px;
}

.sidebar-bottom {
  gap: 5px;
  padding-top: 4px;
}

.sidebar-user {
  min-height: 58px;
  padding: 10px;
  border-radius: 14px;
}

.sidebar-user strong {
  font-size: 13px;
}

.sidebar-user small {
  font-size: 11px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 232px minmax(0, 1fr);
  }
}

/* Requested cleanup: compact sidebar actions, full-width files/conversation, no user center */
.sidebar {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.sidebar-logout {
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.kb-nav-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px 32px;
  align-items: center;
  gap: 8px;
}

.kb-nav-head .kb-group-toggle {
  min-width: 0;
}

.kb-nav-head .icon-btn {
  width: 32px;
  height: 32px;
  justify-self: end;
}

[data-workspace-nav-section="projects"] .kb-nav-head {
  grid-template-columns: minmax(0, 1fr);
}

.workspace-project-tools .ghost-icon[data-delete-workspace-group] {
  display: none !important;
}

.kb-stats,
.kb-memory-rail {
  display: none !important;
}

.kb-detail {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.kb-workspace-grid {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

.kb-main-column {
  width: 100%;
}

.kb-file-section,
.kb-chat-panel {
  width: 100%;
}

.workspace-files {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.workspace-messages {
  max-height: none;
}

.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 12px 0 6px;
  color: var(--ink);
  line-height: 1.45;
  font-weight: 720;
}

.markdown-content h4 {
  font-size: 15px;
}

.markdown-content h5,
.markdown-content h6 {
  font-size: 14px;
}

.note-title-field {
  margin-bottom: 2px;
}

.note-title-field input {
  min-height: 48px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font-size: 28px;
  font-weight: 760;
}

.note-title-field input:focus {
  border-color: var(--brand);
  box-shadow: none;
}

/* Requested navigation/input cleanup */
.sidebar .nav {
  padding-left: 14px;
}

.sidebar .nav::before,
.workspace-icon {
  display: none !important;
}

.workspace-card {
  grid-template-columns: minmax(0, 1fr);
}

.kb-file-actions {
  align-items: center;
}

.kb-file-actions .workspace-file-search {
  min-width: 220px;
}

.kb-composer-bar {
  justify-content: space-between;
}

.kb-composer .chat-controls {
  min-width: 0;
}

.kb-composer .chat-controls .field {
  margin: 0;
}

.kb-composer .chat-controls select {
  min-width: 220px;
}

.settings-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 14px 0 26px;
}

.settings-summary-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.04);
}

.settings-summary-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-summary-card span,
.settings-binding-list small,
.settings-binding-list p {
  color: var(--muted);
}

.settings-summary-card strong {
  color: var(--ink);
}

.settings-binding-list {
  display: grid;
  gap: 10px;
}

.settings-binding-list article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #e7edf4;
  border-radius: 14px;
  background: #f8fafc;
}

.settings-binding-list article strong,
.settings-binding-list article span,
.settings-binding-list article small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .settings-summary {
    grid-template-columns: 1fr;
  }
}

/* Requested compact workspace and note refinements */
#workspaceFileSelectAllBtn {
  width: auto;
  min-width: 40px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #d8e0ea;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  box-shadow: none;
}

#workspaceFileSelectAllBtn:hover {
  border-color: #3b82f6;
  color: #2563eb;
  background: #f8fbff;
}

.workspace-messages {
  max-height: clamp(360px, 46vh, 620px);
  overflow: auto;
  padding-right: 8px;
}

.file-thumb {
  overflow: visible;
}

.file-type-mark {
  width: 62px;
  min-width: 62px;
  height: 54px;
  padding: 0 8px;
  overflow: visible;
  white-space: nowrap;
  font-size: 14px;
  letter-spacing: 0;
}

.file-type-name {
  display: none !important;
}

.workspace-file-card .file-select {
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 7px;
  background: transparent;
  color: transparent;
  opacity: 0;
}

.workspace-file-card:hover .file-select,
.workspace-file-card .file-select:has(input:checked) {
  opacity: 1;
}

.workspace-file-card .file-select input {
  width: 14px;
  height: 14px;
}

.workspace-file-card .file-card-tags {
  display: none !important;
}

.workspace-file-card {
  min-height: 164px;
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 14px;
  padding: 20px;
}

.workspace-file-card .file-card-body {
  display: grid;
  gap: 18px;
}

.workspace-file-card .file-card-body strong {
  line-height: 1.35;
}

.workspace-file-card .file-card-body small {
  margin-top: 0;
}

.workspace-file-card .file-card-actions {
  position: absolute;
  right: 12px;
  bottom: 10px;
}

.workspace-file-card {
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.workspace-file-card.selected {
  border-color: #1677ff;
  background: #f5f9ff;
  box-shadow: 0 10px 28px rgba(22, 119, 255, 0.08);
}

.workspace-file-card.selected .file-select {
  opacity: 1;
}

/* Add asset dialog redesign */
#workspaceAssetDialog.workspace-asset-dialog {
  width: min(1180px, calc(100vw - 48px));
  height: min(760px, 80vh);
  max-height: calc(100vh - 48px);
  border: 1px solid #eaecef;
  border-radius: 24px;
  padding: 32px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

#workspaceAssetDialog::backdrop {
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
}

#workspaceAssetDialog .dialog-head {
  align-items: flex-start;
  min-height: 42px;
  padding-bottom: 28px;
}

#workspaceAssetDialog .dialog-head h3 {
  margin: 0;
  color: #1f2329;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
}

#workspaceAssetDialog .dialog-head p {
  margin: 6px 0 0;
  color: #8b95a7;
  font-size: 14px;
  line-height: 1.45;
}

.dialog-close-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #4e5969;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.dialog-close-btn:hover {
  background: #f5f7fb;
  color: #1f2329;
}

.asset-dialog-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  height: calc(100% - 70px);
  min-height: 0;
}

#workspaceAssetDialog .kb-upload-panel,
#workspaceAssetDialog .kb-bind-panel {
  display: grid;
  align-content: start;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

#workspaceAssetDialog .kb-bind-panel {
  height: 100%;
  border: 1px solid #eaecef;
  border-radius: 20px;
  background: #ffffff;
  padding: 24px;
}

#workspaceAssetDialog summary {
  display: none;
}

#workspaceAssetDialog summary::-webkit-details-marker {
  display: none;
}

#workspaceAssetDialog .kb-upload {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 18px;
  margin: 0;
  height: 100%;
  border: 1px solid #eef2f7;
  border-radius: 20px;
  background: #fafcff;
  padding: 28px 24px;
}

#workspaceAssetDialog .compact-dropzone {
  min-height: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  padding: 18px;
  text-align: center;
}

.upload-cloud {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #edf5ff;
  color: #1677ff;
  font-size: 28px;
}

#workspaceAssetDialog .compact-dropzone strong {
  color: #1f2329;
  font-size: 18px;
  font-weight: 700;
}

#workspaceAssetDialog .compact-dropzone span:not(.upload-cloud),
#workspaceAssetDialog .compact-dropzone small {
  color: #8b95a7;
  font-size: 13px;
}

#workspaceAssetDialog .kb-upload .primary,
#workspaceAssetDialog .footer-actions .primary {
  height: 40px;
  border-radius: 12px;
  background: #1677ff;
  color: #ffffff;
}

#workspaceAssetDialog .kb-upload .primary {
  width: min(180px, 100%);
  justify-self: center;
}

#workspaceAssetDialog .browser-box {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 22px;
  min-width: 0;
  position: relative;
}

#workspaceAssetDialog .subhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 0;
  border: 0;
}

#workspaceAssetDialog .subhead span {
  display: block;
  color: #1f2329;
  font-size: 18px;
  font-weight: 600;
}

#workspaceBrowserBreadcrumb {
  display: block;
  margin-top: 6px;
  color: #8b95a7;
  font-size: 13px;
  font-weight: 500;
}

#workspaceAssetDialog .toolbar-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

#workspaceAssetDialog .toolbar-actions button,
#workspaceAssetDialog .selection-status button,
#workspaceAssetDialog .footer-actions button {
  height: 40px;
  border: 1px solid #eaecef;
  border-radius: 999px;
  background: #ffffff;
  color: #1f2329;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
}

#workspaceAssetDialog .toolbar-actions button:hover,
#workspaceAssetDialog .selection-status button:hover,
#workspaceAssetDialog .footer-actions .secondary:hover {
  background: #f5f7fb;
}

#workspaceBrowserBindBtn {
  border-color: #dbe4ff !important;
  color: #1677ff !important;
}

#workspaceAssetDialog .pathbar {
  position: absolute;
  top: 36px;
  left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

#workspaceAssetDialog .pathbar span {
  display: none;
}

#workspaceAssetDialog #workspaceBrowserUpBtn {
  height: 28px;
  border-radius: 999px;
  background: #f5f7fb;
  color: #4e5969;
  padding: 0 10px;
  font-size: 12px;
}

#workspaceAssetDialog .webdav-browser {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 12px;
  max-height: none;
  min-height: 0;
  overflow: auto;
  padding: 12px 4px 4px 0;
}

#workspaceAssetDialog .browser-card {
  height: 88px;
  min-height: 88px;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  border: 1px solid #edf0f5;
  border-radius: 16px;
  background: #ffffff;
  padding: 16px;
  box-shadow: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

#workspaceAssetDialog .browser-card:hover {
  transform: translateY(-2px);
  border-color: #dbe4ff;
  box-shadow: none;
}

#workspaceAssetDialog .folder-card {
  cursor: pointer;
}

#workspaceAssetDialog .browser-icon,
#workspaceAssetDialog .browser-file-type {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #edf5ff;
  color: #1677ff;
  font-size: 17px;
  font-weight: 800;
}

#workspaceAssetDialog .browser-file-type.pdf { background: #fee2e2; color: #dc2626; }
#workspaceAssetDialog .browser-file-type.word { background: #dbeafe; color: #2563eb; }
#workspaceAssetDialog .browser-file-type.excel { background: #dcfce7; color: #16a34a; }
#workspaceAssetDialog .browser-file-type.markdown { background: #f1f5f9; color: #334155; }
#workspaceAssetDialog .browser-file-type.image { background: #ede9fe; color: #7c3aed; }

#workspaceAssetDialog .browser-card input {
  width: 16px;
  height: 16px;
  accent-color: #4f7cff;
}

#workspaceAssetDialog .file-browser-card {
  grid-template-columns: auto auto minmax(0, 1fr);
  cursor: pointer;
}

#workspaceAssetDialog .file-browser-card.selected {
  border-color: #1677ff;
  background: #f3f7ff;
  box-shadow: none;
}

#workspaceAssetDialog .browser-card strong {
  align-self: center;
  min-width: 0;
  overflow: hidden;
  color: #1f2329;
  font-size: 15px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#workspaceAssetDialog .browser-card small {
  grid-column: 2 / -1;
  color: #8b95a7;
  font-size: 12px;
}

#workspaceAssetDialog .file-browser-card small {
  grid-column: 3;
}

.asset-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid #eef2f7;
}

.selection-status,
.footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#workspaceBrowserSelectionCount {
  color: #4e5969;
  font-size: 13px;
}

@media (max-width: 920px) {
  #workspaceAssetDialog.workspace-asset-dialog {
    overflow: auto;
  }

  .asset-dialog-grid {
    grid-template-columns: 1fr;
  }

  #workspaceAssetDialog .webdav-browser {
    grid-template-columns: 1fr;
  }
}

.kb-tabs {
  display: none !important;
}

#noteFormTitle {
  display: none;
}

#insertNoteDateBtn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

#insertNoteDateBtn:hover {
  border-color: #3b82f6;
  color: #2563eb;
  background: #f8fbff;
}

.note-date-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

[data-workspace-nav-section="projects"] {
  display: none !important;
}

.workspace-project-empty {
  padding-left: 18px;
}

/* Consumer notes view */
.app-shell:has(#todosView:not(.hidden)) {
  grid-template-columns: 240px minmax(0, 1fr);
  background: #f7f8fa;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar {
  width: 240px;
  padding: 24px 16px 20px;
  background: #ffffff;
  border-right: 1px solid #eceff3;
  color: #1f2329;
}

.app-shell:has(#todosView:not(.hidden)) .brand {
  padding-top: 0;
}

.app-shell:has(#todosView:not(.hidden)) .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1677ff;
  box-shadow: none;
  font-size: 16px;
}

.app-shell:has(#todosView:not(.hidden)) .brand h1 {
  color: #1f2329;
  font-size: 20px;
  font-weight: 700;
}

.app-shell:has(#todosView:not(.hidden)) .brand p,
.app-shell:has(#todosView:not(.hidden)) .kb-nav-head,
.app-shell:has(#todosView:not(.hidden)) .kb-group-toggle,
.app-shell:has(#todosView:not(.hidden)) .sidebar-logout {
  color: #86909c;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar .nav {
  min-height: 40px;
  border-radius: 10px;
  color: #1f2329;
  font-size: 14px;
  font-weight: 500;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar .nav:hover {
  background: #f3f6fa;
  color: #1f2329;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar .nav.active {
  background: #e8f3ff;
  color: #1f2329;
}

.app-shell:has(#todosView:not(.hidden)) .content {
  padding: 24px;
  background: #f7f8fa;
}

#todosView {
  min-height: calc(100vh - 48px);
}

#todosView .notes-shell {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

#todosView .notes-sidebar,
#todosView .note-editor-panel {
  min-height: calc(100vh - 48px);
  box-shadow: none;
}

#todosView .notes-sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  padding: 0;
  border: 0;
  background: transparent;
}

#todosView .notes-sidebar .panel-head {
  margin: 0;
  align-items: center;
}

#todosView .notes-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#todosView .notes-sidebar h3 {
  color: #1f2329;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
}

#todosView #newNoteBtn {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: #1677ff;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

#todosView #newNoteBtn:hover {
  background: #0f67dd;
}

#todosView #noteOutlineToggleBtn {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #eaecef;
  border-radius: 10px;
  background: #ffffff;
  color: #1f2329;
  font-size: 13px;
  font-weight: 600;
}

#todosView #noteOutlineToggleBtn[aria-pressed="true"] {
  border-color: #dbeafe;
  background: #eff6ff;
  color: #1677ff;
}

#todosView #noteSidebarCollapseBtn {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #eaecef;
  border-radius: 10px;
  background: #ffffff;
  color: #1f2329;
  font-size: 13px;
  font-weight: 600;
}

#todosView #noteSidebarCollapseBtn[aria-pressed="true"] {
  border-color: #dbeafe;
  background: #eff6ff;
  color: #1677ff;
}

.notes-search {
  height: 40px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid #eceff3;
  border-radius: 12px;
  background: #ffffff;
  color: #a5a9b5;
}

.notes-search input {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: #1f2329;
  box-shadow: none;
  font-size: 13px;
}

.notes-search input:focus {
  box-shadow: none;
}

.notes-search input::placeholder {
  color: #a5a9b5;
}

#todosView .notes-list {
  display: grid;
  gap: 12px;
  align-content: start;
  overflow: auto;
  padding-right: 2px;
}

#todosView .note-outline-panel {
  min-height: 0;
  overflow: auto;
  padding: 2px 4px 0 0;
}

#todosView .note-outline-head {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

#todosView .note-outline-head button {
  width: fit-content;
  border: 0;
  background: transparent;
  color: #86909c;
  cursor: pointer;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

#todosView .note-outline-head strong {
  color: #1677ff;
  font-size: 14px;
  font-weight: 700;
}

#todosView .note-outline-tree {
  display: grid;
  gap: 8px;
}

#todosView .note-outline-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  min-height: 30px;
}

#todosView .note-outline-row.level-2 {
  padding-left: 18px;
}

#todosView .note-outline-row.level-3 {
  padding-left: 36px;
}

#todosView .note-outline-collapse {
  width: 16px;
  height: 24px;
  border: 0;
  background: transparent;
  color: #9aa3af;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
}

#todosView .note-outline-link {
  min-width: 0;
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1f2329;
  cursor: pointer;
  padding: 4px 6px;
  text-align: left;
}

#todosView .note-outline-link:hover {
  background: #f5f7fa;
}

#todosView .note-outline-link span {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 5px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  color: #1677ff;
  font-size: 11px;
  font-weight: 700;
}

#todosView .note-outline-link strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#todosView .note-outline-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: #86909c;
  font-size: 13px;
}

#todosView .note-item {
  position: relative;
  height: 90px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: start;
  gap: 8px;
  padding: 16px;
  border: 1px solid #eceff3;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: none;
}

#todosView .note-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

#todosView .note-item.active {
  border-color: #1677ff;
  background: #f5f9ff;
}

#todosView .note-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: #1677ff;
}

#todosView .note-open {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 8px;
}

#todosView .note-open strong {
  overflow: hidden;
  color: #1f2329;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#todosView .note-open small {
  color: #86909c;
  font-size: 12px;
  line-height: 1.4;
}

#todosView .note-item .row-actions {
  opacity: 0;
  pointer-events: none;
  justify-content: flex-end;
  transition: opacity 0.15s ease;
}

#todosView .note-item:hover .row-actions,
#todosView .note-item.active .row-actions {
  opacity: 1;
  pointer-events: auto;
}

#todosView .note-item .row-actions .secondary {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #86909c;
  font-size: 18px;
  line-height: 1;
}

#todosView .note-item .row-actions .secondary:hover {
  background: #eef1f5;
  color: #1f2329;
}

#todosView .note-editor-panel {
  width: 100%;
  max-width: 1060px;
  display: grid;
  align-content: start;
  grid-template-rows: auto auto auto minmax(600px, 1fr) auto auto;
  gap: 20px;
  justify-self: start;
  padding: 32px;
  border: 1px solid #eceff3;
  border-radius: 16px;
  background: #ffffff;
}

#todosView .note-editor-panel > * {
  width: 100%;
  max-width: 900px;
  justify-self: center;
}

#todosView .note-editor-panel .panel-head {
  margin: 0;
  justify-content: flex-end;
}

#todosView #noteSummaryBtn,
#todosView .note-editor-panel .primary {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}

#todosView #noteSummaryBtn {
  border: 0;
  background: #f5f7fa;
  color: #1f2329;
}

#todosView #noteSummaryBtn:hover {
  background: #eef1f5;
}

#todosView .note-editor-panel .primary {
  background: #1677ff;
  color: #ffffff;
}

#todosView .note-title-field {
  gap: 0;
  margin: 0;
}

#todosView .note-title-field span {
  display: none;
}

#todosView .note-title-field input {
  min-height: 48px;
  border: 0;
  background: transparent;
  padding: 0;
  color: #1f2329;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 700;
}

#todosView .note-title-field input::placeholder {
  color: #b0b7c3;
}

#todosView .note-title-field input:focus {
  border: 0;
  box-shadow: none;
}

#todosView .note-toolbar {
  min-height: 48px;
  gap: 4px;
  padding: 6px 8px;
  overflow: visible;
  flex-wrap: nowrap;
  border: 1px solid #eceff3;
  border-radius: 12px;
  background: #fafbfc;
}

#todosView .note-toolbar button,
#todosView .note-toolbar select,
#todosView .note-color-tool {
  min-width: 30px;
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1f2329;
  font-size: 15px;
  font-weight: 600;
  padding: 0 7px;
}

#todosView .note-toolbar button[data-note-format="h2"] {
  font-size: 12px;
}

#todosView .note-toolbar select {
  width: auto;
  max-width: 78px;
  padding: 0 6px;
  font-size: 12px;
}

#todosView .note-toolbar button:hover,
#todosView .note-toolbar select:hover,
#todosView .note-color-tool:hover {
  background: #eef1f5;
}

#todosView #insertNoteDateBtn {
  min-width: 58px;
  min-height: 30px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  font-size: 12px;
}

#todosView .toolbar-separator {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: #eceff3;
}

#todosView .note-color-menu {
  position: relative;
  flex: 0 0 auto;
}

#todosView .note-color-trigger {
  position: relative;
  min-width: 40px;
  padding: 0 18px 0 8px;
  text-decoration: underline;
  text-decoration-color: #22c55e;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

#todosView .note-color-trigger::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #86909c;
  transform: translateY(-35%);
}

#todosView .note-color-trigger.highlight {
  text-decoration-color: #facc15;
}

#todosView .note-color-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 80;
  width: 314px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.14);
}

#todosView .note-color-popover > span {
  display: block;
  margin-bottom: 10px;
  color: #8b95a7;
  font-size: 13px;
}

#todosView .note-color-none {
  width: 100%;
  height: 38px;
  margin-bottom: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2329;
  font-size: 14px;
  font-weight: 500;
}

#todosView .note-color-grid {
  display: grid;
  grid-template-columns: repeat(10, 24px);
  gap: 6px;
}

#todosView .note-color-grid button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 4px;
  background: var(--swatch);
  padding: 0;
}

#todosView .note-color-grid button:hover,
#todosView .note-color-grid button:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.16);
}

#todosView .note-task-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#todosView .note-editor {
  min-height: 600px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: #1f2329;
  font-size: 16px;
  line-height: 1.8;
}

#todosView .note-editor:focus {
  box-shadow: none;
}

#todosView .note-editor:empty::before {
  color: #a5a9b5;
}

#todosView .note-editor blockquote {
  border-left-color: #1677ff;
  color: #86909c;
}

#todosView #noteSavedPath {
  min-height: 18px;
  margin-top: 0;
  color: #86909c;
  font-size: 12px;
}

#todosView .note-statusbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #86909c;
  font-size: 12px;
}

#todosView .notes-shell.note-sidebar-collapsed {
  grid-template-columns: 84px minmax(0, 1fr);
}

#todosView .notes-shell.note-sidebar-collapsed .notes-sidebar {
  overflow: hidden;
}

#todosView .notes-shell.note-sidebar-collapsed .notes-sidebar h3,
#todosView .notes-shell.note-sidebar-collapsed #noteOutlineToggleBtn,
#todosView .notes-shell.note-sidebar-collapsed #newNoteBtn,
#todosView .notes-shell.note-sidebar-collapsed .notes-search,
#todosView .notes-shell.note-sidebar-collapsed #todoList,
#todosView .notes-shell.note-sidebar-collapsed #noteOutlinePanel {
  display: none !important;
}

#todosView .notes-shell.note-sidebar-collapsed .notes-sidebar .panel-head {
  justify-content: center;
}

#todosView .notes-shell.note-sidebar-collapsed .notes-head-actions {
  display: grid;
  justify-items: center;
}

@media (max-width: 1180px) {
  #todosView .notes-shell {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  #todosView .note-editor-panel {
    max-width: none;
  }
}

@media (max-width: 900px) {
  .app-shell:has(#todosView:not(.hidden)) {
    grid-template-columns: 1fr;
  }

  .app-shell:has(#todosView:not(.hidden)) .sidebar {
    width: auto;
    height: auto;
    position: static;
  }

  #todosView .notes-shell {
    grid-template-columns: 1fr;
  }

  #todosView .notes-sidebar,
  #todosView .note-editor-panel {
    min-height: auto;
  }
}

/* Consumer settings view */
.app-shell:has(#settingsView:not(.hidden)) {
  background: #f7f8fa;
}

.app-shell:has(#settingsView:not(.hidden)) .content {
  padding: 0;
  background: #f7f8fa;
}

#settingsView {
  min-height: 100vh;
  padding: 32px;
}

#settingsView .settings-page {
  width: 100%;
  max-width: 1400px;
  display: grid;
  gap: 24px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#settingsView .settings-hero {
  display: block;
  padding: 0;
}

#settingsView .settings-hero h2 {
  color: #111827;
  font-size: 32px;
  line-height: 1.15;
  font-weight: 700;
}

#settingsView .settings-hero p {
  margin-top: 8px;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.6;
}

#settingsView .settings-state-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-top: 12px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eefdf3;
  color: #16a34a;
  font-size: 12px;
  font-weight: 650;
}

#settingsView .settings-summary,
#settingsView .config-cols {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
  margin: 0;
  padding: 0;
}

#settingsView .settings-summary-card,
#settingsView .settings-config-card {
  width: 100%;
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: none;
}

#settingsView .settings-summary-card {
  height: 190px;
  min-height: 190px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  padding: 24px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

#settingsView .settings-summary-card:hover,
#settingsView .settings-config-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

#settingsView .settings-card-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

#settingsView .settings-card-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #eaf2ff;
  color: #2563eb;
  font-size: 14px;
  font-weight: 800;
}

#settingsView .model-summary-card .settings-card-icon {
  background: #f1e8ff;
  color: #7c3aed;
}

#settingsView .settings-card-head span:not(.settings-card-icon),
#settingsView .settings-card-title h3 {
  color: #111827;
}

#settingsView .settings-card-head span:not(.settings-card-icon) {
  display: block;
  font-size: 16px;
  font-weight: 700;
}

#settingsView .settings-card-head strong {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-top: 6px;
  padding: 0 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #16a34a;
  font-size: 12px;
  font-weight: 700;
}

#settingsView .settings-binding-list {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

#settingsView .settings-binding-list article {
  display: grid;
  gap: 3px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#settingsView .model-summary-card .settings-binding-list article + article {
  padding-top: 8px;
  border-top: 1px solid #eef2f7;
}

#settingsView .settings-binding-list article strong,
#settingsView .settings-binding-list article span,
#settingsView .settings-binding-list article small,
#settingsView .settings-binding-list p {
  min-width: 0;
  overflow: hidden;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#settingsView .settings-binding-list article strong {
  color: #111827;
  font-size: 13px;
  font-weight: 650;
}

#settingsView .settings-binding-list article span,
#settingsView .settings-binding-list article small {
  font-size: 12px;
}

#settingsView .settings-config-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

#settingsView .settings-card-title {
  display: grid;
  gap: 6px;
  margin-bottom: 2px;
}

#settingsView .settings-card-title h3 {
  font-size: 20px;
  line-height: 1.25;
  font-weight: 700;
}

#settingsView .settings-card-title p {
  color: #6b7280;
  font-size: 13px;
  line-height: 1.55;
}

#settingsView .field {
  display: grid;
  gap: 8px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

#settingsView input,
#settingsView select,
#settingsView textarea {
  min-height: 48px;
  border: 1px solid #dcdfe6;
  border-radius: 12px;
  background: #ffffff;
  color: #111827;
  padding: 0 14px;
  box-shadow: none;
  font-size: 14px;
}

#settingsView input:focus,
#settingsView select:focus,
#settingsView textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

#settingsView .button-row {
  align-self: stretch;
  justify-content: flex-end;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
}

#settingsView #testWebdavBtn,
#settingsView #testModelBtn,
#settingsView #saveWebdavBtn,
#settingsView #saveModelBtn {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  box-shadow: none;
  font-size: 14px;
  font-weight: 700;
}

#settingsView #testWebdavBtn,
#settingsView #testModelBtn {
  background: #f3f4f6;
  color: #111827;
}

#settingsView #testWebdavBtn:hover,
#settingsView #testModelBtn:hover {
  background: #e5e7eb;
}

#settingsView #saveWebdavBtn,
#settingsView #saveModelBtn {
  background: #2563eb;
  color: #ffffff;
}

#settingsView #saveWebdavBtn:hover,
#settingsView #saveModelBtn:hover {
  background: #1d4ed8;
}

#settingsView .settings-switch {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
}

#settingsView .settings-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#settingsView .settings-switch i {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #d1d5db;
  transition: background 0.16s ease;
}

#settingsView .settings-switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.2);
  transition: transform 0.16s ease;
}

#settingsView .settings-switch input:checked + i {
  background: #2563eb;
}

#settingsView .settings-switch input:checked + i::after {
  transform: translateX(20px);
}

#settingsView .settings-security-note {
  margin: 6px 0 0;
  color: #9ca3af;
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 1100px) {
  #settingsView .settings-summary,
  #settingsView .config-cols {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #settingsView {
    padding: 20px;
  }

  #settingsView .settings-summary-card,
  #settingsView .settings-config-card {
    padding: 20px;
  }

  #settingsView .button-row {
    flex-wrap: wrap;
  }
}

/* Final app empty state and sidebar refinement */
.app-shell {
  grid-template-columns: 280px minmax(0, 1fr);
  background: #f7f8fa;
}

.app-shell:has(#todosView:not(.hidden)),
.app-shell:has(#settingsView:not(.hidden)) {
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  width: 280px;
  height: 100vh;
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  padding: 24px 18px;
  border-right: 1px solid #eaecef;
  background: #ffffff;
  color: #1f2329;
  overflow: hidden;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar,
.app-shell:has(#settingsView:not(.hidden)) .sidebar {
  width: 280px;
  padding: 24px 18px;
  background: #ffffff;
  border-right: 1px solid #eaecef;
}

.brand {
  padding: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #e8f3ff;
  color: #1677ff;
  box-shadow: none;
  font-size: 15px;
  font-weight: 700;
}

.brand h1 {
  color: #1f2329;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 700;
}

.brand p {
  margin-top: 8px;
  color: #86909c;
  font-size: 12px;
  line-height: 1.45;
}

.sidebar-search {
  height: 40px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 0 12px;
  border: 1px solid #eaecef;
  border-radius: 12px;
  background: #f7f8fa;
  color: #86909c;
}

.sidebar-search input {
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: #1f2329;
  box-shadow: none;
  font-size: 13px;
}

.sidebar-search input::placeholder {
  color: #a5a9b5;
  font-size: 13px;
}

.sidebar-search input:focus {
  box-shadow: none;
}

.kb-nav {
  gap: 10px;
  overflow: auto;
  padding: 0 2px 8px 0;
}

.sidebar .nav,
.sidebar-logout {
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #1f2329;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.sidebar .nav {
  padding: 0 12px;
}

.sidebar .nav:hover,
.sidebar-logout:hover {
  background: #f3f6fa;
  color: #1f2329;
}

.sidebar .nav.active {
  background: #e8f3ff;
  color: #1677ff;
}

.kb-nav-head {
  min-height: 32px;
  color: #4e5969;
  font-size: 13px;
  font-weight: 600;
}

.kb-group-toggle {
  min-height: 32px;
  color: #4e5969;
  font-size: 13px;
  font-weight: 600;
}

.kb-nav-head .icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #eaecef;
  border-radius: 10px;
  background: #ffffff;
  color: #4e5969;
}

.workspace-project {
  margin-left: 14px;
}

.workspace-project-head {
  min-height: 32px;
  padding: 0 6px;
  color: #4e5969;
  font-size: 13px;
  font-weight: 600;
}

.workspace-project-list {
  gap: 5px;
  padding-left: 8px;
}

.workspace-card {
  min-height: 36px;
  grid-template-columns: minmax(0, 1fr);
  margin-left: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #1f2329;
}

.workspace-card strong {
  color: #1f2329;
  font-size: 13px;
  font-weight: 500;
}

.workspace-card:hover {
  background: #f3f6fa;
}

.workspace-card.active {
  background: #e8f3ff;
}

.workspace-card.active strong {
  color: #1677ff;
}

.workspace-project-empty {
  padding: 8px 10px 8px 22px;
  color: #86909c;
  font-size: 13px;
}

.sidebar-bottom {
  display: grid;
  gap: 6px;
  padding-top: 6px;
}

.sidebar-logout {
  width: 100%;
  padding: 0 12px;
}

.content,
.kb-workbench {
  background: #f7f8fa;
}

.kb-empty {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: #f7f8fa;
}

.empty-copy-card {
  width: min(860px, 100%);
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  padding: 64px 32px;
  border: 1px solid #eaecef;
  border-radius: 20px;
  background: #ffffff;
}

.kb-empty h3,
.kb-empty p {
  margin: 0;
  text-align: center;
}

.kb-empty h3 {
  color: #1f2329;
  font-size: 36px;
  line-height: 1.5;
  font-weight: 700;
}

.kb-empty p {
  margin-top: 16px;
  color: #86909c;
  font-size: 15px;
  line-height: 1.6;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: auto;
    height: auto;
    position: static;
  }

  .kb-empty {
    min-height: 70vh;
    padding: 20px;
  }

  .empty-copy-card {
    min-height: 280px;
  }

  .kb-empty h3 {
    font-size: 28px;
  }
}

/* Files center refinement */
#filesView {
  min-height: 100vh;
  padding: 32px;
  background: #f7f8fa;
}

#filesView .files-page {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

#filesView .files-hero {
  margin-bottom: 24px;
}

#filesView .files-hero h2 {
  margin: 0;
  color: #1f2329;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
}

#filesView .files-hero p {
  margin: 8px 0 0;
  color: #86909c;
  font-size: 14px;
  line-height: 1.5;
}

#filesView .files-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 0;
}

#filesView .files-upload-card,
#filesView .files-browser-card {
  min-width: 0;
  border: 1px solid #eaecef;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

#filesView .files-upload-card {
  display: grid;
  gap: 16px;
  padding: 24px;
}

#filesView .files-browser-card {
  display: grid;
  gap: 18px;
  padding: 24px;
}

#filesView .panel-head {
  margin: 0;
  align-items: start;
}

#filesView .panel-head h3 {
  margin: 0;
  color: #1f2329;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
}

#filesView .panel-head p {
  margin: 6px 0 0;
  color: #86909c;
  font-size: 13px;
  line-height: 1.5;
}

#filesView #uploadState {
  color: #86909c;
  font-size: 12px;
  font-weight: 500;
}

#filesView .field {
  gap: 8px;
  color: #1f2329;
  font-size: 13px;
  font-weight: 600;
}

#filesView select,
#filesView input {
  min-height: 44px;
  border: 1px solid #eaecef;
  border-radius: 12px;
  background: #ffffff;
  color: #1f2329;
  box-shadow: none;
  font-size: 14px;
}

#filesView select:focus,
#filesView input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

#filesView #dropzone {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: #f8fafc;
  color: #86909c;
  text-align: center;
}

#filesView #dropzone.dragover {
  border-color: #1677ff;
  background: #f5f9ff;
}

#filesView #dropzone .upload-cloud-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #e8f3ff;
  color: #1677ff;
  font-size: 28px;
  line-height: 1;
}

#filesView #dropzone strong {
  color: #1f2329;
  font-size: 15px;
  font-weight: 700;
}

#filesView #dropzone span:not(.upload-cloud-icon) {
  color: #86909c;
  font-size: 13px;
}

#filesView #dropzone em {
  display: block;
  margin-top: 6px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #86909c;
  font-size: 12px;
  font-style: normal;
  font-weight: 500;
}

#filesView .picked {
  gap: 8px;
}

#filesView .picked-item {
  border: 1px solid #eaecef;
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px 12px;
}

#filesView .files-upload-card > .primary {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  background: #1677ff;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

#filesView .files-upload-card > .primary:hover {
  background: #0f67dd;
}

#filesView .files-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

#filesView #fileCategory {
  width: 132px;
}

#filesView .files-view-toggle {
  width: 40px;
  height: 40px;
  border: 1px solid #eaecef;
  border-radius: 12px;
  background: #ffffff;
  color: #4e5969;
  cursor: default;
  font-size: 16px;
}

#filesView .file-pathbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #eaecef;
  border-radius: 14px;
  background: #f8fafc;
}

#filesView #fileUpBtn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #eaecef;
  border-radius: 10px;
  background: #ffffff;
  color: #1f2329;
  font-size: 13px;
  font-weight: 600;
}

#filesView #fileUpBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#filesView #filePath {
  min-height: auto;
  flex: 1;
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  color: #86909c;
  font-size: 13px;
}

#filesView .file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  align-content: start;
}

#filesView .file-card {
  position: relative;
  min-height: 120px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
  align-content: start;
  padding: 20px;
  border: 1px solid #eaecef;
  border-radius: 16px;
  background: #ffffff;
  color: #1f2329;
  text-align: left;
  box-shadow: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

#filesView button.file-card {
  cursor: pointer;
}

#filesView .file-card:hover {
  transform: translateY(-2px);
  border-color: #dbe2ea;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

#filesView .file-card-menu {
  position: absolute;
  top: 14px;
  right: 16px;
  color: #86909c;
  font-size: 16px;
  line-height: 1;
}

#filesView .file-type-icon {
  width: 48px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #eef2ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
}

#filesView .folder-icon {
  width: 54px;
  color: transparent;
  background: #e8f3ff;
}

#filesView .folder-icon::before {
  content: "";
  width: 34px;
  height: 24px;
  display: block;
  border-radius: 7px 7px 8px 8px;
  background: #5aa8ff;
  box-shadow: 0 -7px 0 -2px #8bc3ff;
}

#filesView .type-pdf { background: #fee2e2; color: #dc2626; }
#filesView .type-docx { background: #dbeafe; color: #2563eb; }
#filesView .type-xlsx { background: #dcfce7; color: #16a34a; }
#filesView .type-md { background: #f1f5f9; color: #334155; }
#filesView .type-img { background: #f3e8ff; color: #7c3aed; }
#filesView .type-txt { background: #fef3c7; color: #d97706; }

#filesView .file-card strong {
  min-width: 0;
  overflow: hidden;
  color: #1f2329;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#filesView .file-card small {
  color: #86909c;
  font-size: 12px;
  line-height: 1.45;
}

#filesView .file-card .row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

#filesView .file-card:hover .row-actions {
  opacity: 1;
  pointer-events: auto;
}

#filesView .file-card .secondary {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: #f3f6fa;
  color: #1f2329;
  font-size: 12px;
  font-weight: 600;
}

#filesView .files-empty-state {
  min-height: 260px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  grid-column: 1 / -1;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: #ffffff;
  color: #86909c;
  text-align: center;
}

#filesView .files-empty-state strong {
  color: #1f2329;
  font-size: 17px;
}

#filesView .files-empty-state span {
  color: #86909c;
  font-size: 13px;
}

@media (max-width: 1100px) {
  #filesView .files-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #filesView {
    padding: 20px;
  }

  #filesView .file-list {
    grid-template-columns: 1fr;
  }

  #filesView .files-toolbar {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Knowledge base navigation tree */
[data-workspace-nav-section="personal"] .kb-nav-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 6px;
}

#newWorkspaceGroupBtn {
  display: none !important;
}

#newWorkspaceBtn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, background 0.16s ease;
}

[data-workspace-nav-section="personal"] .kb-nav-head:hover #newWorkspaceBtn {
  opacity: 1;
  pointer-events: auto;
}

[data-workspace-nav-section="personal"] .kb-group-toggle {
  height: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: 10px;
  color: #1f2329;
  font-size: 14px;
  font-weight: 600;
}

[data-workspace-nav-section="personal"] .kb-group-toggle:hover {
  background: #f5f7fa;
}

[data-workspace-nav-section="personal"] .kb-group-arrow {
  width: 12px;
  color: #86909c;
  font-size: 12px;
}

[data-workspace-nav-section="personal"] .workspace-list {
  display: grid;
  gap: 4px;
  padding-left: 0;
}

[data-workspace-nav-section="personal"].kb-nav-group::before,
[data-workspace-nav-section="personal"] .workspace-project-name::before {
  display: none;
  content: none;
}

[data-workspace-nav-section="personal"] .workspace-project {
  margin: 0;
}

[data-workspace-nav-section="personal"] .workspace-project + .workspace-project {
  margin-top: 2px;
}

[data-workspace-nav-section="personal"] .workspace-project-head {
  height: 40px;
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 4px;
  padding: 0;
  border-radius: 10px;
  position: relative;
}

[data-workspace-nav-section="personal"] .workspace-project-head:hover {
  background: #f5f7fa;
}

.workspace-project-toggle {
  min-width: 0;
  height: 40px;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #1f2329;
  cursor: pointer;
  padding: 0 8px 0 12px;
  text-align: left;
}

.workspace-tree-arrow {
  width: 12px;
  color: #86909c;
  font-size: 12px;
  line-height: 1;
}

[data-workspace-nav-section="personal"] .workspace-project-name {
  min-width: 0;
  overflow: hidden;
  color: #1f2329;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-more-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #86909c;
  cursor: pointer;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
}

.workspace-project-head:hover .workspace-more-btn,
.workspace-card:hover .workspace-more-btn,
.workspace-tree-menu-wrap.open .workspace-more-btn {
  opacity: 1;
  pointer-events: auto;
}

.workspace-more-btn:hover {
  background: #eef1f5;
  color: #1f2329;
}

[data-workspace-nav-section="personal"] .workspace-project-list {
  display: grid;
  gap: 4px;
  padding-left: 0;
}

[data-workspace-nav-section="personal"] .workspace-card {
  height: 40px;
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 4px;
  padding: 0 6px 0 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #1f2329;
  position: relative;
}

[data-workspace-nav-section="personal"] .workspace-card:hover {
  background: #f5f7fa;
}

[data-workspace-nav-section="personal"] .workspace-card.active {
  background: #eaf3ff;
}

.workspace-doc-icon {
  width: 18px;
  color: #86909c;
  font-size: 14px;
  line-height: 1;
}

.workspace-open {
  min-width: 0;
  height: 40px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0 4px 0 32px;
  text-align: left;
}

[data-workspace-nav-section="personal"] .workspace-card strong {
  min-width: 0;
  overflow: hidden;
  color: #1f2329;
  font-size: 14px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-workspace-nav-section="personal"] .workspace-card.active strong {
  color: #1677ff;
}

.workspace-tree-menu-wrap,
.kb-head-menu-wrap {
  position: relative;
}

.workspace-tree-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 128px;
  display: none;
  padding: 6px;
  border: 1px solid #eaecef;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.workspace-tree-menu-wrap.open .workspace-tree-menu,
.kb-head-menu-wrap.open .workspace-tree-menu {
  display: grid;
  gap: 2px;
}

.workspace-tree-menu button {
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1f2329;
  cursor: pointer;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
}

.workspace-tree-menu button:hover {
  background: #f5f7fa;
}

/* Collapsible workspace chat history */
.workspace-chat-panel {
  position: fixed;
  top: 96px;
  left: calc(280px + (100vw - 280px) / 2);
  z-index: 30;
  width: min(980px, calc(100vw - 360px));
  max-height: calc(100vh - 260px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
  transform: translateX(-50%);
  border: 1px solid #eaecef;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
}

.workspace-chat-panel.hidden {
  display: none !important;
}

.workspace-chat-panel .kb-chat-head {
  width: 100%;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 18px 20px;
  border: 0;
  border-bottom: 1px solid #eaecef;
  border-radius: 0;
  background: #ffffff;
  color: #1f2329;
  cursor: pointer;
  text-align: left;
}

.workspace-chat-panel .kb-chat-head:hover {
  background: #f8fafc;
}

.workspace-chat-panel .kb-chat-head h3 {
  color: #1f2329;
  font-size: 20px;
  font-weight: 700;
}

.workspace-chat-panel .kb-chat-head p {
  margin-top: 6px;
  color: #86909c;
  font-size: 13px;
}

.chat-history-chevron {
  min-width: 46px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f3f6fa;
  color: #4e5969;
  font-size: 12px;
  font-weight: 600;
}

.workspace-chat-history {
  min-height: 0;
  padding: 18px 20px 20px;
  overflow: auto;
}

.workspace-chat-history.hidden {
  display: none !important;
}

.workspace-chat-panel .workspace-messages {
  max-height: none;
  min-height: min(420px, calc(100vh - 380px));
  overflow: auto;
}

@media (max-width: 900px) {
  .workspace-chat-panel {
    top: 72px;
    left: 50%;
    width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
  }
}

/* Unified chat drawer: history and composer are one surface */
#workspaceChatFloat.kb-chat-dock {
  position: fixed;
  left: calc(280px + (100vw - 280px) / 2);
  bottom: 24px;
  z-index: 40;
  width: min(980px, calc(100vw - 360px));
  display: grid;
  transform: translateX(-50%);
}

#workspaceChatFloat:has(.workspace-chat-panel:not(.hidden)) {
  grid-template-rows: minmax(0, 1fr) auto;
  max-height: calc(100vh - 120px);
  overflow: hidden;
  border: 1px solid #eaecef;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.14);
}

#workspaceChatFloat .workspace-chat-panel {
  position: static;
  width: 100%;
  max-height: none;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  transform: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#workspaceChatFloat .workspace-chat-panel.hidden {
  display: none !important;
}

#workspaceChatFloat .workspace-chat-history {
  max-height: calc(100vh - 330px);
  padding: 16px 20px 18px;
}

#workspaceChatFloat .workspace-chat-panel .workspace-messages {
  min-height: min(420px, calc(100vh - 380px));
}

#workspaceChatFloat:has(.workspace-chat-panel:not(.hidden)) .kb-input-section {
  padding: 0;
  border-top: 1px solid #eaecef;
}

#workspaceChatFloat:has(.workspace-chat-panel:not(.hidden)) .kb-composer {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#workspaceChatFloat:not(:has(.workspace-chat-panel:not(.hidden))) .kb-composer {
  width: min(940px, 100%);
}

#workspaceChatFloat .kb-composer textarea {
  box-sizing: border-box;
  min-height: 58px;
  line-height: 1.6;
  padding: 4px 0 2px;
  overflow: hidden;
}

@media (max-width: 900px) {
  #workspaceChatFloat.kb-chat-dock {
    left: 50%;
    width: calc(100vw - 32px);
  }
}

/* Sidebar navigation polish */
.app-shell,
.app-shell:has(#todosView:not(.hidden)),
.app-shell:has(#settingsView:not(.hidden)) {
  grid-template-columns: minmax(270px, 280px) minmax(0, 1fr);
}

.sidebar,
.app-shell:has(#todosView:not(.hidden)) .sidebar,
.app-shell:has(#settingsView:not(.hidden)) .sidebar {
  width: 280px;
  min-width: 270px;
  padding: 24px 18px;
  border-right: 1px solid #eaecef;
  background: #ffffff;
  color: #1f2329;
}

.brand {
  padding: 0 0 8px;
}

.brand-row {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: #e8f3ff;
  color: #1677ff;
  box-shadow: none;
  font-size: 14px;
  font-weight: 700;
}

.brand h1 {
  color: #1f2329;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
}

.brand p {
  margin-top: 8px;
  color: #86909c;
  font-size: 12px;
  line-height: 1.45;
}

.sidebar-search {
  height: 40px;
  margin-top: 18px;
  padding: 0 12px;
  border: 1px solid #eaecef;
  border-radius: 12px;
  background: #f7f8fa;
  color: #86909c;
}

.sidebar-search input {
  border: 0;
  background: transparent;
  padding: 0;
  color: #1f2329;
  font-size: 14px;
  box-shadow: none;
}

.sidebar-search input::placeholder {
  color: #a5a9b5;
  font-size: 14px;
}

.kb-nav {
  display: grid;
  gap: 8px;
  align-content: start;
  overflow: auto;
  padding: 0 2px 10px 0;
}

.sidebar .nav,
.sidebar-logout,
[data-workspace-nav-section="personal"] .kb-group-toggle {
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #1f2329;
  cursor: pointer;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}

.sidebar .nav::before,
.sidebar-logout::before {
  width: 16px;
  min-width: 16px;
  display: inline-grid !important;
  place-items: center;
  margin: 0 !important;
  color: currentColor;
  font-size: 16px;
  line-height: 1;
}

.sidebar .nav[data-view="dashboard"]::before { content: ""; }
.sidebar .nav[data-view="workspaces"]::before { content: ""; }
.sidebar .nav[data-view="todos"]::before { content: ""; }
.sidebar .nav[data-view="settings"]::before { content: ""; }
.sidebar-logout::before { content: ""; }

.sidebar .nav:hover,
.sidebar-logout:hover,
[data-workspace-nav-section="personal"] .kb-group-toggle:hover {
  background: #f5f7fa;
  color: #1f2329;
}

.sidebar .nav.active,
.sidebar .nav[data-view="workspaces"].active {
  border-radius: 10px;
  background: #eaf3ff;
  color: #1677ff;
  font-weight: 600;
}

.app-shell:has(#workspacesView:not(.hidden)) [data-workspace-nav-section="personal"] .kb-group-toggle {
  background: #eaf3ff;
  color: #1677ff;
  font-weight: 600;
}

[data-workspace-nav-section="personal"] .kb-nav-head {
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px;
  margin-top: 0;
  color: #1f2329;
}

[data-workspace-nav-section="personal"] .kb-group-toggle {
  min-width: 0;
  padding: 0 12px;
  font-size: 15px;
  font-weight: 500;
}

[data-workspace-nav-section="personal"] .kb-group-toggle span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-workspace-nav-section="personal"] .kb-group-arrow,
.workspace-tree-arrow {
  width: 12px;
  min-width: 12px;
  color: #86909c;
  font-size: 12px;
}

#newWorkspaceBtn {
  width: 32px;
  height: 32px;
  border: 1px solid #eaecef;
  border-radius: 10px;
  background: #ffffff;
  color: #4e5969;
  font-size: 16px;
}

#newWorkspaceBtn:hover {
  background: #f5f7fa;
  color: #1677ff;
}

[data-workspace-nav-section="personal"] .workspace-list {
  gap: 4px;
  padding-left: 16px;
}

[data-workspace-nav-section="personal"] .workspace-project-head {
  height: 40px;
  min-height: 40px;
  border-radius: 10px;
}

.workspace-project-toggle {
  height: 40px;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 8px;
  padding: 0 8px;
}

[data-workspace-nav-section="personal"] .workspace-project-name {
  color: #1f2329;
  font-size: 14px;
  font-weight: 600;
}

[data-workspace-nav-section="personal"] .workspace-project-list {
  padding-left: 20px;
}

[data-workspace-nav-section="personal"] .workspace-card {
  height: 40px;
  min-height: 40px;
  border-radius: 10px;
}

.workspace-open {
  height: 40px;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  padding: 0 4px 0 10px;
}

.workspace-doc-icon {
  width: 18px;
  color: #86909c;
  font-size: 14px;
}

[data-workspace-nav-section="personal"] .workspace-card strong {
  color: #1f2329;
  font-size: 14px;
  font-weight: 400;
}

[data-workspace-nav-section="personal"] .workspace-card:hover,
[data-workspace-nav-section="personal"] .workspace-project-head:hover {
  background: #f5f7fa;
}

[data-workspace-nav-section="personal"] .workspace-card.active {
  background: #eaf3ff;
}

[data-workspace-nav-section="personal"] .workspace-card.active strong {
  color: #1677ff;
}

/* Fix workspace tree garbling/layout regressions */
.workspace-project-toggle {
  grid-template-columns: 12px minmax(0, 1fr) auto;
}

[data-workspace-nav-section="personal"] .workspace-project-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-workspace-nav-section="personal"] .workspace-project-toggle small {
  min-width: 24px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #eef4fb;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.workspace-more-btn {
  line-height: 1;
  letter-spacing: 0;
}

.workspace-tree-menu {
  min-width: 132px;
}

.workspace-tree-menu button {
  width: 100%;
  white-space: nowrap;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}

.workspace-open {
  grid-template-columns: minmax(0, 1fr);
  padding-left: 16px;
}

.workspace-doc-icon {
  display: none !important;
}

.sidebar-bottom {
  display: grid;
  gap: 8px;
  padding-top: 0;
}

.sidebar-logout {
  width: 100%;
  justify-content: flex-start;
}

.app-shell:has(#todosView:not(.hidden)) [data-workspace-nav-section="personal"] .kb-group-toggle {
  color: #1f2329;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar .nav.active {
  background: #eaf3ff;
  color: #1677ff;
  font-weight: 600;
}

@media (max-width: 760px) {
  .app-shell,
  .app-shell:has(#todosView:not(.hidden)),
  .app-shell:has(#settingsView:not(.hidden)) {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .app-shell:has(#todosView:not(.hidden)) .sidebar,
  .app-shell:has(#settingsView:not(.hidden)) .sidebar {
    width: auto;
    min-width: 0;
  }
}

/* Prototype visual migration: blue-white knowledge workspace */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --soft: #f8fafc;
}

body {
  overflow: hidden;
  background: #f8fafc;
  color: #1e293b;
}

.app-shell,
.app-shell:has(#todosView:not(.hidden)),
.app-shell:has(#settingsView:not(.hidden)) {
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  background: #f8fafc;
}

.sidebar,
.app-shell:has(#todosView:not(.hidden)) .sidebar,
.app-shell:has(#settingsView:not(.hidden)) .sidebar {
  width: 240px;
  min-width: 240px;
  height: 100vh;
  padding: 24px 16px;
  border-right: 1px solid #edf2f7;
  background: #ffffff;
  color: #1e293b;
  box-shadow: none;
}

.brand {
  padding: 0 8px 10px;
}

.brand-row {
  min-height: 40px;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #eff6ff;
  color: #2563eb;
  font-size: 16px;
}

.brand h1 {
  color: #1e293b;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
}

.brand p {
  margin-top: 2px;
  color: #94a3b8;
  font-size: 11px;
}

.sidebar-search {
  height: 36px;
  margin: 18px 0 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.sidebar-search span {
  color: #94a3b8;
}

.sidebar-search input {
  color: #1e293b;
  font-size: 13px;
}

.kb-nav {
  gap: 7px;
  padding-right: 0;
}

.sidebar .nav,
.sidebar-logout,
[data-workspace-nav-section="personal"] .kb-group-toggle,
[data-workspace-nav-section="projects"] .kb-group-toggle {
  height: 38px;
  min-height: 38px;
  border-radius: 10px;
  color: #64748b;
  font-size: 13.5px;
  font-weight: 500;
}

.sidebar .nav:hover,
.sidebar-logout:hover,
[data-workspace-nav-section="personal"] .kb-group-toggle:hover,
[data-workspace-nav-section="projects"] .kb-group-toggle:hover,
[data-workspace-nav-section="personal"] .workspace-card:hover,
[data-workspace-nav-section="personal"] .workspace-project-head:hover {
  background: #f8fafc;
  color: #1e293b;
}

.sidebar .nav.active,
.sidebar .nav[data-view="workspaces"].active,
.app-shell:has(#workspacesView:not(.hidden)) [data-workspace-nav-section="personal"] .kb-group-toggle,
[data-workspace-nav-section="personal"] .workspace-card.active,
.app-shell:has(#todosView:not(.hidden)) .sidebar .nav.active {
  background: #eef2ff;
  color: #2563eb;
  font-weight: 600;
}

.sidebar .nav::before,
.sidebar-logout::before {
  color: currentColor;
  font-size: 15px;
}

[data-workspace-nav-section="personal"] .kb-nav-head {
  grid-template-columns: minmax(0, 1fr) 30px;
  margin-top: 2px;
}

[data-workspace-nav-section="personal"] .kb-group-toggle {
  padding: 0 12px;
}

[data-workspace-nav-section="personal"] .kb-group-toggle span:last-child {
  font-size: 13.5px;
}

#newWorkspaceBtn,
#newWorkspaceGroupBtn {
  width: 30px;
  height: 30px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #64748b;
  font-size: 16px;
}

#newWorkspaceBtn:hover,
#newWorkspaceGroupBtn:hover {
  background: #f8fafc;
  color: #2563eb;
}

[data-workspace-nav-section="personal"] .workspace-list {
  padding-left: 16px;
}

[data-workspace-nav-section="personal"] .workspace-project-toggle small {
  background: #f1f5f9;
  color: #64748b;
}

[data-workspace-nav-section="personal"] .workspace-card strong,
[data-workspace-nav-section="personal"] .workspace-project-name {
  color: inherit;
  font-size: 13px;
}

.sidebar-bottom {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.sidebar-logout {
  margin-top: auto;
  color: #ef4444;
}

.content {
  height: 100vh;
  overflow: auto;
  padding: 0;
  background: #f8fafc;
}

.topbar {
  display: none;
}

#workspacesView.view {
  min-height: 100vh;
}

.kb-workbench {
  min-height: 100vh;
  padding: 32px;
}

.kb-detail {
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.kb-header {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.kb-title-wrap h2 {
  color: #1e293b;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
}

.kb-title-wrap p {
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
}

.kb-header-actions {
  gap: 8px;
}

.kb-header-actions .icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #64748b;
  font-size: 18px;
}

.kb-header-actions .primary {
  min-height: 36px;
  border-radius: 8px;
  padding: 0 16px;
  background: #2563eb;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.kb-header-actions .primary:hover {
  background: #1d4ed8;
}

.kb-workspace-grid {
  display: block;
  min-height: 0;
}

.kb-main-column {
  min-height: 0;
}

.kb-tabs {
  display: none;
}

.kb-file-section {
  min-height: calc(100vh - 132px);
  margin-top: 8px;
  padding: 24px;
  border: 1px solid #edf2f7;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: none;
}

.kb-section-head {
  align-items: center;
  margin-bottom: 20px;
  padding: 0;
  border: 0;
}

.kb-section-head h3 {
  color: #1e293b;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 700;
}

.kb-section-head p,
.kb-section-head span {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 12px;
}

.kb-file-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.workspace-file-search {
  width: 180px;
  height: 32px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #1e293b;
  padding: 6px 12px;
  font-size: 12px;
}

#workspaceFileSelectAllBtn {
  min-height: 32px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #475569;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 500;
}

.workspace-files {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.workspace-file-card {
  min-height: 152px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  position: relative;
  padding: 16px;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.workspace-file-card:hover {
  border-color: #e0e7ff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.workspace-file-card.selected {
  border-color: #2563eb;
  background: #f8fbff;
}

.workspace-file-card .file-thumb {
  width: 40px;
  height: 40px;
  margin: 0 0 12px;
  border-radius: 8px;
  background: #fff5f5;
  color: #ef4444;
  font-size: 12px;
}

.workspace-file-card .file-type-mark {
  font-size: 11px;
  font-weight: 800;
}

.workspace-file-card .file-type-name {
  display: none;
}

.workspace-file-card .file-card-body {
  width: 100%;
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
}

.workspace-file-card .file-card-body strong {
  height: 38px;
  color: #1e293b;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 600;
  overflow: hidden;
}

.workspace-file-card .file-card-body small {
  margin-top: 8px;
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.4;
}

.workspace-file-card .file-select {
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.08);
}

.workspace-file-card .file-card-actions {
  right: 9px;
  bottom: 9px;
}

.workspace-file-card .file-card-actions .ghost-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #94a3b8;
}

.workspace-upload-empty,
.empty-note {
  border: 1px dashed #dbe3ef;
  border-radius: 12px;
  background: #f8fafc;
  color: #64748b;
}

#workspaceChatFloat.kb-chat-dock {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: 24px;
  left: auto;
  z-index: 45;
  width: min(65vw, calc(100vw - 320px));
  max-width: none;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  pointer-events: none;
}

#workspaceChatFloat.hidden {
  display: none !important;
}

#workspaceChatFloat:has(.workspace-chat-panel:not(.hidden)) {
  max-height: none;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.05), 0 10px 10px -5px rgba(15, 23, 42, 0.02);
  pointer-events: auto;
}

#workspaceChatFloat .workspace-chat-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#workspaceChatFloat .workspace-chat-panel.hidden {
  display: none !important;
}

#workspaceChatFloat .kb-chat-head {
  min-height: 73px;
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
}

#workspaceChatFloat .kb-chat-head h3 {
  color: #1e293b;
  font-size: 16px;
  font-weight: 700;
}

#workspaceChatFloat .kb-chat-head p {
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
}

#workspaceChatFloat .chat-history-chevron {
  color: #94a3b8;
  font-size: 13px;
}

#workspaceChatFloat .workspace-chat-history {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  background: #fafbfe;
}

#workspaceChatFloat .workspace-chat-panel .workspace-messages {
  min-height: 0;
  height: 100%;
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: #fafbfe;
  padding: 24px;
}

#workspaceChatFloat .workspace-message {
  max-width: 75%;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
}

#workspaceChatFloat .workspace-message.assistant {
  align-self: flex-start;
  border: 1px solid #edf2f7;
  border-bottom-left-radius: 2px;
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.01);
}

#workspaceChatFloat .workspace-message.user {
  align-self: flex-end;
  border: 0;
  border-bottom-right-radius: 2px;
  background: #2563eb;
  color: #ffffff;
}

#workspaceChatFloat .workspace-message.user .message-meta,
#workspaceChatFloat .workspace-message.user .message-body {
  color: #ffffff;
}

#workspaceChatFloat .message-meta {
  color: #94a3b8;
  font-size: 11px;
}

#workspaceChatFloat:has(.workspace-chat-panel:not(.hidden)) .kb-input-section {
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
}

#workspaceChatFloat .kb-composer {
  gap: 12px;
  padding: 16px 24px 20px;
  border: 0;
  background: #ffffff;
  box-shadow: none;
}

#workspaceChatFloat .kb-composer textarea {
  min-height: 46px;
  max-height: 120px;
  padding: 12px 46px 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 13.5px;
  resize: none;
}

#workspaceChatFloat .kb-composer textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

#workspaceChatFloat .kb-composer-bar {
  min-height: 28px;
  align-items: center;
}

#workspaceChatFloat .kb-composer .chat-controls {
  width: auto;
  margin: 0;
}

#workspaceChatFloat .kb-composer select {
  width: auto;
  max-width: 260px;
  min-height: 28px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #1e293b;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
}

#workspaceChatFloat .composer-actions {
  position: absolute;
  right: 32px;
  bottom: 64px;
}

#workspaceChatFloat .composer-icon.send {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  box-shadow: none;
}

.kb-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4);
  color: #ffffff;
}

.kb-chat-launcher::before {
  content: "";
  width: 16px;
  height: 16px;
  border-left: 4px solid currentColor;
  border-bottom: 4px solid currentColor;
  border-radius: 2px;
  transform: rotate(45deg);
}

@media (max-width: 1100px) {
  #workspaceChatFloat.kb-chat-dock {
    width: calc(100vw - 300px);
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .app-shell,
  .app-shell:has(#todosView:not(.hidden)),
  .app-shell:has(#settingsView:not(.hidden)) {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .app-shell:has(#todosView:not(.hidden)) .sidebar,
  .app-shell:has(#settingsView:not(.hidden)) .sidebar {
    width: auto;
    min-width: 0;
    height: auto;
  }

  .content {
    height: auto;
    min-height: 100vh;
  }

  .kb-workbench {
    padding: 20px;
  }

  .kb-header {
    align-items: flex-start;
  }

  .kb-file-section {
    min-height: auto;
    padding: 18px;
  }

  .kb-section-head,
  .kb-file-actions {
    align-items: stretch;
  }

  .workspace-file-search {
    width: 100%;
  }

  .workspace-files {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  #workspaceChatFloat.kb-chat-dock {
    inset: 16px;
    width: auto;
  }
}

/* Keep the existing collapsed composer workflow intact. */
#workspaceChatFloat.kb-chat-dock:not(:has(.workspace-chat-panel:not(.hidden))) {
  top: auto;
  right: auto;
  bottom: 24px;
  left: calc(240px + (100vw - 240px) / 2);
  width: min(940px, calc(100vw - 300px));
  transform: translateX(-50%);
  pointer-events: auto;
}

#workspaceChatFloat.kb-chat-dock:not(:has(.workspace-chat-panel:not(.hidden))) .kb-input-section,
#workspaceChatFloat.kb-chat-dock:not(:has(.workspace-chat-panel:not(.hidden))) .kb-composer {
  width: 100%;
}

#workspaceChatFloat .kb-input-section,
#workspaceChatFloat .kb-composer {
  pointer-events: auto;
}

#workspaceChatFloat .kb-composer {
  position: relative;
}

#workspaceChatFloat .composer-actions {
  top: 28px;
  bottom: auto;
}

@media (max-width: 760px) {
  #workspaceChatFloat.kb-chat-dock:not(:has(.workspace-chat-panel:not(.hidden))) {
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
    transform: none;
  }
}

/* Strict prototype alignment pass */
.sidebar {
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
}

.brand {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-areas:
    "mark name"
    "mark email";
  column-gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  padding: 4px 8px;
}

.brand-row {
  display: contents;
}

.brand-mark {
  grid-area: mark;
}

.brand h1 {
  grid-area: name;
  align-self: end;
  font-size: 15px;
  font-weight: 600;
}

.brand p {
  grid-area: email;
  align-self: start;
  margin: 0;
  color: #94a3b8;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-nav::before,
.sidebar-bottom::before {
  display: block;
  padding: 0 8px;
  margin: 0 0 6px;
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 400;
}

.kb-nav::before {
  content: "鍐呭";
}

.sidebar-bottom::before {
  content: "绯荤粺";
}

.sidebar-bottom {
  margin-top: 16px;
  margin-bottom: auto;
  border-top: 0;
}

.sidebar-logout {
  flex: 0 0 auto;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.kb-header {
  margin-bottom: 8px;
}

.kb-file-section {
  flex: 1 1 auto;
  margin-top: 16px;
}

.workspace-file-card {
  min-height: 146px;
}

.workspace-file-card .file-card-body small {
  width: 100%;
  display: flex;
  justify-content: space-between;
}

#workspaceChatFloat.kb-chat-dock:not(:has(.workspace-chat-panel:not(.hidden))) {
  display: none !important;
}

#workspaceChatFloat.kb-chat-dock:has(.workspace-chat-panel:not(.hidden)) {
  width: calc(65vw - 24px);
  opacity: 1;
  transform: translateX(0) scale(1);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#workspaceChatFloat .kb-chat-head {
  cursor: default;
}

#workspaceChatFloat .chat-history-chevron {
  font-size: 0;
}

#workspaceChatFloat .chat-history-chevron::before {
  content: "脳";
  font-size: 20px;
  line-height: 1;
}

#workspaceChatFloat .workspace-chat-panel .workspace-messages > .empty-note {
  width: fit-content;
  max-width: 75%;
  align-self: flex-start;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  border-bottom-left-radius: 2px;
  background: #ffffff;
  color: #1e293b;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
}

#workspaceChatFloat .message-footer {
  border-top-color: #f1f5f9;
}

#workspaceChatFloat .message-files span,
#workspaceChatFloat .message-actions .secondary {
  border: 1px solid #e0e7ff;
  background: #ffffff;
  color: #2563eb;
}

#workspaceChatFloat .kb-composer {
  display: grid;
  grid-template-columns: 1fr;
}

#workspaceChatFloat .kb-composer-bar::before {
  content: "褰撳墠妯″瀷:";
  color: #64748b;
  font-size: 12px;
}

#workspaceChatFloat .kb-composer .field {
  display: block;
}

#workspaceChatFloat .composer-actions {
  right: 32px;
  top: 28px;
}

.kb-chat-launcher:not(.hidden) {
  display: flex !important;
  align-items: center;
  justify-content: center;
  z-index: 99;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.kb-chat-launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -5px rgba(37, 99, 235, 0.45);
}

.kb-chat-launcher.has-custom-icon {
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.16);
  background-color: #ffffff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.kb-chat-launcher.has-custom-icon::before {
  display: none;
}

@media (max-width: 1100px) {
  #workspaceChatFloat.kb-chat-dock:has(.workspace-chat-panel:not(.hidden)) {
    width: calc(100vw - 300px);
  }
}

@media (max-width: 760px) {
  .brand {
    max-width: 240px;
  }

  .sidebar-bottom {
    margin-bottom: 0;
  }

  #workspaceChatFloat.kb-chat-dock:has(.workspace-chat-panel:not(.hidden)) {
    width: auto;
  }
}

/* Notes page prototype alignment */
.app-shell:has(#todosView:not(.hidden)) {
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar {
  width: 260px;
  min-width: 260px;
  height: 100vh;
  padding: 32px 20px 24px;
  border-right: 1px solid #edf2f7;
  background: #ffffff;
}

.app-shell:has(#todosView:not(.hidden)) .brand {
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 14px;
  margin-bottom: 24px;
  padding: 0 0 0 4px;
}

.app-shell:has(#todosView:not(.hidden)) .brand-mark {
  width: 44px;
  height: 44px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 18px;
}

.app-shell:has(#todosView:not(.hidden)) .brand h1 {
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
}

.app-shell:has(#todosView:not(.hidden)) .brand p {
  color: #64748b;
  font-size: 13px;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar-search {
  height: 42px;
  margin: 0 0 24px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  padding: 0 14px;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar-search span {
  color: #94a3b8;
  font-size: 15px;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar-search input {
  color: #1e293b;
  font-size: 14px;
}

.app-shell:has(#todosView:not(.hidden)) .kb-nav::before,
.app-shell:has(#todosView:not(.hidden)) .sidebar-bottom::before {
  padding-left: 8px;
  margin: 12px 0 8px;
  color: #94a3b8;
  font-size: 13px;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar .nav,
.app-shell:has(#todosView:not(.hidden)) .sidebar-logout,
.app-shell:has(#todosView:not(.hidden)) [data-workspace-nav-section="personal"] .kb-group-toggle {
  height: 42px;
  min-height: 42px;
  border-radius: 12px;
  color: #1e293b;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 500;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar .nav.active,
.app-shell:has(#todosView:not(.hidden)) [data-workspace-nav-section="personal"] .kb-group-toggle {
  background: #eef2ff;
  color: #2563eb;
  font-weight: 600;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar-bottom {
  margin-top: 12px;
}

.app-shell:has(#todosView:not(.hidden)) .sidebar-logout {
  margin-top: auto;
  padding: 10px 8px 0;
  border-top: 1px solid #f1f5f9;
  color: #ef4444;
}

.app-shell:has(#todosView:not(.hidden)) .content {
  height: 100vh;
  overflow: hidden;
  padding: 0;
  background: #ffffff;
}

#todosView {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

#todosView .notes-shell {
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 0;
  background: #ffffff;
}

#todosView .notes-sidebar {
  width: 290px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid #edf2f7;
  border-radius: 0;
  background: #fafafa;
  box-shadow: none;
}

#todosView .notes-sidebar .panel-head {
  min-height: auto;
  display: block;
  margin: 0;
  padding: 24px 20px 12px;
}

#todosView .notes-sidebar .panel-head h3 {
  color: #0f172a;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
}

#todosView .notes-sidebar .panel-head h3::after {
  content: "";
  display: block;
  margin-top: 14px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 400;
}

#todosView .notes-head-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

#todosView #noteOutlineToggleBtn,
#todosView #noteSidebarCollapseBtn,
#todosView #newNoteBtn {
  min-height: 30px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
}

#todosView #newNoteBtn {
  background: #2563eb;
}

#todosView .notes-search {
  height: 38px;
  margin: 0 12px 14px;
  border-color: #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
}

#todosView .notes-list {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 0 20px;
}

#todosView .note-item {
  height: auto;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  gap: 12px;
  position: relative;
  margin: 0 12px 8px;
  padding: 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

#todosView .note-item::after {
  content: "";
  width: 56px;
  height: 44px;
  grid-column: 2;
  grid-row: 1;
  border-radius: 6px;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

#todosView .note-item:nth-child(even)::after {
  background: linear-gradient(135deg, #e0e7ff, #f8fafc);
}

#todosView .note-item:hover {
  background: #f1f5f9;
  box-shadow: none;
}

#todosView .note-item.active {
  border: 0;
  background: #e2e8f0;
}

#todosView .note-item.active::before {
  display: none;
}

#todosView .note-open {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

#todosView .note-open strong {
  display: block;
  margin-bottom: 4px;
  color: #1e293b;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
}

#todosView .note-open small {
  display: -webkit-box;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#todosView .note-item .row-actions {
  position: absolute;
  right: 14px;
  bottom: 8px;
  z-index: 1;
}

#todosView .note-outline-panel {
  flex: 1 1 auto;
  padding: 24px;
  overflow: auto;
}

#todosView .note-editor-panel {
  min-height: 100vh;
  max-width: none;
  display: grid;
  grid-template-rows: 52px auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 0;
  justify-self: stretch;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

#todosView .note-editor-panel > * {
  max-width: none;
}

#todosView .note-editor-panel .panel-head {
  grid-row: 1;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 24px;
  border-bottom: 1px solid #edf2f7;
  background: #ffffff;
}

#todosView #noteFormTitle {
  display: none;
}

#todosView .note-editor-panel .reader-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#todosView #noteSummaryBtn {
  min-height: 32px;
  border-radius: 8px;
  background: #1e293b;
  color: #ffffff;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
}

#todosView .note-editor-panel .primary {
  min-height: 32px;
  border-radius: 8px;
  background: #2563eb;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
}

#todosView .note-toolbar {
  grid-row: 1;
  justify-self: center;
  align-self: center;
  width: auto;
  max-width: calc(100% - 320px);
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  z-index: 2;
}

#todosView .note-toolbar button,
#todosView .note-toolbar select,
#todosView .note-color-trigger {
  min-width: 30px;
  min-height: 30px;
  border-radius: 6px;
  color: #64748b;
  font-size: 15px;
  font-weight: 500;
}

#todosView .note-toolbar button:hover,
#todosView .note-toolbar select:hover,
#todosView .note-color-trigger:hover {
  background: #f1f5f9;
  color: #1e293b;
}

#todosView #insertNoteDateBtn {
  min-width: 58px;
  font-size: 13px;
}

#todosView .note-toolbar select {
  max-width: 86px;
  font-size: 13px;
}

#todosView .note-title-field {
  grid-row: 2;
  width: min(760px, calc(100% - 160px));
  justify-self: center;
  margin-top: 40px;
}

#todosView .note-title-field input {
  min-height: auto;
  color: #0f172a;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 700;
}

#todosView .note-editor {
  grid-row: 3;
  width: min(760px, calc(100% - 160px));
  min-height: 0;
  justify-self: center;
  overflow: auto;
  padding: 28px 0 48px;
  color: #334155;
  font-size: 15.5px;
  line-height: 1.8;
}

#todosView .note-editor h1 {
  color: #0f172a;
  font-size: 34px;
  line-height: 1.28;
  font-weight: 900;
}

#todosView .note-editor h2 {
  margin: 30px 0 14px;
  color: #111827;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 850;
}

#todosView .note-editor h3 {
  margin: 24px 0 12px;
  color: #334155;
  font-size: 18px;
  line-height: 1.45;
  font-weight: 800;
}

#todosView .note-editor strong,
#todosView .note-editor b {
  color: #0f172a;
  font-weight: 900;
}

#todosView .note-editor p {
  margin-bottom: 16px;
}

#todosView #noteSavedPath,
#todosView .note-statusbar {
  width: min(760px, calc(100% - 160px));
  justify-self: center;
}

#todosView #noteSavedPath {
  grid-row: 4;
}

#todosView .note-statusbar {
  grid-row: 4;
  align-self: end;
  padding: 0 0 16px;
}

#todosView .notes-shell.note-sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

#todosView .notes-shell.note-sidebar-collapsed .notes-sidebar {
  width: 72px;
}

@media (max-width: 1180px) {
  #todosView .notes-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  #todosView .notes-sidebar {
    width: 280px;
  }

  #todosView .note-title-field,
  #todosView .note-editor,
  #todosView #noteSavedPath,
  #todosView .note-statusbar {
    width: min(720px, calc(100% - 80px));
  }
}

@media (max-width: 900px) {
  .app-shell:has(#todosView:not(.hidden)) {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .app-shell:has(#todosView:not(.hidden)) .content,
  #todosView {
    height: auto;
    overflow: visible;
  }

  #todosView .notes-shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  #todosView .notes-sidebar {
    width: 100%;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid #edf2f7;
  }

  #todosView .note-editor-panel {
    min-height: 720px;
  }

  #todosView .note-toolbar {
    max-width: calc(100% - 32px);
    overflow-x: auto;
  }

  #todosView .note-title-field,
  #todosView .note-editor,
  #todosView #noteSavedPath,
  #todosView .note-statusbar {
    width: calc(100% - 40px);
  }
}

/* Add assets dialog prototype alignment */
#workspaceAssetDialog.workspace-asset-dialog {
  width: min(860px, calc(100vw - 40px));
  height: auto;
  min-height: 0;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  border: 0;
  border-radius: 20px;
  background: #ffffff;
  padding: 32px;
  overflow: visible;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.1);
  color: #1e293b;
}

#workspaceAssetDialog::backdrop {
  background: rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(10px);
}

#workspaceAssetDialog .dialog-head {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 0;
}

#workspaceAssetDialog .dialog-head h3 {
  color: #0f172a;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
}

#workspaceAssetDialog .dialog-close-btn {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: #94a3b8;
  padding: 0;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}

#workspaceAssetDialog .dialog-close-btn:hover {
  background: transparent;
  color: #1e293b;
}

#workspaceAssetDialog .asset-dialog-grid {
  height: auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  gap: 24px;
  margin: 0;
}

#workspaceAssetDialog .kb-upload-panel,
#workspaceAssetDialog .kb-bind-panel {
  display: flex;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

#workspaceAssetDialog .kb-upload-panel {
  flex: 1 1 0;
}

#workspaceAssetDialog .kb-bind-panel {
  flex: 1.4 1 0;
  height: auto;
  overflow: visible;
}

#workspaceAssetDialog summary {
  display: none !important;
}

#workspaceAssetDialog .kb-upload {
  width: 100%;
  height: auto;
  min-height: 318px;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#workspaceAssetDialog .compact-dropzone {
  width: 100%;
  height: 100%;
  min-height: 318px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  background: #f8fafc;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

#workspaceAssetDialog .compact-dropzone:hover,
#workspaceAssetDialog .compact-dropzone.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

#workspaceAssetDialog .upload-cloud {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border-radius: 50%;
  background: #ffffff;
  color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
  font-size: 0;
}

#workspaceAssetDialog .upload-cloud::before {
  content: "";
  font-size: 26px;
  line-height: 1;
}

#workspaceAssetDialog .compact-dropzone strong {
  margin-bottom: 6px;
  color: #1e293b;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
}

#workspaceAssetDialog .compact-dropzone strong::after {
  content: "锛屾垨 鐐瑰嚮涓婁紶";
  color: #2563eb;
}

#workspaceAssetDialog .compact-dropzone span:not(.upload-cloud) {
  display: none;
}

#workspaceAssetDialog .compact-dropzone small {
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.6;
}

#workspaceAssetDialog .kb-upload > .primary {
  display: none !important;
}

#workspaceAssetDialog .browser-box {
  width: 100%;
  height: auto;
  min-height: 318px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: static;
  overflow: hidden;
  border: 1px solid #edf2f7;
  border-radius: 16px;
  background: #ffffff;
}

#workspaceAssetDialog .subhead {
  min-height: 61px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f7;
  background: #f8fafc;
}

#workspaceAssetDialog .subhead > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

#workspaceAssetDialog .subhead > div:first-child::before {
  content: "";
  color: #2563eb;
  font-size: 15px;
  line-height: 1;
}

#workspaceAssetDialog .subhead span {
  color: #1e293b;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
}

#workspaceAssetDialog #workspaceBrowserBreadcrumb {
  display: none;
}

#workspaceAssetDialog .toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#workspaceAssetDialog .toolbar-actions::before {
  content: "";
  width: 1px;
  height: 14px;
  order: 2;
  background: #e2e8f0;
  margin: 0 4px;
}

#workspaceAssetDialog #workspaceBrowserRefreshBtn {
  order: 3;
  width: 32px;
  height: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #64748b;
  padding: 0;
  font-size: 0;
}

#workspaceAssetDialog #workspaceBrowserRefreshBtn::before {
  content: "";
  font-size: 16px;
  line-height: 1;
}

#workspaceAssetDialog #workspaceBrowserRefreshBtn:hover {
  border-color: #bfdbfe;
  color: #2563eb;
}

#workspaceAssetDialog #workspaceBrowserBindBtn {
  display: none;
}

#workspaceAssetDialog .pathbar {
  position: absolute;
  top: 46px;
  right: 72px;
  left: auto;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

#workspaceAssetDialog .pathbar span {
  display: none;
}

#workspaceAssetDialog #workspaceBrowserUpBtn {
  height: 32px;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 500;
}

#workspaceAssetDialog #workspaceBrowserUpBtn::before {
  content: "鈫?";
}

#workspaceAssetDialog #workspaceBrowserUpBtn:hover {
  color: #2563eb;
  background: transparent;
}

#workspaceAssetDialog .webdav-browser {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  padding: 8px;
  background: #ffffff;
}

#workspaceAssetDialog .browser-card {
  width: 100%;
  min-height: 42px;
  height: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 10px 12px;
  box-shadow: none;
  transition: background 0.2s ease;
}

#workspaceAssetDialog .browser-card:hover {
  transform: none;
  border-color: transparent;
  background: #f1f5f9;
  box-shadow: none;
}

#workspaceAssetDialog .file-browser-card {
  grid-template-columns: none;
}

#workspaceAssetDialog .file-browser-card.selected {
  border-color: transparent;
  background: #eff6ff;
}

#workspaceAssetDialog .browser-icon,
#workspaceAssetDialog .browser-file-type {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
  font-size: 0;
}

#workspaceAssetDialog .browser-icon::before {
  content: "";
  color: #f59e0b;
  font-size: 15px;
}

#workspaceAssetDialog .browser-file-type::before {
  content: "";
  color: currentColor;
  font-size: 15px;
}

#workspaceAssetDialog .browser-file-type.pdf { color: #ef4444; }
#workspaceAssetDialog .browser-file-type.word { color: #2563eb; }
#workspaceAssetDialog .browser-file-type.excel { color: #16a34a; }
#workspaceAssetDialog .browser-file-type.markdown,
#workspaceAssetDialog .browser-file-type.text { color: #64748b; }
#workspaceAssetDialog .browser-file-type.image { color: #7c3aed; }

#workspaceAssetDialog .browser-card strong {
  flex: 1 1 auto;
  min-width: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 500;
}

#workspaceAssetDialog .browser-card small {
  display: none;
}

#workspaceAssetDialog .browser-card input {
  order: 10;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 4px;
  accent-color: #2563eb;
}

#workspaceAssetDialog .empty-note {
  margin: auto;
  border: 0;
  background: transparent;
  color: #94a3b8;
}

#workspaceAssetDialog .asset-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid #edf2f7;
  background: #f8fafc;
}

#workspaceAssetDialog .selection-status {
  display: flex;
  align-items: center;
  gap: 14px;
}

#workspaceAssetDialog #workspaceBrowserSelectionCount {
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

#workspaceAssetDialog .selection-status button {
  height: auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #2563eb;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
}

#workspaceAssetDialog #workspaceBrowserClearBtn {
  color: #ef4444;
}

#workspaceAssetDialog .footer-actions {
  position: absolute;
  right: 32px;
  bottom: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

#workspaceAssetDialog .footer-actions button {
  height: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 500;
}

#workspaceAssetDialog .footer-actions .secondary {
  background: #f1f5f9;
  color: #475569;
}

#workspaceAssetDialog .footer-actions .secondary:hover {
  background: #e2e8f0;
}

#workspaceAssetDialog .footer-actions .primary {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

#workspaceAssetDialog .footer-actions .primary:hover {
  background: #1d4ed8;
}

#workspaceAssetDialog .asset-dialog-grid {
  padding-bottom: 64px;
}

@media (max-width: 920px) {
  #workspaceAssetDialog.workspace-asset-dialog {
    width: min(860px, calc(100vw - 24px));
    overflow: auto;
  }

  #workspaceAssetDialog .asset-dialog-grid {
    flex-direction: column;
  }

  #workspaceAssetDialog .footer-actions {
    position: static;
    justify-content: flex-end;
    margin-top: 16px;
  }
}

/* Sidebar prototype alignment */
:root {
  --sidebar-proto-primary: #3b82f6;
  --sidebar-proto-active: #eef2ff;
  --sidebar-proto-ink: #1f2937;
  --sidebar-proto-muted: #6b7280;
  --sidebar-proto-light: #9ca3af;
}

.app-shell,
.app-shell:has(#todosView:not(.hidden)),
.app-shell:has(#settingsView:not(.hidden)) {
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar,
.app-shell:has(#todosView:not(.hidden)) .sidebar,
.app-shell:has(#settingsView:not(.hidden)) .sidebar {
  width: 260px;
  min-width: 260px;
  height: 100vh;
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
  padding: 24px 16px;
  border-right: 0;
  background: #ffffff;
  color: var(--sidebar-proto-ink);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.03);
}

.brand,
.app-shell:has(#todosView:not(.hidden)) .brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-areas:
    "mark name"
    "mark email"
    "search search";
  column-gap: 12px;
  align-items: center;
  margin: 0 0 24px;
  padding: 4px 8px 0;
}

.brand-row,
.app-shell:has(#todosView:not(.hidden)) .brand-row {
  display: contents;
}

.brand-mark,
.app-shell:has(#todosView:not(.hidden)) .brand-mark {
  grid-area: mark;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #eff6ff;
  color: var(--sidebar-proto-primary);
  box-shadow: none;
  font-size: 18px;
  font-weight: 700;
}

.brand h1,
.app-shell:has(#todosView:not(.hidden)) .brand h1 {
  grid-area: name;
  align-self: end;
  color: var(--sidebar-proto-ink);
  font-size: 16px;
  line-height: 1.2;
  font-weight: 600;
}

.brand p,
.app-shell:has(#todosView:not(.hidden)) .brand p {
  grid-area: email;
  align-self: start;
  margin: 2px 0 0;
  color: var(--sidebar-proto-light);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-search,
.app-shell:has(#todosView:not(.hidden)) .sidebar-search {
  grid-area: search;
  height: 40px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 20px -4px 0;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  color: var(--sidebar-proto-light);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-search:focus-within,
.app-shell:has(#todosView:not(.hidden)) .sidebar-search:focus-within {
  border-color: var(--sidebar-proto-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.sidebar-search span,
.app-shell:has(#todosView:not(.hidden)) .sidebar-search span {
  color: var(--sidebar-proto-light);
  font-size: 14px;
}

.sidebar-search input,
.app-shell:has(#todosView:not(.hidden)) .sidebar-search input {
  height: auto;
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--sidebar-proto-ink);
  padding: 0;
  font-size: 14px;
  box-shadow: none;
}

.sidebar-search input:focus {
  box-shadow: none;
}

.kb-nav {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0;
}

.kb-nav::before,
.sidebar-bottom::before,
.app-shell:has(#todosView:not(.hidden)) .kb-nav::before,
.app-shell:has(#todosView:not(.hidden)) .sidebar-bottom::before {
  display: block;
  content: "鍐呭";
  padding: 0 12px;
  margin: 0 0 8px;
  color: var(--sidebar-proto-light);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-bottom::before,
.app-shell:has(#todosView:not(.hidden)) .sidebar-bottom::before {
  content: "绯荤粺";
  margin-top: 20px;
}

.sidebar .nav,
.sidebar-logout,
[data-workspace-nav-section="personal"] .kb-group-toggle,
[data-workspace-nav-section="projects"] .kb-group-toggle,
.app-shell:has(#todosView:not(.hidden)) .sidebar .nav,
.app-shell:has(#todosView:not(.hidden)) .sidebar-logout,
.app-shell:has(#todosView:not(.hidden)) [data-workspace-nav-section="personal"] .kb-group-toggle {
  width: 100%;
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin: 0 0 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--sidebar-proto-muted);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar .nav:hover,
.sidebar-logout:hover,
[data-workspace-nav-section="personal"] .kb-group-toggle:hover,
[data-workspace-nav-section="projects"] .kb-group-toggle:hover {
  background: #f3f4f6;
  color: var(--sidebar-proto-ink);
}

.sidebar .nav.active,
.sidebar .nav[data-view="workspaces"].active,
.app-shell:has(#workspacesView:not(.hidden)) [data-workspace-nav-section="personal"] .kb-group-toggle,
.app-shell:has(#todosView:not(.hidden)) .sidebar .nav.active {
  background: var(--sidebar-proto-active);
  color: var(--sidebar-proto-primary);
  font-weight: 600;
}

.sidebar .nav::before,
.sidebar-logout::before {
  width: 16px;
  min-width: 16px;
  display: inline-grid !important;
  place-items: center;
  color: currentColor;
  font-size: 16px;
  line-height: 1;
}

.sidebar .nav[data-view="todos"]::before { content: ""; }
.sidebar .nav[data-view="settings"]::before { content: ""; }
.sidebar-logout::before { content: ""; }

[data-workspace-nav-section="personal"] .kb-nav-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 0;
}

[data-workspace-nav-section="personal"] .kb-group-toggle {
  justify-content: space-between;
}

[data-workspace-nav-section="personal"] .kb-group-toggle::before {
  content: "";
  width: 16px;
  min-width: 16px;
  display: inline-grid;
  place-items: center;
  color: currentColor;
  font-size: 16px;
}

[data-workspace-nav-section="personal"] .kb-group-toggle span:last-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

[data-workspace-nav-section="personal"] .kb-group-toggle span:last-child {
  font-size: 0;
}

[data-workspace-nav-section="personal"] .kb-group-toggle span:last-child::before {
  content: "";
  font-size: 14px;
}

.kb-group-arrow,
.workspace-tree-arrow {
  order: 3;
  width: 16px;
  min-width: 16px;
  color: var(--sidebar-proto-light);
  font-size: 14px;
}

#newWorkspaceBtn,
#newWorkspaceGroupBtn {
  display: none !important;
}

[data-workspace-nav-section="personal"] .workspace-list {
  display: block;
  padding-left: 16px;
  margin: 2px 0 6px;
}

[data-workspace-nav-section="personal"] .workspace-project {
  margin: 0 0 2px;
}

[data-workspace-nav-section="personal"] .workspace-project-head {
  min-height: 34px;
  border-radius: 12px;
  background: transparent;
}

[data-workspace-nav-section="personal"] .workspace-project-head:hover {
  background: #f9fafb;
}

.workspace-project-toggle {
  min-height: 34px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--sidebar-proto-muted);
}

[data-workspace-nav-section="personal"] .workspace-project-name {
  color: var(--sidebar-proto-muted);
  font-size: 13.5px;
  font-weight: 500;
}

[data-workspace-nav-section="personal"] .workspace-project-toggle small {
  min-width: 0;
  height: auto;
  display: inline-flex;
  align-items: center;
  border-radius: 20px;
  background: #f3f4f6;
  color: var(--sidebar-proto-muted);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

[data-workspace-nav-section="personal"] .workspace-project-list {
  padding-left: 20px;
  margin: 0 0 4px;
}

[data-workspace-nav-section="personal"] .workspace-card {
  min-height: 34px;
  height: auto;
  margin: 0 0 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--sidebar-proto-muted);
}

.workspace-open {
  min-height: 34px;
  display: block;
  padding: 8px 12px;
}

[data-workspace-nav-section="personal"] .workspace-card:hover {
  background: #f9fafb;
  color: var(--sidebar-proto-ink);
}

[data-workspace-nav-section="personal"] .workspace-card.active {
  background: var(--sidebar-proto-active);
  color: var(--sidebar-proto-primary);
  font-weight: 600;
}

[data-workspace-nav-section="personal"] .workspace-card strong,
[data-workspace-nav-section="personal"] .workspace-card.active strong {
  color: currentColor;
  font-size: 13px;
  font-weight: inherit;
}

.workspace-more-btn,
.workspace-tree-menu-wrap {
  display: none !important;
}

.sidebar-bottom {
  display: block;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.sidebar-bottom .nav[data-view="settings"] {
  margin-bottom: 0;
}

.sidebar-logout,
.app-shell:has(#todosView:not(.hidden)) .sidebar-logout {
  flex: 0 0 auto;
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid #f3f4f6;
  border-radius: 0;
  color: #ef4444;
}

.sidebar-logout:hover {
  background: transparent;
}

.sidebar-logout::after {
  content: "";
  position: absolute;
}

@media (max-width: 760px) {
  .app-shell,
  .app-shell:has(#todosView:not(.hidden)),
  .app-shell:has(#settingsView:not(.hidden)) {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .app-shell:has(#todosView:not(.hidden)) .sidebar,
  .app-shell:has(#settingsView:not(.hidden)) .sidebar {
    width: auto;
    min-width: 0;
    height: auto;
  }
}

/* Files center prototype alignment */
.app-shell:has(#filesView:not(.hidden)) {
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
}

.app-shell:has(#filesView:not(.hidden)) .content {
  height: 100vh;
  overflow: auto;
  padding: 0;
  background: #ffffff;
}

#filesView {
  min-height: 100vh;
  padding: 40px 48px;
  background: #ffffff;
}

#filesView .files-page {
  width: 100%;
  max-width: none;
  margin: 0;
}

#filesView .files-hero {
  margin-bottom: 32px;
}

#filesView .files-hero h2 {
  color: #0f172a;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
}

#filesView .files-hero p {
  margin-top: 6px;
  color: #64748b;
  font-size: 14px;
}

#filesView .files-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

#filesView .files-upload-card,
#filesView .files-browser-card {
  border: 1px solid #edf2f7;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 4px 18px -4px rgba(15, 23, 42, 0.04);
}

#filesView .files-upload-card {
  display: grid;
  gap: 20px;
  padding: 24px;
}

#filesView .files-browser-card {
  min-height: 580px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 22px;
  padding: 28px;
}

#filesView .files-upload-card .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

#filesView .files-upload-card .panel-head h3,
#filesView .files-browser-card .panel-head h3 {
  color: #0f172a;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 700;
}

#filesView #uploadState {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 20px;
  background: #ecfdf5;
  color: #10b981;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
}

#filesView .field {
  margin: 0;
  gap: 8px;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

#filesView .field span {
  color: #64748b;
  font-size: 12px;
}

#filesView select,
#filesView input {
  min-height: 42px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background-color: #ffffff;
  color: #1e293b;
  font-size: 14px;
}

#filesView select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 12px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

#filesView select:focus,
#filesView input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#filesView #dropzone {
  min-height: 222px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  background: #f8fafc;
  padding: 44px 20px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

#filesView #dropzone:hover,
#filesView #dropzone.dragover {
  border-color: #2563eb;
  background: #eff6ff;
}

#filesView #dropzone .upload-cloud-icon {
  width: auto;
  height: auto;
  margin-bottom: 12px;
  border-radius: 0;
  background: transparent;
  color: #2563eb;
  box-shadow: none;
  font-size: 0;
}

#filesView #dropzone .upload-cloud-icon::before {
  content: "";
  font-size: 36px;
  line-height: 1;
}

#filesView #dropzone strong {
  margin-bottom: 6px;
  color: #1e293b;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
}

#filesView #dropzone strong::before {
  content: "";
  font-size: 14px;
}

#filesView #dropzone strong {
  font-size: 0;
}

#filesView #dropzone span:not(.upload-cloud-icon) {
  display: block;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

#filesView #dropzone span:not(.upload-cloud-icon)::after {
  content: "锛屾垨鐐瑰嚮閫夋嫨";
  color: #2563eb;
  font-weight: 600;
}

#filesView #dropzone em {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

#filesView .picked-item {
  border: 1px solid #edf2f7;
  border-radius: 10px;
  background: #f8fafc;
}

#filesView .files-upload-card > .primary {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  border-radius: 12px;
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  font-size: 14px;
  font-weight: 600;
}

#filesView .files-upload-card > .primary:hover {
  background: #1d4ed8;
}

#filesView .files-browser-card .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
}

#filesView .files-browser-card .panel-head > div:first-child {
  display: none;
}

#filesView .files-toolbar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

#filesView #fileCategory {
  width: 90px;
  min-height: 36px;
  padding: 6px 28px 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  background-position: calc(100% - 15px) 15px, calc(100% - 9px) 15px;
}

#filesView .files-view-toggle {
  width: 72px;
  height: 40px;
  position: relative;
  border: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: transparent;
  padding: 4px;
  cursor: default;
}

#filesView .files-view-toggle::before,
#filesView .files-view-toggle::after {
  position: absolute;
  top: 4px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #64748b;
  font-size: 16px;
}

#filesView .files-view-toggle::before {
  content: "";
  left: 4px;
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

#filesView .files-view-toggle::after {
  content: "";
  right: 4px;
}

#filesView .file-pathbar {
  grid-row: 1;
  width: fit-content;
  max-width: calc(100% - 220px);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#filesView #fileUpBtn {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #64748b;
  padding: 0;
  font-size: 0;
}

#filesView #fileUpBtn::before {
  content: "WebDAV";
  color: #64748b;
  font-size: 14px;
}

#filesView #fileUpBtn::after {
  content: "";
  margin-left: 8px;
  color: #94a3b8;
  font-size: 14px;
}

#filesView #fileUpBtn:hover::before {
  color: #2563eb;
}

#filesView #filePath {
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#filesView .file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  align-content: start;
}

#filesView .file-card {
  min-height: 142px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0;
  position: relative;
  border: 1px solid #f1f5f9;
  border-radius: 16px;
  background: #ffffff;
  padding: 20px;
  box-shadow: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

#filesView .file-card:hover {
  transform: none;
  border-color: #cbd5e1;
  box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.05);
}

#filesView .folder-card:focus,
#filesView .folder-card:active {
  border-color: #2563eb;
  background: #f0f7ff;
}

#filesView .file-card-menu {
  top: 20px;
  right: 20px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #94a3b8;
  font-size: 16px;
}

#filesView .file-card-menu:hover {
  background: #f1f5f9;
  color: #1e293b;
}

#filesView .file-type-icon {
  width: 46px;
  height: 40px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
}

#filesView .folder-icon {
  width: 44px;
  height: 38px;
  color: transparent;
  background: transparent;
}

#filesView .folder-icon::before {
  width: 34px;
  height: 24px;
  border-radius: 7px 7px 8px 8px;
  background: #f59e0b;
  box-shadow: 0 -7px 0 -2px #fbbf24;
}

#filesView .folder-card:nth-child(2n) .folder-icon::before {
  background: #8b5cf6;
  box-shadow: 0 -7px 0 -2px #a78bfa;
}

#filesView .folder-card:nth-child(3n) .folder-icon::before {
  background: #2563eb;
  box-shadow: 0 -7px 0 -2px #60a5fa;
}

#filesView .folder-card:nth-child(4n) .folder-icon::before {
  background: #ec4899;
  box-shadow: 0 -7px 0 -2px #f9a8d4;
}

#filesView .file-card strong {
  align-self: end;
  margin-bottom: 6px;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
}

#filesView .file-card small {
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

#filesView .folder-card small {
  font-size: 0;
}

#filesView .folder-card small::before {
  content: "鏂囦欢澶?路 鐐瑰嚮杩涘叆";
  color: #64748b;
  font-size: 13px;
}

#filesView .file-card .row-actions {
  position: absolute;
  right: 16px;
  bottom: 16px;
}

#filesView .file-card .secondary {
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
}

#filesView .files-empty-state,
#filesView .empty-note {
  grid-column: 1 / -1;
  min-height: 260px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: #ffffff;
}

@media (max-width: 1180px) {
  #filesView .files-layout {
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
  }
}

@media (max-width: 980px) {
  #filesView .files-layout {
    grid-template-columns: 1fr;
  }

  #filesView .file-pathbar {
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  .app-shell:has(#filesView:not(.hidden)) {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  #filesView {
    padding: 24px 20px;
  }

  #filesView .file-list {
    grid-template-columns: 1fr;
  }
}

/* Settings page prototype alignment */
.app-shell:has(#settingsView:not(.hidden)) {
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: #f8fafc;
}

.app-shell:has(#settingsView:not(.hidden)) .content {
  height: 100vh;
  overflow: auto;
  padding: 0;
  background: #f8fafc;
}

#settingsView {
  min-height: 100vh;
  padding: 40px 48px;
  background: #f8fafc;
}

#settingsView .settings-page {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}

#settingsView .settings-hero {
  margin: 0 0 28px;
  padding: 0;
}

#settingsView .settings-hero h2 {
  color: #0f172a;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
}

#settingsView .settings-hero p {
  margin-top: 6px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}

#settingsView .settings-hero p {
  font-size: 0;
}

#settingsView .settings-hero p::before {
  content: "绠＄悊浣犵殑 WebDAV 瀛樺偍妗朵笌澶ц瑷€妯″瀷浜戠绔偣閰嶇疆";
  font-size: 14px;
}

#settingsView .settings-state-pill {
  display: none;
}

#settingsView .settings-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin: 0 0 32px;
}

#settingsView .settings-summary-card {
  min-height: 0;
  height: auto;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border: 1px solid #edf2f7;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
  transform: none;
}

#settingsView .settings-summary-card:hover {
  transform: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

#settingsView .settings-card-head {
  display: contents;
}

#settingsView .settings-card-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #e0f2fe;
  color: #0284c7;
  font-size: 0;
}

#settingsView .settings-card-icon::before {
  content: "";
  font-size: 22px;
  line-height: 1;
}

#settingsView .model-summary-card .settings-card-icon {
  background: #f3e8ff;
  color: #7c3aed;
}

#settingsView .model-summary-card .settings-card-icon::before {
  content: "";
}

#settingsView .settings-card-head > div {
  flex: 1 1 auto;
  min-width: 0;
}

#settingsView .settings-card-head span:not(.settings-card-icon) {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  color: #1e293b;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 700;
}

#settingsView .model-summary-card .settings-card-head span:not(.settings-card-icon) {
  font-size: 0;
}

#settingsView .model-summary-card .settings-card-head span:not(.settings-card-icon)::before {
  content: "AI 妯″瀷瀹堟姢";
  font-size: 15px;
}

#settingsView .settings-card-head strong {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  margin: 0;
  border-radius: 20px;
  background: #d1fae5;
  color: #065f46;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
}

#settingsView .model-summary-card .settings-card-head strong {
  background: #f3e8ff;
  color: #6b21a8;
}

#settingsView .settings-binding-list {
  flex: 1 1 auto;
  min-width: 0;
  display: block;
  margin-top: 4px;
  overflow: visible;
  padding: 0;
}

#settingsView .settings-binding-list article {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
}

#settingsView .model-summary-card .settings-binding-list article + article {
  display: none;
}

#settingsView .settings-binding-list article strong,
#settingsView .settings-binding-list article span,
#settingsView .settings-binding-list article small,
#settingsView .settings-binding-list p {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: break-all;
}

#settingsView .settings-binding-list article strong {
  color: #64748b;
  font-weight: 400;
}

#settingsView .model-summary-card .settings-binding-list article strong::before {
  content: "";
  color: #64748b;
  font-weight: 400;
}

#settingsView .model-summary-card .settings-binding-list article span::before {
  content: "";
}

#settingsView .model-summary-card .settings-binding-list article small::before {
  content: "";
}

#settingsView .config-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  margin: 0 0 40px;
}

#settingsView .settings-config-card {
  min-height: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  border: 1px solid #edf2f7;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.04);
  transform: none;
}

#settingsView .settings-config-card:hover {
  transform: none;
  box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.04);
}

#settingsView .settings-card-title {
  display: block;
  margin: 0;
}

#settingsView .settings-card-title h3 {
  margin: 0 0 4px;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
}

#settingsView .settings-card-title p {
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

#settingsView .settings-config-card:first-child .settings-card-title p {
  font-size: 0;
}

#settingsView .settings-config-card:first-child .settings-card-title p::before {
  content: "鐢ㄤ簬鍙屽悜鍚屾鍙婂浠戒綘鐨勫叏閲忕煡璇嗗簱璧勪骇";
  font-size: 13px;
}

#settingsView .settings-config-card:nth-child(2) .settings-card-title p {
  font-size: 0;
}

#settingsView .settings-config-card:nth-child(2) .settings-card-title p::before {
  content: "";
  font-size: 13px;
}

#settingsView .field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

#settingsView .field span {
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

#settingsView .field::before {
  position: absolute;
  left: 14px;
  bottom: 13px;
  z-index: 1;
  width: 16px;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  text-align: center;
  pointer-events: none;
}

#settingsView .settings-config-card:first-child .field:nth-of-type(1)::before { content: ""; }
#settingsView .settings-config-card:first-child .field:nth-of-type(2)::before { content: ""; }
#settingsView .settings-config-card:first-child .field:nth-of-type(3)::before { content: ""; }
#settingsView .settings-config-card:first-child .field:nth-of-type(4)::before { content: ""; }
#settingsView .settings-config-card:nth-child(2) .field:nth-of-type(1)::before { content: ""; }
#settingsView .settings-config-card:nth-child(2) .field:nth-of-type(2)::before { content: ""; }
#settingsView .settings-config-card:nth-child(2) .field:nth-of-type(3)::before { content: ""; }
#settingsView .settings-config-card:nth-child(2) .field:nth-of-type(4)::before { content: ""; }
#settingsView .settings-config-card:nth-child(2) .field:nth-of-type(5)::before { content: ""; }

#settingsView input,
#settingsView select,
#settingsView textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  color: #1e293b;
  padding: 11px 14px 11px 40px;
  outline: none;
  box-shadow: none;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#settingsView select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 12px) 19px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

#settingsView input:focus,
#settingsView select:focus,
#settingsView textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#settingsView input::placeholder {
  color: #94a3b8;
}

#settingsView .settings-switch {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px 14px;
}

#settingsView .settings-switch span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #1e293b;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
}

#settingsView .settings-switch span::after {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 400;
}

#settingsView .settings-switch:nth-of-type(6) span::after {
  content: "寮€鍚妯℃€佽瑙夎瘑鍥句笌鍥捐〃瑙ｆ瀽";
}

#settingsView .settings-switch:nth-of-type(7) span::after {
  content: "婵€娲昏秴闀夸笂涓嬫枃绐楀彛闃呰閫昏緫";
}

#settingsView .settings-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#settingsView .settings-switch i {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: #cbd5e1;
  transition: background 0.2s ease;
}

#settingsView .settings-switch i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

#settingsView .settings-switch input:checked + i {
  background: #2563eb;
}

#settingsView .settings-switch input:checked + i::after {
  transform: translateX(20px);
}

#settingsView .button-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid #edf2f7;
}

#settingsView #testWebdavBtn,
#settingsView #testModelBtn,
#settingsView #saveWebdavBtn,
#settingsView #saveModelBtn {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s ease;
}

#settingsView #testWebdavBtn,
#settingsView #testModelBtn {
  background: #f1f5f9;
  color: #475569;
}

#settingsView #testWebdavBtn:hover,
#settingsView #testModelBtn:hover {
  background: #e2e8f0;
}

#settingsView #saveWebdavBtn,
#settingsView #saveModelBtn {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

#settingsView #saveWebdavBtn:hover,
#settingsView #saveModelBtn:hover {
  background: #1d4ed8;
}

#settingsView .settings-security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: auto 0 0;
  padding-top: 24px;
  color: #94a3b8;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
}

#settingsView .settings-security-note::first-letter {
  color: #10b981;
}

@media (max-width: 1100px) {
  #settingsView .settings-summary,
  #settingsView .config-cols {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell:has(#settingsView:not(.hidden)) {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  #settingsView {
    padding: 24px 20px;
  }

  #settingsView .settings-page {
    min-height: auto;
  }

  #settingsView .settings-summary-card,
  #settingsView .settings-config-card {
    padding: 20px;
  }

  #settingsView .button-row {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  #settingsView .button-row button {
    flex: 1 1 160px;
  }
}

/* Chat launcher size and image fitting fix */
#workspaceChatLauncher.kb-chat-launcher {
  right: 32px;
  bottom: 32px;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border-radius: 50%;
}

#workspaceChatLauncher.kb-chat-launcher.has-custom-icon {
  padding: 0;
  border: 0;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow: 0 14px 32px -8px rgba(37, 99, 235, 0.38);
}

#workspaceChatLauncher.kb-chat-launcher.has-custom-icon:hover {
  transform: translateY(-2px);
}

/* Chat composer border and custom send icon slot */
#workspaceChatFloat .kb-input-section {
  border-top: 1px solid #dbe5f2 !important;
}

#workspaceChatFloat .kb-composer textarea {
  border: 2px solid #2563eb !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

#workspaceChatFloat .composer-icon.send.has-custom-send-icon {
  overflow: hidden;
  color: transparent;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow: 0 10px 22px -8px rgba(37, 99, 235, 0.45);
}

/* Final chat icon and composer spacing polish */
#workspaceChatFloat:has(.workspace-chat-panel:not(.hidden)) .kb-input-section {
  margin-top: 22px;
  padding-top: 0 !important;
  border-top: 1px solid #dbe5f2 !important;
  background: #ffffff;
}

#workspaceChatFloat:has(.workspace-chat-panel:not(.hidden)) .kb-composer {
  margin-top: 0;
}

#workspaceChatFloat:has(.workspace-chat-panel:not(.hidden)) .kb-composer textarea,
#workspaceChatFloat:has(.workspace-chat-panel:not(.hidden)) .kb-composer textarea:focus {
  border: 2px solid #2563eb !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08) !important;
}

#workspaceChatFloat .composer-icon.send,
#workspaceChatFloat .composer-icon.send.has-custom-send-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
}

#workspaceChatFloat .composer-icon.send.has-custom-send-icon {
  overflow: hidden;
  border: 0;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  color: transparent;
  box-shadow: none;
}

#workspaceChatFloat .composer-icon.send.has-custom-send-icon::before,
#workspaceChatFloat .composer-icon.send.has-custom-send-icon::after {
  display: none;
}

/* Workspace chat footer/model/markdown formatting cleanup */
#workspaceChatFloat .message-footer {
  align-items: flex-start;
}

#workspaceChatFloat .message-files {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#workspaceChatFloat .message-files strong {
  white-space: nowrap;
}

#workspaceChatFloat .message-files div {
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow: hidden;
}

#workspaceChatFloat .message-files span {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#workspaceChatFloat .message-actions [data-save-workspace-message] {
  display: none !important;
}

#workspaceChatFloat .kb-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#workspaceChatFloat .kb-composer-bar::before {
  flex: 0 0 auto;
}

#workspaceChatFloat .kb-composer .chat-controls {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

#workspaceChatFloat .kb-composer .field {
  width: auto;
}

#workspaceChatFloat .kb-composer select {
  margin-left: 8px;
}

#workspaceChatFloat .composer-actions {
  flex: 0 0 auto;
}

.markdown-content .markdown-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 14px 0;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  font-size: 14px;
}

.markdown-content th,
.markdown-content td {
  border: 1px solid #e2e8f0;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.markdown-content th {
  background: #f8fafc;
  color: #1e293b;
  font-weight: 700;
}

[data-workspace-nav-section="personal"] .workspace-project-toggle {
  width: 100%;
  grid-template-columns: 16px minmax(0, 1fr) auto;
}

[data-workspace-nav-section="personal"] .workspace-project-toggle .workspace-tree-arrow {
  order: 0;
  grid-column: 1;
  width: 16px;
  min-width: 16px;
  color: var(--sidebar-proto-light);
  font-size: 12px;
  text-align: center;
}

[data-workspace-nav-section="personal"] .workspace-project-toggle .workspace-project-name {
  order: 0;
  grid-column: 2;
  min-width: 0;
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-workspace-nav-section="personal"] .workspace-project-toggle .workspace-project-name::before {
  content: none !important;
  display: none !important;
}

[data-workspace-nav-section="personal"] .workspace-project-toggle small {
  order: 0;
  grid-column: 3;
  flex: 0 0 auto;
  width: auto;
  min-width: 22px;
  max-width: none;
  height: 22px;
  justify-content: center;
  padding: 0 8px;
  line-height: 22px;
  white-space: nowrap;
}

[data-workspace-nav-section="personal"] .kb-nav-head {
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
}

.kb-head-menu-wrap {
  position: relative;
}

.kb-head-more {
  width: 30px;
  height: 30px;
  opacity: 1;
  pointer-events: auto;
}

.kb-head-menu {
  min-width: 154px;
}

[data-workspace-nav-section="personal"] .workspace-project-head {
  grid-template-columns: minmax(0, 1fr) 30px;
}

[data-workspace-nav-section="personal"] .workspace-card {
  grid-template-columns: minmax(0, 1fr) 30px;
  padding-right: 4px;
}

[data-workspace-nav-section="personal"] .workspace-tree-menu-wrap {
  display: block !important;
}

[data-workspace-nav-section="personal"] .workspace-more-btn {
  width: 30px;
  height: 30px;
  display: grid !important;
  place-items: center;
  opacity: 1;
  pointer-events: auto;
  color: #9aa4b2;
  font-size: 0;
}

[data-workspace-nav-section="personal"] .workspace-more-btn::before {
  content: "...";
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

[data-workspace-nav-section="personal"] .workspace-more-btn:hover,
[data-workspace-nav-section="personal"] .workspace-tree-menu-wrap.open .workspace-more-btn {
  background: #f5f7fa;
  color: var(--sidebar-proto-primary);
}

[data-workspace-nav-section="personal"] .workspace-tree-menu {
  z-index: 50;
}

#workspaceChatFloat .mention-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: -2px;
}

#workspaceChatFloat .mention-file-list.hidden,
#workspaceChatFloat .mention-file-menu.hidden {
  display: none !important;
}

#workspaceChatFloat .mention-file-chip {
  max-width: 240px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border: 1px solid #dbe6ff;
  border-radius: 999px;
  background: #f6f9ff;
  color: #2563eb;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#workspaceChatFloat .mention-file-chip button {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: #e6efff;
  color: #64748b;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}

#workspaceChatFloat .mention-file-menu {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: calc(100% - 22px);
  z-index: 30;
  max-height: 240px;
  overflow: auto;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid #dbe5f2;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
}

#workspaceChatFloat .mention-file-menu button {
  min-width: 0;
  min-height: 38px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1e293b;
  cursor: pointer;
  padding: 6px 8px;
  text-align: left;
}

#workspaceChatFloat .mention-file-menu button:hover {
  background: #f6f8fb;
}

#workspaceChatFloat .mention-file-menu button > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#workspaceChatFloat .mention-file-type {
  width: 38px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #fff5f5;
  color: #dc2626;
  font-size: 11px;
  font-weight: 800;
}

#workspaceChatFloat .mention-file-type.word { background: #eff6ff; color: #2563eb; }
#workspaceChatFloat .mention-file-type.excel { background: #ecfdf5; color: #059669; }
#workspaceChatFloat .mention-file-type.image { background: #f5f3ff; color: #7c3aed; }
#workspaceChatFloat .mention-file-type.markdown,
#workspaceChatFloat .mention-file-type.text,
#workspaceChatFloat .mention-file-type.file { background: #f1f5f9; color: #475569; }

.mention-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.mention-file-list.hidden,
.mention-file-menu.hidden {
  display: none !important;
}

.mention-file-chip {
  max-width: 260px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border: 1px solid #dbe6ff;
  border-radius: 999px;
  background: #f6f9ff;
  color: #2563eb;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-file-chip button {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: #e6efff;
  color: #64748b;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}

.mention-file-menu {
  z-index: 80;
  max-height: 240px;
  overflow: auto;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid #dbe5f2;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
}

#analysisMentionMenu,
#inboxMentionMenu {
  position: static;
}

#marketingMentionMenu {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: calc(100% - 22px);
}

.mention-file-menu button {
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #1e293b;
  cursor: pointer;
  padding: 6px 8px;
  text-align: left;
}

.mention-file-menu button:hover {
  background: #f6f8fb;
}

.mention-file-menu button > span:last-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.mention-file-menu button strong,
.mention-file-menu button small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-file-menu button small,
.mention-file-loading {
  color: #64748b;
  font-size: 12px;
}

.mention-file-type {
  width: 38px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #fff5f5;
  color: #dc2626;
  font-size: 11px;
  font-weight: 800;
}

.mention-file-type.word { background: #eff6ff; color: #2563eb; }
.mention-file-type.excel { background: #ecfdf5; color: #059669; }
.mention-file-type.image { background: #f5f3ff; color: #7c3aed; }
.mention-file-type.markdown,
.mention-file-type.text,
.mention-file-type.file { background: #f1f5f9; color: #475569; }

#workspaceChatFloat .message-actions {
  position: relative;
}

#workspaceChatFloat .copy-toast {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 5;
  min-width: max-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: #1e293b;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.app-shell:has(#workspacesView:not(.hidden)) .content,
.app-shell:has(#workspacesView:not(.hidden)) #workspacesView.view,
.app-shell:has(#workspacesView:not(.hidden)) .kb-workbench {
  background: #ffffff;
}

.app-shell:has(#workspacesView:not(.hidden)) .kb-workbench {
  min-height: 100vh;
}

.app-shell:has(#workspacesView:not(.hidden)) .kb-empty {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #ffffff;
}

.app-shell:has(#workspacesView:not(.hidden)) .empty-copy-card {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-shell:has(#workspacesView:not(.hidden)) .empty-copy-card p {
  display: none;
}

#workspaceAssetDialog .asset-dialog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: stretch;
}

#workspaceAssetDialog .kb-upload-panel,
#workspaceAssetDialog .kb-bind-panel {
  flex: none;
  width: 100%;
}

#workspaceAssetDialog .kb-upload,
#workspaceAssetDialog .compact-dropzone,
#workspaceAssetDialog .browser-box {
  min-height: 520px;
}

#workspaceAssetDialog .browser-box {
  position: relative;
}

#workspaceAssetDialog .pathbar {
  position: absolute;
  top: 14px;
  right: 58px;
  z-index: 3;
}

#workspaceAssetDialog #workspaceBrowserUpBtn {
  height: 32px;
  min-height: 32px;
  border: 0;
  background: transparent;
  padding: 0 8px;
}

[data-workspace-nav-section="personal"] .workspace-project-toggle small {
  display: none !important;
}

[data-workspace-nav-section="personal"] .workspace-project-toggle {
  grid-template-columns: 16px minmax(0, 1fr);
}

/* Add assets dialog final prototype match */
#workspaceAssetDialog.workspace-asset-dialog {
  width: min(860px, calc(100vw - 64px));
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  gap: 24px;
  border: 0;
  border-radius: 20px;
  background: #ffffff;
  padding: 32px;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.1);
}

#workspaceAssetDialog.workspace-asset-dialog:not([open]) {
  display: none !important;
}

#workspaceAssetDialog::backdrop {
  background: rgba(241, 245, 249, 0.9);
  backdrop-filter: none;
}

#workspaceAssetDialog .dialog-head {
  min-height: auto;
  padding: 0;
  border: 0;
}

#workspaceAssetDialog .dialog-head h3 {
  color: #0f172a;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
}

#workspaceAssetDialog .dialog-close-btn {
  width: auto;
  height: auto;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 22px;
  line-height: 1;
}

#workspaceAssetDialog .asset-dialog-grid {
  height: auto;
  min-height: 0;
  display: flex;
  grid-template-columns: none;
  align-items: stretch;
  gap: 24px;
  margin: 0;
  padding: 0;
}

#workspaceAssetDialog .kb-upload-panel,
#workspaceAssetDialog .kb-bind-panel {
  display: flex;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

#workspaceAssetDialog .kb-upload-panel {
  flex: 1 1 0;
}

#workspaceAssetDialog .kb-bind-panel {
  flex: 1.4 1 0;
}

#workspaceAssetDialog .kb-upload,
#workspaceAssetDialog .compact-dropzone {
  width: 100%;
  height: auto;
  min-height: 318px;
}

#workspaceAssetDialog .compact-dropzone {
  padding: 40px 24px;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
  background: #f8fafc;
}

#workspaceAssetDialog .upload-cloud {
  width: 54px;
  height: 54px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: #ffffff;
  color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

#workspaceAssetDialog .upload-cloud::before {
  content: "";
  font-size: 25px;
}

#workspaceAssetDialog .compact-dropzone strong {
  margin-bottom: 6px;
  color: #1e293b;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
}

#workspaceAssetDialog .compact-dropzone strong::after {
  content: none;
}

#workspaceAssetDialog .compact-dropzone strong span {
  display: inline;
  color: #2563eb;
}

#workspaceAssetDialog .compact-dropzone small {
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.6;
}

#workspaceAssetDialog .browser-box {
  width: 100%;
  height: auto;
  min-height: 318px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border: 1px solid #edf2f7;
  border-radius: 16px;
  background: #ffffff;
}

#workspaceAssetDialog .subhead {
  min-height: 61px;
  padding: 14px 16px;
  border-bottom: 1px solid #edf2f7;
  background: #f8fafc;
}

#workspaceAssetDialog .subhead > div:first-child::before {
  content: "";
  color: #2563eb;
}

#workspaceAssetDialog .subhead span {
  color: #1e293b;
  font-size: 14px;
  font-weight: 700;
}

#workspaceAssetDialog .toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#workspaceAssetDialog .pathbar {
  position: absolute;
  top: 14px;
  right: 58px;
  z-index: 3;
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}

#workspaceAssetDialog .pathbar::after {
  content: "";
  width: 1px;
  height: 14px;
  margin: 0 12px 0 8px;
  background: #e2e8f0;
}

#workspaceAssetDialog #workspaceBrowserUpBtn {
  height: 32px;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: #64748b;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
}

#workspaceAssetDialog #workspaceBrowserRefreshBtn {
  width: 32px;
  height: 32px;
  min-height: 32px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
  color: #64748b;
}

#workspaceAssetDialog .toolbar-actions::before,
#workspaceAssetDialog #workspaceBrowserBindBtn {
  display: none;
}

#workspaceAssetDialog .webdav-browser {
  min-height: 180px;
  max-height: 220px;
  flex: 1 1 auto;
  padding: 8px;
  gap: 2px;
}

#workspaceAssetDialog .browser-card {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
}

#workspaceAssetDialog .browser-card strong {
  color: #334155;
  font-size: 14px;
  font-weight: 500;
}

#workspaceAssetDialog .asset-dialog-footer {
  padding: 12px 16px;
  border-top: 1px solid #edf2f7;
  background: #f8fafc;
}

#workspaceAssetDialog .selection-status {
  width: 100%;
  justify-content: space-between;
  gap: 14px;
}

#workspaceAssetDialog #workspaceBrowserSelectionCount {
  margin-right: auto;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

#workspaceAssetDialog .selection-status button {
  color: #2563eb;
  font-size: 13px;
  font-weight: 500;
}

#workspaceAssetDialog #workspaceBrowserClearBtn {
  color: #ef4444;
}

#workspaceAssetDialog .footer-actions {
  position: static;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 4px;
}

#workspaceAssetDialog .footer-actions button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
}

#workspaceAssetDialog .footer-actions .secondary {
  background: #f1f5f9;
  color: #475569;
}

#workspaceAssetDialog .footer-actions .primary {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

@media (max-width: 920px) {
  #workspaceAssetDialog .asset-dialog-grid {
    flex-direction: column;
  }
}

/* Subtle chat dock motion */
#workspaceChatFloat.kb-chat-dock {
  transform-origin: right bottom;
}

#workspaceChatFloat.kb-chat-dock.opening {
  animation: chatDockIn 240ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

#workspaceChatFloat.kb-chat-dock.closing {
  display: flex !important;
  animation: chatDockOut 220ms cubic-bezier(0.7, 0, 0.84, 0) both;
}

#workspaceChatLauncher.kb-chat-launcher {
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), opacity 180ms ease, box-shadow 180ms ease;
}

#workspaceChatLauncher.kb-chat-launcher:not(.has-custom-icon)::before {
  display: inline-block;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

#workspaceChatLauncher.kb-chat-launcher.has-custom-icon::before {
  content: none !important;
  display: none !important;
}

#workspaceChatLauncher.kb-chat-launcher:active {
  transform: scale(0.94);
}

#workspaceChatLauncher.kb-chat-launcher.launcher-hiding {
  opacity: 0;
  transform: translate(8px, 8px) scale(0.78) rotate(-18deg);
}

#workspaceChatLauncher.kb-chat-launcher.launcher-hiding:not(.has-custom-icon)::before {
  transform: rotate(-120deg);
}

#workspaceChatLauncher.kb-chat-launcher.launcher-showing {
  animation: chatLauncherIn 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

#workspaceChatLauncher.kb-chat-launcher.launcher-showing:not(.has-custom-icon)::before {
  animation: chatLauncherIconIn 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes chatDockIn {
  from {
    opacity: 0;
    transform: translate(34px, 22px) scale(0.94);
    filter: blur(1px);
  }
  70% {
    opacity: 1;
    transform: translate(-2px, -1px) scale(1.005);
    filter: blur(0);
  }
  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
    filter: blur(0);
  }
}

@keyframes chatDockOut {
  from {
    opacity: 1;
    transform: translate(0, 0) scale(1);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translate(32px, 18px) scale(0.94);
    filter: blur(1px);
  }
}

@keyframes chatLauncherIn {
  from {
    opacity: 0;
    transform: translate(8px, 8px) scale(0.76) rotate(-14deg);
  }
  70% {
    opacity: 1;
    transform: translate(0, 0) scale(1.04) rotate(2deg);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes chatLauncherIconIn {
  from {
    transform: rotate(120deg);
  }
  to {
    transform: rotate(0deg);
  }
}

/* Notes view display repair */
#todosView .note-editor-panel {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: 64px 48px auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

#todosView .note-editor-panel .panel-head {
  grid-row: 1;
  justify-content: center;
}

#todosView .note-toolbar {
  grid-row: 2;
  width: min(760px, calc(100% - 96px));
  max-width: none;
  justify-self: center;
  align-self: stretch;
  justify-content: center;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0 8px;
  border-bottom: 1px solid #edf2f7;
  scrollbar-width: none;
}

#todosView .note-toolbar::-webkit-scrollbar {
  display: none;
}

#todosView .note-title-field {
  grid-row: 3;
  margin-top: 40px;
}

#todosView .note-editor {
  grid-row: 4;
  min-height: 0;
  padding-bottom: 32px;
}

#todosView #noteSavedPath {
  grid-row: 5;
  align-self: end;
  min-height: 22px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#todosView .note-statusbar {
  grid-row: 6;
  align-self: end;
  min-height: 28px;
  padding: 0 0 10px;
  background: #ffffff;
}

#todosView .note-item {
  grid-template-columns: minmax(0, 1fr);
  padding-right: 44px;
}

#todosView .note-item::after {
  display: none;
}

#todosView .note-open {
  grid-column: 1;
}

#todosView .note-item .row-actions {
  right: 16px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

#todosView .note-editor ol,
#todosView .note-editor ul {
  margin: 0 0 18px;
  padding-left: 1.6em;
}

#todosView .note-editor ol {
  list-style-type: decimal;
}

#todosView .note-editor ol ol {
  list-style-type: lower-alpha;
}

#todosView .note-editor ol ol ol {
  list-style-type: lower-roman;
}

#todosView .note-editor ul {
  list-style-type: disc;
}

#todosView .note-editor ul ul {
  list-style-type: circle;
}

#todosView .note-editor ul ul ul {
  list-style-type: square;
}

#todosView .note-editor ol li,
#todosView .note-editor ul li {
  margin: 0 0 12px;
  padding-left: 0.35em;
  line-height: 1.75;
}

#todosView .note-editor ol li::marker {
  color: #2563eb;
  font-weight: 500;
}

#todosView #noteSidebarCollapseBtn,
#todosView .note-outline-head,
#todosView #insertNoteDateBtn,
#todosView #noteDatePicker,
#todosView .note-toolbar button[data-note-format="h2"],
#todosView .note-toolbar button[data-note-format="todo"] {
  display: none !important;
}

#todosView .note-color-popover {
  position: fixed;
  z-index: 80;
}

/* Notes toolbar icon refresh */
#todosView .note-toolbar button.note-icon-button,
#todosView .note-toolbar .note-color-trigger {
  width: 38px;
  min-width: 38px;
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 8px;
  color: #1f2329;
}

#todosView .note-toolbar button[data-note-format="h2"].note-icon-button {
  display: inline-flex !important;
}

#todosView .note-icon {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
  color: currentColor;
}

#todosView .note-icon-undo::before {
  content: "";
  position: absolute;
  left: 0;
  top: -5px;
  color: #8a8f98;
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

#todosView .note-icon-format::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 3px;
  width: 17px;
  height: 6px;
  border: 3px solid #1f2329;
  border-radius: 2px;
  box-sizing: border-box;
}

#todosView .note-toolbar button.active,
#todosView .note-toolbar select.active {
  border-color: rgba(22, 119, 255, 0.35);
  background: #eef6ff;
  color: #0f62fe;
}

#todosView .note-editor.tiptap-mounted {
  cursor: text;
}

#todosView .note-editor .recall-tiptap-content {
  min-height: 100%;
  outline: none;
}

#todosView .note-editor .recall-tiptap-content > *:first-child {
  margin-top: 0;
}

#todosView .note-editor .recall-tiptap-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 16px 0;
  border-radius: 8px;
}

#todosView .note-editor .recall-tiptap-content pre {
  overflow-x: auto;
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  padding: 14px 16px;
}

#todosView .note-editor .recall-tiptap-content code {
  border-radius: 4px;
  background: #f1f5f9;
  padding: 2px 5px;
}

#todosView .note-editor .recall-tiptap-content pre code {
  background: transparent;
  padding: 0;
}

#todosView .note-editor .recall-tiptap-content ul[data-type="taskList"] {
  list-style: none;
  padding-left: 0;
}

#todosView .note-editor .recall-tiptap-content ul[data-type="taskList"] li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

#todosView .note-editor .recall-tiptap-content ul[data-type="taskList"] label {
  padding-top: 3px;
}

#todosView .note-icon-format::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 10px;
  width: 5px;
  height: 12px;
  border-radius: 1px;
  background: #1f2329;
}

#todosView .note-icon-clear-format::before,
#todosView .note-icon-highlight::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  width: 12px;
  height: 16px;
  border: 3px solid #1f2329;
  border-radius: 2px;
  transform: rotate(28deg);
  box-sizing: border-box;
  background: #ffffff;
}

#todosView .note-icon-clear-format::after,
#todosView .note-icon-highlight::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 1px;
  width: 20px;
  height: 3px;
  background: #facc15;
}

#todosView .note-color-trigger {
  gap: 2px;
  text-decoration: none;
}

#todosView .note-color-trigger::after {
  position: static;
  margin-left: 2px;
  transform: none;
}

#todosView .note-icon-text-color::before {
  content: "A";
  position: absolute;
  left: 4px;
  top: -1px;
  color: #1f2329;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}

#todosView .note-icon-text-color::after {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 1px;
  width: 20px;
  height: 3px;
  background: #22c55e;
}

#todosView .note-icon-list::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #1f2329;
  box-shadow: 0 7px 0 #1f2329, 0 14px 0 #1f2329;
}

#todosView .note-icon-list::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 6px;
  width: 15px;
  height: 2px;
  border-radius: 2px;
  background: #1f2329;
  box-shadow: 0 7px 0 #1f2329, 0 14px 0 #1f2329;
}

#todosView .note-icon-ordered-list::before {
  content: "1.\A 2.\A 3.";
  position: absolute;
  left: 0;
  top: 2px;
  color: #1f2329;
  font-size: 7px;
  font-weight: 600;
  line-height: 7px;
  white-space: pre;
}

#todosView .note-icon-ordered-list::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 5px;
  width: 15px;
  height: 2px;
  border-radius: 2px;
  background: #1f2329;
  box-shadow: 0 7px 0 #1f2329, 0 14px 0 #1f2329;
}

/* Workspace AI organize */
#workspaceDetail .kb-header-actions {
  gap: 10px;
}

#workspaceDetail .workspace-ai-organize-btn,
#workspaceDetail #openWorkspaceAssetDialogBtn {
  min-height: 40px;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 600;
}

#workspaceDetail .workspace-ai-organize-btn {
  border: 1px solid #dbe4f0;
  background: #ffffff;
  color: #526174;
  box-shadow: none;
}

#workspaceDetail .workspace-ai-organize-btn:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
  color: #2563eb;
}

#workspaceAiOrganizeDialog.workspace-ai-organize-dialog {
  width: min(560px, calc(100vw - 40px));
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

#workspaceAiOrganizeDialog::backdrop {
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
}

#workspaceAiOrganizeDialog .dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 14px;
  border-bottom: 1px solid #edf2f7;
}

#workspaceAiOrganizeDialog .dialog-head h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.workspace-ai-organize-body {
  max-height: min(52vh, 460px);
  overflow: auto;
  padding: 18px 24px;
}

.workspace-ai-organize-body > p {
  margin: 0 0 14px;
  color: #64748b;
}

.workspace-ai-organize-setup {
  display: grid;
  gap: 12px;
}

.workspace-ai-organize-setup .field {
  display: grid;
  gap: 8px;
  margin: 0;
}

.workspace-ai-organize-setup .field span {
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

.workspace-ai-organize-setup select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  background: #ffffff;
  color: #1e293b;
  font-size: 15px;
  font-weight: 600;
  padding: 0 12px;
}

.workspace-ai-organize-setup p {
  margin: 0;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.6;
}

.workspace-ai-organize-list {
  display: grid;
  gap: 10px;
}

.workspace-ai-organize-file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #edf2f7;
  border-radius: 10px;
  background: #ffffff;
}

.workspace-ai-organize-file input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

.workspace-ai-organize-file strong,
.workspace-ai-organize-file small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-ai-organize-file strong {
  font-size: 14px;
}

.workspace-ai-organize-file small {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 12px;
}

.workspace-ai-organize-progress {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 13px;
}

.workspace-ai-organize-result {
  display: grid;
  gap: 12px;
}

.workspace-ai-organize-result p {
  margin: 0;
}

.workspace-ai-organize-result ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.workspace-ai-organize-result li {
  margin: 4px 0;
  color: #2563eb;
}

.workspace-ai-organize-failures {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff1f2;
  color: #be123c;
  font-size: 13px;
}

.workspace-ai-organize-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 22px;
  border-top: 1px solid #edf2f7;
  background: #f8fafc;
}

.workspace-ai-organize-footer button {
  min-height: 40px;
  border-radius: 10px;
  padding: 10px 20px;
}

/* Polished note toolbar alignment */
#todosView .note-toolbar {
  height: 52px;
  min-height: 52px;
  gap: 8px;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid #e9eef5;
  background: #ffffff;
}

#todosView .note-toolbar button,
#todosView .note-toolbar select,
#todosView .note-color-trigger {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #667085;
  font-size: 21px;
  font-weight: 650;
  line-height: 1;
  padding: 0;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

#todosView .note-toolbar button:hover,
#todosView .note-toolbar select:hover,
#todosView .note-color-trigger:hover {
  background: #f3f6fa;
  color: #1f2937;
}

#todosView .note-toolbar button:active,
#todosView .note-color-trigger:active {
  transform: translateY(1px);
}

#todosView .note-toolbar button strong,
#todosView .note-toolbar button u,
#todosView .note-toolbar button s {
  font-size: 20px;
  font-weight: 650;
  line-height: 1;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

#todosView .note-toolbar select {
  width: 74px;
  min-width: 74px;
  max-width: 74px;
  color: #667085;
  font-size: 17px;
  font-weight: 600;
  appearance: none;
  text-align: center;
  text-align-last: center;
}

#todosView .note-color-trigger {
  width: 48px;
  min-width: 48px;
  gap: 5px;
}

#todosView .note-color-trigger::after {
  flex: 0 0 auto;
  border-left-width: 5px;
  border-right-width: 5px;
  border-top-width: 6px;
  border-top-color: #98a2b3;
  margin-left: 2px;
}

#todosView .note-icon {
  width: 24px;
  height: 24px;
  color: #1f2937;
}

#todosView .note-icon-undo::before {
  left: 1px;
  top: -2px;
  color: #98a2b3;
  font-size: 27px;
  font-weight: 300;
}

#todosView .note-icon-format::before {
  left: 3px;
  top: 4px;
  width: 18px;
  height: 6px;
  border-width: 2.5px;
  border-radius: 2px;
}

#todosView .note-icon-format::after {
  left: 10px;
  top: 10px;
  width: 5px;
  height: 12px;
  border-radius: 2px;
}

#todosView .note-icon-clear-format::before,
#todosView .note-icon-highlight::before {
  left: 7px;
  top: 3px;
  width: 11px;
  height: 17px;
  border-width: 2.5px;
  border-radius: 2px;
  transform: rotate(28deg);
}

#todosView .note-icon-clear-format::after {
  display: none;
}

#todosView .note-icon-highlight::after {
  left: 3px;
  bottom: 0;
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: #f2c200;
}

#todosView .note-icon-text-color::before {
  left: 4px;
  top: -1px;
  font-size: 25px;
  font-weight: 400;
}

#todosView .note-icon-text-color::after {
  left: 3px;
  bottom: 0;
  width: 21px;
  height: 3px;
  border-radius: 2px;
  background: #22c55e;
}

#todosView .note-icon-list::before {
  left: 2px;
  top: 4px;
  width: 4px;
  height: 4px;
  box-shadow: 0 8px 0 #1f2937, 0 16px 0 #1f2937;
}

#todosView .note-icon-list::after {
  left: 10px;
  top: 5px;
  width: 15px;
  height: 2.5px;
  box-shadow: 0 8px 0 #1f2937, 0 16px 0 #1f2937;
}

#todosView .note-icon-ordered-list::before {
  left: 0;
  top: 1px;
  font-size: 7px;
  line-height: 8px;
  font-weight: 700;
}

#todosView .note-icon-ordered-list::after {
  left: 10px;
  top: 4px;
  width: 15px;
  height: 2.5px;
  box-shadow: 0 8px 0 #1f2937, 0 16px 0 #1f2937;
}

/* Workspace composer mention/send alignment */
#workspaceChatFloat .mention-file-list {
  display: none !important;
}

#workspaceChatFloat .kb-composer {
  position: relative;
}

#workspaceChatFloat .composer-actions {
  position: absolute !important;
  right: 34px !important;
  top: 28px !important;
  bottom: auto !important;
  z-index: 3;
}

#workspaceChatFloat .kb-composer textarea {
  padding-right: 72px !important;
}

/* Note insight dialog */
#todosView .note-editor-panel {
  position: relative;
}

#todosView .note-summary-float {
  position: absolute;
  right: 28px;
  bottom: 92px;
  z-index: 8;
  width: 64px;
  min-width: 64px;
  height: 64px;
  min-height: 64px;
  border: 0;
  border-radius: 50%;
  background: #ffffff url("/images/chat-launcher.png") center / 100% 100% no-repeat;
  color: transparent;
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.24);
  font-size: 0;
  overflow: hidden;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

#todosView .note-summary-float:hover {
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.34);
  transform: translateY(-1px);
}

#todosView .note-summary-float:active {
  transform: scale(0.96);
}

#noteSummaryDialog.note-summary-dialog {
  width: min(640px, calc(100vw - 48px));
  max-height: min(760px, calc(100vh - 80px));
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
  animation: noteSummaryIn 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

#noteSummaryDialog::backdrop {
  background: rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(2px);
}

#noteSummaryDialog .dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 14px;
  border-bottom: 1px solid #edf2f7;
}

#noteSummaryDialog .dialog-head h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.note-summary-content {
  max-height: min(52vh, 460px);
  overflow: auto;
  padding: 20px 24px;
  background: #ffffff;
}

.note-summary-content .empty-note {
  border: 1px dashed #dbe6f5;
  border-radius: 12px;
  padding: 16px;
  color: #64748b;
}

.note-summary-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 22px;
  border-top: 1px solid #edf2f7;
  background: #f8fafc;
}

.note-summary-footer button {
  min-height: 40px;
  border-radius: 10px;
  padding: 10px 20px;
}

@keyframes noteSummaryIn {
  from {
    opacity: 0;
    transform: translate(24px, 18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

/* Final note layout polish */
#todosView .note-editor-panel {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: 64px 52px auto minmax(0, 1fr) 34px 52px;
  padding-bottom: 18px;
  box-sizing: border-box;
}

#todosView #noteSummaryBtn {
  display: none !important;
}

#todosView #noteSavedPath {
  min-height: 34px;
  padding: 4px 28px 6px;
  box-sizing: border-box;
}

#todosView .note-statusbar {
  min-height: 52px;
  padding: 2px 28px 20px;
  box-sizing: border-box;
}

/* Keep color pickers independent from toolbar button sizing */
#todosView .note-toolbar .note-color-popover {
  position: fixed;
  z-index: 2000;
  width: 314px;
  max-width: calc(100vw - 24px);
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.14);
}

#todosView .note-toolbar .note-color-popover > span {
  display: block;
  margin: 0 0 10px;
  color: #8b95a7;
  font-size: 13px;
  line-height: 1.2;
}

#todosView .note-toolbar .note-color-popover .note-color-none {
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

#todosView .note-toolbar .note-color-popover .note-color-grid {
  display: grid;
  grid-template-columns: repeat(10, 24px);
  gap: 6px;
}

#todosView .note-toolbar .note-color-popover .note-color-grid button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  display: block;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 5px;
  background: var(--swatch);
  padding: 0;
  font-size: 0;
  line-height: 0;
}

#todosView .note-toolbar .note-color-popover .note-color-grid button:hover,
#todosView .note-toolbar .note-color-popover .note-color-grid button:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16);
}

body > .note-color-popover {
  position: fixed;
  z-index: 2000;
  width: 314px;
  max-width: calc(100vw - 24px);
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.14);
}

body > .note-color-popover > span {
  display: block;
  margin: 0 0 10px;
  color: #8b95a7;
  font-size: 13px;
  line-height: 1.2;
}

body > .note-color-popover .note-color-none {
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

body > .note-color-popover .note-color-grid {
  display: grid;
  grid-template-columns: repeat(10, 24px);
  gap: 6px;
}

body > .note-color-popover .note-color-grid button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  display: block;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 5px;
  background: var(--swatch);
  padding: 0;
  font-size: 0;
  line-height: 0;
}

body > .note-color-popover .note-color-grid button:hover,
body > .note-color-popover .note-color-grid button:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16);
}

/* New card-shell interface language */
:root {
  --recall-canvas: #efefef;
  --recall-card: #ffffff;
  --recall-ink: #2d3133;
  --recall-muted: #8a9299;
  --recall-blue: #2f6bff;
  --recall-blue-soft: #f0f4ff;
  --recall-shadow: 0 4px 20px rgba(0, 0, 0, 0.02), 0 2px 6px rgba(0, 0, 0, 0.02);
  --recall-radius: 24px;
}

body {
  background: var(--recall-canvas);
  color: var(--recall-ink);
}

.app-shell,
.app-shell:has(#todosView:not(.hidden)),
.app-shell:has(#settingsView:not(.hidden)) {
  min-height: 100vh;
  height: 100vh;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  background: var(--recall-canvas);
  overflow: hidden;
}

.sidebar,
.app-shell:has(#todosView:not(.hidden)) .sidebar,
.app-shell:has(#settingsView:not(.hidden)) .sidebar {
  width: 280px;
  min-width: 280px;
  height: calc(100vh - 40px);
  padding: 24px 16px;
  border: 0;
  border-radius: var(--recall-radius);
  background: var(--recall-card);
  box-shadow: var(--recall-shadow);
  color: var(--recall-ink);
}

.content {
  height: calc(100vh - 40px);
  min-width: 0;
  overflow: hidden;
  border-radius: var(--recall-radius);
  background: var(--recall-card);
  box-shadow: var(--recall-shadow);
}

.topbar {
  display: none;
}

.brand,
.app-shell:has(#todosView:not(.hidden)) .brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-areas:
    "mark name"
    "mark email"
    "search search";
  align-items: center;
  column-gap: 14px;
  margin: 0 0 20px;
  padding: 16px;
  border-radius: 18px;
  background: #f7f8fa;
}

.brand-row,
.app-shell:has(#todosView:not(.hidden)) .brand-row {
  display: contents;
}

.avatar-wrapper {
  grid-area: mark;
  position: relative;
  width: 44px;
  height: 44px;
  display: block;
}

.brand-mark,
.app-shell:has(#todosView:not(.hidden)) .brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f80ff, #2f6bff);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
}

.status-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 10px;
  height: 10px;
  border: 2px solid #f7f8fa;
  border-radius: 50%;
  background: #22c55e;
}

.brand h1,
.app-shell:has(#todosView:not(.hidden)) .brand h1 {
  grid-area: name;
  align-self: end;
  color: #1a1c1e;
  font-size: 14px;
  font-weight: 700;
}

.brand p,
.app-shell:has(#todosView:not(.hidden)) .brand p {
  grid-area: email;
  align-self: start;
  margin: 2px 0 0;
  color: var(--recall-muted);
  font-size: 12px;
}

.sidebar-search,
.app-shell:has(#todosView:not(.hidden)) .sidebar-search {
  grid-area: search;
  height: 40px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0 12px;
  border: 1px solid #eaeaea;
  border-radius: 12px;
  background: #f7f8fa;
}

.sidebar-search:focus-within,
.app-shell:has(#todosView:not(.hidden)) .sidebar-search:focus-within {
  border-color: var(--recall-blue);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.1);
}

.sidebar-search .icon-base {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
}

.sidebar-search input,
.app-shell:has(#todosView:not(.hidden)) .sidebar-search input {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--recall-ink);
  font-size: 13px;
}

.kb-nav {
  flex: 1 1 auto;
  display: block;
  min-height: 0;
  overflow: auto;
  padding: 0 4px;
}

.kb-nav::before,
.sidebar-bottom::before,
.app-shell:has(#todosView:not(.hidden)) .kb-nav::before,
.app-shell:has(#todosView:not(.hidden)) .sidebar-bottom::before {
  display: block;
  content: "鍐呭";
  margin: 0 0 12px;
  padding: 0 12px;
  color: var(--recall-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.sidebar-bottom::before,
.app-shell:has(#todosView:not(.hidden)) .sidebar-bottom::before {
  content: "绯荤粺";
  margin-top: 24px;
}

.nav-left,
.workspace-project-toggle .nav-left,
.workspace-open .nav-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-base {
  width: 32px;
  min-width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.icon-placeholder {
  display: block;
  width: 15px;
  height: 15px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.icon-search .icon-placeholder {
  background-image: url("/images/sidebar-search.png"), url("/images/瀵硅瘽.png");
}

.icon-home .icon-placeholder {
  background-image: url("/images/sidebar-home.png"), url("/images/favicon.png");
}

.icon-inbox .icon-placeholder {
  background-image: url("/images/sidebar-inbox.png");
}

.icon-message .icon-placeholder {
  background-image: url("/images/sidebar-message.png");
}

.icon-kb .icon-placeholder {
  background-image: url("/images/sidebar-kb.png");
}

.icon-project .icon-placeholder {
  background-image: url("/images/sidebar-project.png"), url("/images/sidebar-kb.png");
}

.icon-workspace .icon-placeholder {
  background-image: url("/images/sidebar-workspace.png"), url("/images/sidebar-kb.png");
}

.icon-note .icon-placeholder {
  background-image: url("/images/sidebar-note.png");
}

.icon-marketing .icon-placeholder {
  background-image: url("/images/sidebar-marketing.png");
}

.icon-setting .icon-placeholder {
  background-image: url("/images/sidebar-setting.png");
}

.icon-logout .icon-placeholder {
  background-image: url("/images/sidebar-logout.png");
}

.icon-kb { background: #e2f7ed; color: #10b981; }
.icon-project { background: #fee2e2; color: #ef4444; }
.icon-workspace { background: #f3f4f6; color: #9ca3af; }
.icon-home { background: #eaf1ff; color: #2563eb; }
.icon-message { background: #ecfeff; color: #0891b2; }
.icon-note { background: #e0e7ff; color: #6366f1; }
.icon-marketing { background: #e0f2fe; color: #0284c7; }
.icon-setting { background: #dcfce7; color: #22c55e; }
.icon-logout { background: #fee2e2; color: #dc2626; }

.sidebar .nav,
.sidebar-logout,
[data-workspace-nav-section="personal"] .kb-group-toggle,
[data-workspace-nav-section="projects"] .kb-group-toggle,
.app-shell:has(#todosView:not(.hidden)) .sidebar .nav,
.app-shell:has(#todosView:not(.hidden)) .sidebar-logout,
.app-shell:has(#todosView:not(.hidden)) [data-workspace-nav-section="personal"] .kb-group-toggle {
  width: 100%;
  min-height: 52px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 6px;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #3a3f42;
  font-size: 14px;
  font-weight: 500;
}

.sidebar .nav::before,
.sidebar-logout::before,
[data-workspace-nav-section="personal"] .kb-group-toggle::before,
[data-workspace-nav-section="projects"] .kb-group-toggle::before {
  content: none !important;
  display: none !important;
}

[data-workspace-nav-section="personal"] .kb-group-toggle span:last-child,
[data-workspace-nav-section="projects"] .kb-group-toggle span:last-child {
  font-size: inherit !important;
}

[data-workspace-nav-section="personal"] .kb-group-toggle span:last-child::before,
[data-workspace-nav-section="projects"] .kb-group-toggle span:last-child::before {
  content: none !important;
  display: none !important;
}

.sidebar .nav:hover,
.sidebar-logout:hover,
[data-workspace-nav-section="personal"] .kb-group-toggle:hover,
[data-workspace-nav-section="projects"] .kb-group-toggle:hover {
  background: #f7f8fa;
  color: var(--recall-ink);
}

.sidebar .nav.active,
.sidebar .nav[data-view="workspaces"].active,
.app-shell:has(#workspacesView:not(.hidden)) [data-workspace-nav-section="personal"] .kb-group-toggle,
.app-shell:has(#todosView:not(.hidden)) .sidebar .nav.active {
  background: var(--recall-blue-soft);
  color: var(--recall-blue);
  font-weight: 800;
}

.app-shell:has(#workspacesView:not(.hidden)) [data-workspace-nav-section="personal"] .kb-group-toggle .icon-kb {
  background: #10b981;
  color: #ffffff;
}

.kb-group-arrow,
.workspace-tree-arrow {
  order: 3;
  width: auto;
  min-width: 10px;
  color: currentColor;
  font-size: 10px;
  font-weight: 800;
}

[data-workspace-nav-section="personal"] .workspace-list {
  padding-left: 20px;
  margin: 2px 0 6px;
}

.workspace-project-toggle {
  min-height: 42px;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  padding: 0 10px;
}

.workspace-project-toggle .nav-left,
.workspace-open .nav-left {
  gap: 12px;
}

.workspace-project-toggle .icon-base,
.workspace-open .icon-base {
  width: 24px;
  min-width: 24px;
  height: 24px;
}

[data-workspace-nav-section="personal"] .workspace-project-name {
  color: currentColor;
  font-size: 14px;
  font-weight: 650;
}

[data-workspace-nav-section="personal"] .workspace-project-toggle small {
  min-width: 28px;
  justify-content: center;
  border-radius: 999px;
  background: #efefef;
  color: var(--recall-muted);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
}

[data-workspace-nav-section="personal"] .workspace-project-list {
  padding-left: 22px;
}

.workspace-open {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
}

[data-workspace-nav-section="personal"] .workspace-card {
  border-radius: 14px;
}

[data-workspace-nav-section="personal"] .workspace-card.active {
  background: #f3f4f6;
  color: var(--recall-ink);
  font-weight: 800;
}

[data-workspace-nav-section="personal"] .workspace-card.active::after {
  content: none !important;
  display: none !important;
}

.sidebar-bottom {
  margin: 0;
  padding: 0;
}

.sidebar-logout,
.app-shell:has(#todosView:not(.hidden)) .sidebar-logout {
  min-height: 44px;
  justify-content: flex-start;
  margin: 10px 4px 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  color: #dc2626;
  font-weight: 800;
}

.sidebar-sync-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 4px 0;
  padding: 16px 12px 0;
  border-top: 1px dashed #e5e7eb;
  color: var(--recall-muted);
  font-size: 12px;
  line-height: 1.2;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
  animation: recallSyncPulse 1.8s ease-out infinite;
}

@keyframes recallSyncPulse {
  70% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.kb-workbench,
.kb-empty {
  min-height: 100%;
  background: transparent;
}

.kb-detail {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 32px;
}

.kb-header {
  margin: 0 0 24px;
}

.kb-title-wrap h2,
#workspaceHeaderName {
  color: #1f2937;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 0;
}

.kb-header-actions {
  display: flex;
  gap: 12px;
}

#workspaceDetail .workspace-ai-organize-btn,
#workspaceDetail #openWorkspaceAssetDialogBtn {
  min-height: 40px;
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 800;
}

#workspaceDetail .workspace-ai-organize-btn {
  order: 1;
  border: 1px solid #e9e3ff;
  background: #f5f3ff;
  color: #6d28d9;
}

#workspaceDetail #openWorkspaceAssetDialogBtn {
  order: 2;
  border: 0;
  background: var(--recall-blue);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(47, 107, 255, 0.2);
}

#workspaceDetail #openWorkspaceAssetDialogBtn:hover {
  background: #1a56f0;
  transform: translateY(-1px);
}

#workspaceDeleteSelectedFilesBtn {
  order: 2;
  min-height: 42px;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  background: #fff1f2;
  color: #e11d48;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 800;
}

#workspaceDeleteSelectedFilesBtn:hover {
  background: #ffe4e6;
  border-color: #fda4af;
  transform: translateY(-1px);
}

#workspaceEditTagsBtn {
  order: 2;
  min-height: 42px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #2563eb;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 800;
}

#workspaceEditTagsBtn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.kb-workspace-grid,
.kb-main-column {
  min-height: 0;
  height: 100%;
}

.kb-file-section {
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 24px;
  overflow: auto;
  border: 1px solid #f0f0f0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: none;
}

.kb-section-head {
  align-items: center;
  margin-bottom: 24px;
}

.kb-section-head h3 {
  color: #1f2937;
  font-size: 15px;
  font-weight: 800;
}

.kb-section-head p,
.kb-section-head span {
  color: var(--recall-muted);
  font-size: 12px;
}

.kb-file-actions {
  gap: 12px;
}

.workspace-file-search {
  width: 180px;
  height: 34px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  color: var(--recall-ink);
  font-size: 12px;
}

.workspace-file-search:focus {
  border-color: var(--recall-blue);
  background: #ffffff;
  box-shadow: none;
}

#workspaceFileSelectAllBtn {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: #f3f4f6;
  color: #374151;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 800;
}

#workspaceFileHint {
  min-width: auto;
  color: var(--recall-muted);
  font-size: 13px;
  font-weight: 700;
}

.workspace-files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.workspace-file-card {
  position: relative;
  min-height: 174px;
  align-items: center;
  text-align: center;
  padding: 16px;
  border: 1px solid #eaeaea;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.workspace-file-card:hover {
  border-color: rgba(47, 107, 255, 0.3);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.03);
  transform: translateY(-2px);
}

.workspace-file-card.selected {
  border-color: rgba(47, 107, 255, 0.55);
  background: #fbfdff;
}

.workspace-file-card .file-thumb {
  width: 52px;
  height: 58px;
  margin: 0 0 14px;
  border-radius: 8px;
  background: #fff1f2;
  color: #f43f5e;
}

.workspace-file-card .file-type-mark {
  font-size: 12px;
  font-weight: 900;
}

.workspace-file-card .file-card-body {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.workspace-file-card .file-card-body strong {
  height: 38px;
  margin: 0 0 34px;
  color: #374151;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.workspace-file-card .file-card-body small {
  width: 100%;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed #e5e7eb;
  color: var(--recall-muted);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
}

.workspace-file-card .file-select {
  top: 10px;
  right: 10px;
}

.workspace-file-card .file-card-actions {
  display: none;
}

.workspace-file-card .file-card-tags {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 116px;
  z-index: 2;
  display: flex !important;
  justify-content: center;
  gap: 5px;
  min-height: 0;
  margin: 0;
  pointer-events: none;
  overflow: hidden;
}

.workspace-file-card .file-card-tags span {
  max-width: 72px;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-chat-launcher {
  width: 44px;
  height: 44px;
  right: 24px;
  bottom: 24px;
  border-radius: 50%;
  background: var(--recall-blue);
  box-shadow: 0 4px 14px rgba(47, 107, 255, 0.3);
}

/* Sidebar custom image icons should render as the icon itself, without an extra color base. */
.sidebar .icon-search,
.sidebar .icon-home,
.sidebar .icon-inbox,
.sidebar .icon-kb,
.sidebar .icon-project,
.sidebar .icon-workspace,
.sidebar .icon-note,
.sidebar .icon-marketing,
.sidebar .icon-thought,
.sidebar .icon-setting {
  background: transparent !important;
  color: inherit;
}

.sidebar .icon-search .icon-placeholder,
.sidebar .icon-home .icon-placeholder,
.sidebar .icon-inbox .icon-placeholder,
.sidebar .icon-kb .icon-placeholder,
.sidebar .icon-project .icon-placeholder,
.sidebar .icon-workspace .icon-placeholder,
.sidebar .icon-note .icon-placeholder,
.sidebar .icon-marketing .icon-placeholder,
.sidebar .icon-thought .icon-placeholder,
.sidebar .icon-setting .icon-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background-size: contain;
}

.sidebar-search .icon-base {
  opacity: 0.72;
}

/* Workspace tree hierarchy: project groups use dots, workspaces use text only. */
.sidebar .nav .icon-base,
.sidebar .kb-group-toggle .icon-kb,
.sidebar .sidebar-logout .icon-base {
  width: 32px;
  min-width: 32px;
  height: 32px;
}

.sidebar .nav .icon-placeholder,
.sidebar .kb-group-toggle .icon-kb .icon-placeholder,
.sidebar .sidebar-logout .icon-placeholder {
  width: 22px;
  height: 22px;
}

.workspace-project-toggle .icon-project {
  width: 10px !important;
  min-width: 10px !important;
  height: 10px !important;
  border-radius: 50%;
  background: #dbe2ee !important;
}

.workspace-project-toggle .icon-project .icon-placeholder {
  display: none !important;
}

.workspace-project-toggle .nav-left {
  gap: 12px;
}

.workspace-open .icon-workspace {
  display: none !important;
}

.workspace-open .nav-left {
  gap: 0;
}

.sidebar .icon-logout {
  background: transparent !important;
}

.sidebar .icon-logout .icon-placeholder {
  width: 22px;
  height: 22px;
  background-size: contain;
}

.sidebar-logout::before,
.sidebar-logout::after {
  content: none !important;
  display: none !important;
}

.kb-nav > .nav[data-view="todos"] {
  margin-top: 8px;
}

/* Let the whole sidebar scroll together, including logout and sync status. */
.sidebar,
.app-shell:has(#todosView:not(.hidden)) .sidebar,
.app-shell:has(#settingsView:not(.hidden)) .sidebar {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.kb-nav,
.app-shell:has(#todosView:not(.hidden)) .kb-nav,
.app-shell:has(#settingsView:not(.hidden)) .kb-nav {
  flex: 0 0 auto !important;
  overflow: visible !important;
  min-height: auto !important;
}

.sidebar-sync-status {
  flex: 0 0 auto;
  margin-bottom: 8px;
}

.sidebar .nav.nav-icon-only {
  justify-content: center;
  width: 52px;
  min-height: 52px;
  margin: 0 0 6px;
  padding: 0;
}

.sidebar .nav.nav-icon-only .icon-base {
  width: 46px;
  min-width: 46px;
  height: 46px;
  background: transparent !important;
}

.sidebar .nav[data-view="todos"] {
  order: 3;
}

.sidebar .nav[data-view="inbox"] {
  order: 4;
}

.sidebar .nav[data-view="thoughts"] {
  order: 5;
}

.sidebar .nav[data-view="marketing"] {
  order: 6;
}

.sidebar .nav[data-view="thoughts"] .flomo-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent;
  color: currentColor;
  line-height: 1;
  box-shadow: none;
}

.sidebar .nav[data-view="thoughts"] .bolt-outline {
  position: relative;
  width: 22px;
  height: 23px;
  display: block;
  background: currentColor;
  clip-path: polygon(54% 0, 15% 56%, 46% 56%, 36% 100%, 87% 42%, 56% 42%);
}

.sidebar .nav[data-view="thoughts"] .bolt-outline::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: #ffffff;
  clip-path: polygon(54% 0, 15% 56%, 46% 56%, 36% 100%, 87% 42%, 56% 42%);
}

.sidebar .nav[data-view="thoughts"]:hover,
.sidebar .nav[data-view="thoughts"].active {
  background: #1a1a1c;
  color: #ffffff;
}

.sidebar .nav[data-view="thoughts"]:hover .bolt-outline::after,
.sidebar .nav[data-view="thoughts"].active .bolt-outline::after {
  background: #1a1a1c;
}

/* Shared floating launcher motion for workspace chat and note insight. */
#workspaceChatLauncher.kb-chat-launcher,
#marketingAnalysisLauncher.kb-chat-launcher,
#todosView .note-summary-float,
#inboxView .inbox-ai-float {
  transform-origin: center;
  animation: recallLauncherBreathe 3.3s ease-in-out infinite;
  will-change: transform, box-shadow;
}

#workspaceChatLauncher.kb-chat-launcher::after,
#marketingAnalysisLauncher.kb-chat-launcher::after,
#todosView .note-summary-float::after,
#inboxView .inbox-ai-float::after {
  content: "";
  position: absolute;
  inset: -9px;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(255, 112, 32, 0.2) 0%, rgba(37, 99, 235, 0.12) 45%, transparent 72%);
  opacity: 0;
  transform: scale(0.78);
  pointer-events: none;
  animation: recallLauncherRipple 3.3s ease-out infinite;
}

#workspaceChatLauncher.kb-chat-launcher:hover,
#marketingAnalysisLauncher.kb-chat-launcher:hover,
#todosView .note-summary-float:hover,
#inboxView .inbox-ai-float:hover {
  transform: translateY(-4px) scale(1.12);
  box-shadow: 0 24px 54px rgba(37, 99, 235, 0.34), 0 0 0 12px rgba(255, 112, 32, 0.08);
  animation-play-state: paused;
}

#workspaceChatLauncher.kb-chat-launcher:active,
#marketingAnalysisLauncher.kb-chat-launcher:active,
#todosView .note-summary-float:active,
#inboxView .inbox-ai-float:active {
  animation: recallLauncherPop 320ms cubic-bezier(0.2, 1.45, 0.34, 1) both;
}

@keyframes recallLauncherBreathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 18px 42px rgba(37, 99, 235, 0.24), 0 0 0 0 rgba(255, 112, 32, 0);
  }
  45% {
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 26px 62px rgba(37, 99, 235, 0.34), 0 0 0 14px rgba(255, 112, 32, 0.1);
  }
}

@keyframes recallLauncherRipple {
  0% {
    opacity: 0.58;
    transform: scale(0.76);
  }
  58% {
    opacity: 0;
    transform: scale(1.42);
  }
  100% {
    opacity: 0;
    transform: scale(1.42);
  }
}

@keyframes recallLauncherPop {
  0% {
    transform: scale(1.06);
  }
  42% {
    transform: scale(0.82);
  }
  72% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1.04);
  }
}

.workspace-tags-dialog {
  width: min(520px, calc(100vw - 48px));
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

.workspace-tags-dialog::backdrop {
  background: rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(2px);
}

.workspace-tags-dialog .dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid #edf2f7;
}

.workspace-tags-dialog .dialog-head h3 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 900;
}

.workspace-tags-dialog .dialog-head p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.workspace-tags-dialog .field {
  display: grid;
  gap: 8px;
  padding: 20px 24px 0;
}

.workspace-tags-dialog .field span {
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

#workspaceTagsInput {
  width: 100%;
  resize: vertical;
  min-height: 112px;
  border: 1px solid #dbe6f5;
  border-radius: 12px;
  padding: 14px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 15px;
  line-height: 1.6;
}

#workspaceTagsInput:focus {
  outline: 0;
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.workspace-tags-help {
  margin: 8px 24px 0;
  color: #94a3b8;
  font-size: 12px;
}

.workspace-tags-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px 22px;
  border-top: 1px solid #edf2f7;
  background: #f8fafc;
  margin-top: 20px;
}

.workspace-tags-footer button {
  min-height: 40px;
  border-radius: 10px;
  padding: 10px 20px;
}

/* Inbox MVP */
#inboxView {
  position: relative;
  min-height: calc(100vh - 96px);
  display: flex;
  justify-content: center;
  padding: 28px 24px 48px;
}

.inbox-panel {
  width: min(1120px, 100%);
  min-height: min(680px, calc(100vh - 180px));
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 36px;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
}

.inbox-copy h3 {
  margin: 0 0 8px;
  color: #111827;
  font-size: 24px;
  font-weight: 900;
}

.inbox-copy p {
  max-width: 680px;
  margin: 0;
  color: #64748b;
  font-size: 15px;
  line-height: 1.7;
}

.inbox-source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 16px;
}

.inbox-source-card {
  position: relative;
  min-height: 150px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 10px;
  padding: 24px;
  border: 1px dashed #c8d7ee;
  border-radius: 16px;
  background: #f8fbff;
  color: #172033;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.inbox-source-card input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.inbox-source-card:hover {
  border-color: #2563eb;
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.1);
}

.inbox-source-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #2563eb;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.inbox-source-card strong {
  font-size: 17px;
  font-weight: 900;
}

.inbox-source-card small,
.inbox-file-pill small,
.inbox-preview-card small,
.inbox-saved-card small {
  color: #64748b;
  font-size: 12px;
}

.inbox-selected-files {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inbox-file-pill {
  position: relative;
  display: grid;
  gap: 3px;
  max-width: 280px;
  padding: 12px 38px 12px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.inbox-file-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 22px;
  height: 22px;
  min-width: 22px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #e8eef7;
  color: #64748b;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.inbox-file-remove:hover {
  background: #dbeafe;
  color: #2563eb;
}

.inbox-file-pill strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1e293b;
  font-size: 13px;
}

.inbox-draft {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
  align-items: start;
}

.inbox-draft-preview,
.inbox-draft-editor,
.inbox-saved-section {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
  padding: 18px;
}

.inbox-saved-section {
  display: none !important;
}

.inbox-draft-preview h4 {
  margin: 0 0 12px;
  color: #111827;
  font-size: 15px;
}

.inbox-file-preview {
  display: grid;
  gap: 10px;
}

.inbox-preview-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  background: #f8fafc;
}

.inbox-preview-card img,
.inbox-preview-file {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  object-fit: cover;
  background: #eaf1ff;
}

.inbox-preview-file {
  display: grid;
  place-items: center;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
}

.inbox-draft-editor {
  display: grid;
  gap: 14px;
}

.inbox-draft-editor input,
.inbox-draft-editor textarea {
  width: 100%;
  border: 1px solid #dbe6f5;
  border-radius: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.65;
}

.inbox-draft-editor textarea {
  resize: vertical;
}

#inboxDraftOcr {
  max-height: 320px;
  overflow-y: auto;
}

.inbox-draft-editor > .inbox-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -4px -4px;
  padding: 10px 4px 4px;
  background: #ffffff;
}

.inbox-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.inbox-tag-chips,
.inbox-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inbox-tag-chips button,
.inbox-card-tags span {
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.inbox-saved-list {
  display: grid;
  gap: 12px;
}

.inbox-saved-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e5eaf2;
  border-radius: 14px;
  background: #fbfdff;
}

.inbox-saved-card strong {
  color: #111827;
  font-size: 15px;
}

.inbox-saved-card p {
  margin: 8px 0;
  color: #526174;
  line-height: 1.6;
}

.inbox-cloud-dialog .browser-box {
  margin: 0 24px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #f8fafc;
  overflow: hidden;
}

.inbox-cloud-dialog .pathbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}

#inboxCloudPath {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #64748b;
  font-size: 13px;
}

#inboxCloudBrowser {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
  padding: 14px;
}

.inbox-cloud-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  cursor: pointer;
}

.inbox-cloud-row:hover,
.inbox-cloud-row.selected {
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.08);
}

.inbox-cloud-type {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
}

.inbox-cloud-type.excel { background: #ecfdf5; color: #059669; }
.inbox-cloud-type.image { background: #f5f3ff; color: #7c3aed; }
.inbox-cloud-type.markdown,
.inbox-cloud-type.text,
.inbox-cloud-type.file { background: #f1f5f9; color: #475569; }
.inbox-cloud-type.folder { background: #fff7ed; color: #ea580c; }

.inbox-cloud-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.inbox-cloud-copy strong,
.inbox-cloud-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-cloud-copy strong {
  color: #1e293b;
  font-size: 14px;
}

.inbox-cloud-copy small {
  color: #94a3b8;
  font-size: 12px;
}

.inbox-cloud-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: #2563eb;
}

#marketingReviewCloudDialog .dialog-close-btn {
  width: auto;
  height: 34px;
  padding: 0 14px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #ffffff;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
}

#marketingReviewCloudDialog .dialog-close-btn:hover {
  border-color: #111827;
  background: #f9fafb;
}

#marketingReviewCloudDialog .browser-box {
  margin-top: 16px;
  padding-top: 0;
  border-top: 0;
}

#marketingReviewCloudDialog .pathbar {
  gap: 12px;
}

#marketingReviewCloudDialog .webdav-browser {
  display: grid;
  gap: 10px;
  max-height: 420px;
  margin-top: 12px;
  padding: 0 4px 0 0;
  border: 0;
  overflow: auto;
}

#marketingReviewCloudDialog .inbox-cloud-row {
  border-color: #e5e7eb;
  box-shadow: none;
}

#marketingReviewCloudDialog .inbox-cloud-row:hover,
#marketingReviewCloudDialog .inbox-cloud-row.selected {
  border-color: #111827;
  background: #fbfbfb;
  box-shadow: none;
}

#marketingReviewCloudDialog .inbox-cloud-row.file {
  position: relative;
  grid-template-columns: 52px minmax(0, 1fr);
  padding-right: 52px;
  border-color: #d6dbe1;
  background: #ffffff;
}

#marketingReviewCloudDialog .inbox-cloud-row.file:hover {
  border-color: #9ca3af;
  background: #ffffff;
}

#marketingReviewCloudDialog .inbox-cloud-row.file.selected {
  border-color: #1a1a1a;
  background: #ffffff;
  box-shadow: inset 3px 0 #1a1a1a, 0 8px 20px rgba(0, 0, 0, 0.04);
}

#marketingReviewCloudDialog .inbox-cloud-row input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid #9ca3af;
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
  outline: 0;
  box-shadow: none;
}

#marketingReviewCloudDialog .inbox-cloud-row input[type="checkbox"]::after {
  content: "";
  width: 5px;
  height: 9px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  opacity: 0;
  transform: translateY(-1px) rotate(45deg);
}

#marketingReviewCloudDialog .inbox-cloud-row input[type="checkbox"]:checked {
  border-color: #111827;
  background: #111827;
}

#marketingReviewCloudDialog .inbox-cloud-row input[type="checkbox"]:checked::after {
  opacity: 1;
}

#marketingReviewCloudDialog .inbox-cloud-row input[type="checkbox"]:focus,
#marketingReviewCloudDialog .inbox-cloud-row input[type="checkbox"]:focus-visible {
  outline: 0;
  box-shadow: none;
}

#marketingReviewCloudDialog .asset-dialog-footer {
  justify-content: flex-end;
}

#marketingReviewCloudDialog #marketingReviewCloudCount {
  margin-right: auto;
}

/* Review center cloud picker */
#marketingReviewCloudDialog.marketing-review-cloud-dialog {
  width: min(960px, calc(100vw - 48px));
  max-height: min(760px, calc(100vh - 48px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 20px;
  background: #ffffff;
  color: #1a1a1c;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.18);
}

#marketingReviewCloudDialog::backdrop {
  background: rgba(20, 24, 31, 0.3);
  backdrop-filter: blur(8px);
}

#marketingReviewCloudDialog .dialog-head {
  align-items: flex-start;
  padding: 26px 28px 22px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

#marketingReviewCloudDialog .dialog-head h3 {
  margin: 0;
  color: #1a1a1c;
  font-size: 22px;
  line-height: 1.25;
}

#marketingReviewCloudDialog .dialog-head p {
  margin: 7px 0 0;
  color: #8a8f98;
  font-size: 13px;
}

#marketingReviewCloudDialog .dialog-close-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.035);
  color: #62666d;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

#marketingReviewCloudDialog .dialog-close-btn:hover {
  border: 0;
  background: rgba(0, 0, 0, 0.07);
  color: #1a1a1c;
}

#marketingReviewCloudDialog .browser-box {
  min-height: 0;
  margin: 0;
  padding: 18px 28px 20px;
  background: #ffffff;
}

#marketingReviewCloudDialog .pathbar {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
}

#marketingReviewCloudDialog #marketingReviewCloudUpBtn {
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.035);
  color: #35383d;
  font-size: 13px;
  font-weight: 700;
}

#marketingReviewCloudDialog #marketingReviewCloudUpBtn:hover {
  background: rgba(0, 0, 0, 0.065);
}

#marketingReviewCloudDialog .marketing-review-cloud-location {
  min-width: 0;
  display: grid;
  gap: 2px;
  min-height: 48px;
  align-content: center;
  padding: 7px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.025);
}

#marketingReviewCloudDialog .marketing-review-cloud-location small {
  color: #a0a4ab;
  font-size: 10px;
  font-weight: 700;
}

#marketingReviewCloudDialog .marketing-review-cloud-location span {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #555a63;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#marketingReviewCloudDialog .webdav-browser {
  gap: 4px;
  max-height: min(440px, calc(100vh - 300px));
  margin-top: 14px;
  padding-right: 6px;
}

#marketingReviewCloudDialog .inbox-cloud-row,
#marketingReviewCloudDialog .inbox-cloud-row.file {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 62px;
  padding: 9px 10px;
  padding-right: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

#marketingReviewCloudDialog .inbox-cloud-row:hover,
#marketingReviewCloudDialog .inbox-cloud-row.file:hover {
  border: 0;
  background: rgba(0, 0, 0, 0.025);
  transform: translateY(-1px);
}

#marketingReviewCloudDialog .inbox-cloud-row.file.selected {
  border: 0;
  background: rgba(0, 122, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.11);
}

#marketingReviewCloudDialog .inbox-cloud-type {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: #f2f3f5;
  color: #696e77;
  font-size: 9px;
  font-weight: 800;
}

#marketingReviewCloudDialog .inbox-cloud-type.folder {
  background: #fff7e7;
  color: #b87500;
}

#marketingReviewCloudDialog .inbox-cloud-type.type-xlsx {
  background: #edf8f1;
  color: #218653;
}

#marketingReviewCloudDialog .inbox-cloud-type.type-pdf {
  background: #fff0f0;
  color: #c64d4d;
}

#marketingReviewCloudDialog .inbox-cloud-copy {
  gap: 3px;
}

#marketingReviewCloudDialog .inbox-cloud-copy strong {
  color: #24262a;
  font-size: 14px;
  font-weight: 700;
}

#marketingReviewCloudDialog .inbox-cloud-copy small {
  color: #a0a4ab;
  font-size: 11px;
}

#marketingReviewCloudDialog [data-open-marketing-review-dir] {
  min-height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.04);
  color: #555a63;
  font-size: 12px;
  font-weight: 700;
}

#marketingReviewCloudDialog [data-open-marketing-review-dir]:hover {
  background: #1a1a1c;
  color: #ffffff;
}

#marketingReviewCloudDialog .inbox-cloud-row input[type="checkbox"] {
  position: static;
  width: 18px;
  height: 18px;
  border-color: #c3c7ce;
  border-radius: 6px;
}

#marketingReviewCloudDialog .asset-dialog-footer {
  padding: 16px 28px 20px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  background: #ffffff;
}

#marketingReviewCloudDialog #marketingReviewCloudCount {
  color: #777c85;
  font-size: 13px;
  font-weight: 600;
}

#marketingReviewCloudDialog .marketing-review-cloud-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

#marketingReviewCloudDialog .marketing-review-cloud-actions button {
  min-height: 40px;
  padding: 0 17px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
}

#marketingReviewCloudDialog #marketingReviewCloudSelectAllBtn {
  border: 0;
  background: rgba(0, 0, 0, 0.04);
  color: #44484f;
}

#marketingReviewCloudDialog #marketingReviewCloudConfirmBtn {
  border: 0;
  background: #1a1a1c;
  color: #ffffff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

#marketingReviewCloudDialog #marketingReviewCloudConfirmBtn:hover {
  background: #000000;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

#marketingReviewCloudDialog #marketingReviewCloudConfirmBtn:active {
  transform: translateY(0.5px);
}

@media (max-width: 680px) {
  #marketingReviewCloudDialog.marketing-review-cloud-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    border-radius: 16px;
  }

  #marketingReviewCloudDialog .dialog-head,
  #marketingReviewCloudDialog .browser-box,
  #marketingReviewCloudDialog .asset-dialog-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  #marketingReviewCloudDialog .asset-dialog-footer {
    align-items: stretch;
    flex-direction: column;
  }

  #marketingReviewCloudDialog .marketing-review-cloud-actions {
    width: 100%;
  }

  #marketingReviewCloudDialog .marketing-review-cloud-actions button {
    flex: 1;
  }
}

.inbox-input-field {
  position: relative;
  flex: 1;
  display: grid;
  gap: 10px;
}

.inbox-input-field > span {
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

#inboxContent {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border: 1px solid #dbe6f5;
  border-radius: 18px;
  padding: 20px;
  background: #f8fafc;
  color: #1f2937;
  font-size: 16px;
  line-height: 1.8;
}

.inbox-input-field.has-images #inboxContent {
  padding-bottom: 118px;
}

#inboxContent:focus {
  outline: 0;
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.inbox-inline-images {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-height: 86px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid #dbe6f5;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
}

.inbox-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.inbox-actions button {
  min-height: 42px;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 800;
}

#inboxState {
  margin-left: 4px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.inbox-saved-path {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: #eff6ff;
}

.inbox-saved-path strong {
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 900;
}

.inbox-saved-path code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #334155;
  font-size: 13px;
}

.inbox-result {
  display: grid;
  gap: 12px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #eff6ff;
  padding: 16px;
}

.inbox-result strong {
  color: #1d4ed8;
  font-size: 15px;
  font-weight: 900;
}

.inbox-result code {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #334155;
  font-size: 13px;
}

#inboxView .inbox-ai-float {
  display: none !important;
}

#inboxView.hidden .inbox-ai-float {
  display: none;
}

#inboxView .inbox-ai-float.has-custom-icon {
  background-color: transparent;
  background-position: center;
  background-size: 100% 100%;
}

.inbox-ask-dialog {
  width: min(680px, calc(100vw - 48px));
  max-height: min(760px, calc(100vh - 80px));
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
  animation: noteSummaryIn 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.inbox-ask-dialog::backdrop {
  background: rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(2px);
}

.inbox-ask-dialog .dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid #edf2f7;
}

.inbox-ask-dialog .dialog-head h3 {
  margin: 0 0 6px;
  color: #111827;
  font-size: 22px;
  font-weight: 900;
}

.inbox-ask-dialog .dialog-head p {
  margin: 0;
  color: #64748b;
  font-size: 13px;
}

.inbox-ask-dialog .field {
  display: grid;
  gap: 8px;
  padding: 20px 24px 0;
}

.inbox-ask-dialog .field span {
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

#inboxAskQuestion {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid #dbe6f5;
  border-radius: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 15px;
  line-height: 1.7;
}

#inboxAskQuestion:focus {
  outline: 0;
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.inbox-ask-answer {
  min-height: 140px;
  max-height: 300px;
  overflow: auto;
  margin: 16px 24px 0;
  border: 1px dashed #d7e4f7;
  border-radius: 14px;
  padding: 16px;
  background: #f8fbff;
  color: #334155;
  font-size: 15px;
  line-height: 1.75;
}

.inbox-ask-answer .copy-success {
  margin: 0 0 10px;
  color: #2563eb;
  font-weight: 800;
}

.inbox-ask-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 24px 22px;
  border-top: 1px solid #edf2f7;
  background: #f8fafc;
  margin-top: 20px;
}

.inbox-ask-footer button {
  min-height: 40px;
  border-radius: 10px;
  padding: 10px 20px;
  font-weight: 800;
}

/* Note toolbar weight and undo icon polish */
#todosView .note-toolbar button[data-note-format="bold"] strong,
#todosView .note-toolbar button[data-note-format="underline"] u,
#todosView .note-toolbar button[data-note-format="strike"] s {
  color: #5f6b7a;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

#todosView .note-toolbar button[data-note-format="bold"] strong {
  color: #111827;
  font-weight: 950;
}

#todosView .note-toolbar select {
  color: #5f6b7a;
  font-weight: 900;
}

#todosView .note-toolbar button[data-note-format="undo"].note-icon-button {
  width: 38px;
  min-width: 38px;
  color: #6b7280;
}

#todosView .note-icon-undo {
  width: 25px;
  height: 25px;
}

#todosView .note-icon-undo::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 5px;
  width: 14px;
  height: 14px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(-45deg);
}

#todosView .note-icon-undo::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 4px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 8px solid currentColor;
  transform: rotate(-10deg);
}

/* Note folders */
#todosView .notes-sidebar .panel-head h3::after {
  content: none !important;
}

#todosView .notes-head-actions {
  flex-wrap: wrap;
}

#todosView #newNoteFolderBtn {
  min-height: 30px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
}

#todosView .notes-search {
  display: none !important;
}

#todosView .note-folder-group {
  margin: 0 8px 4px;
}

#todosView .note-folder-row {
  height: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 6px;
  border-radius: 12px;
  padding-left: var(--folder-indent, 0px);
  transition: background-color 0.12s ease;
}

#todosView .note-folder-row:hover {
  background: #f6f8fb;
}

#todosView .note-folder-toggle {
  height: 36px;
  min-width: 0;
  display: grid;
  grid-template-columns: 14px 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #4e5969;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

#todosView .note-folder-arrow {
  color: #9aa7b8;
  font-size: 11px;
  line-height: 1;
  text-align: center;
  transition: transform 0.16s ease;
}

#todosView .note-folder-arrow.empty {
  opacity: 0;
}

#todosView .note-folder-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: #eef4ff;
  overflow: hidden;
}

#todosView .note-folder-icon i {
  width: 15px;
  height: 15px;
  display: block;
  background: url("/images/note-folder.png") center / contain no-repeat;
}

#todosView .note-folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#todosView .note-folder-more {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-weight: 800;
  opacity: 0;
  cursor: pointer;
}

#todosView .note-folder-row:hover .note-folder-more,
#todosView .note-folder-group.selected .note-folder-more {
  opacity: 1;
}

#todosView .note-folder-content {
  overflow: hidden;
}

#todosView .note-folder-content.hidden {
  display: none;
}

#todosView .note-folder-children {
  margin-top: 1px;
}

#todosView .note-folder-notes {
  padding: 2px 0 4px calc(var(--folder-indent, 0px) + 52px);
}

#todosView .note-folder-empty {
  display: none;
  padding: 0;
  color: #a0aec0;
  font-size: 12px;
}

#todosView .note-folder-notes .note-item {
  min-height: 56px;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 8px;
  margin: 0 0 4px;
  padding: 8px 10px;
  border-radius: 12px;
  background: transparent;
}

#todosView .note-folder-notes .note-item::after {
  display: none !important;
}

#todosView .note-folder-notes .note-item:hover {
  background: #f6f8fb;
}

#todosView .note-folder-notes .note-item.active {
  background: #eef4ff;
}

#todosView .note-folder-notes .note-open strong {
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
}

#todosView .note-folder-notes .note-open small {
  display: block;
  color: #8b98aa;
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#todosView .note-folder-notes .note-item .row-actions {
  right: 8px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  opacity: 0;
}

#todosView .note-folder-notes .note-item:hover .row-actions,
#todosView .note-folder-notes .note-item.active .row-actions {
  opacity: 1;
}

#todosView .note-folder-notes .note-item .row-actions button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
}

#todosView .note-folder-group,
#todosView .note-folder-content,
#todosView .note-folder-children,
#todosView .note-folder-notes,
#todosView .note-folder-notes .note-item {
  animation: none !important;
  transform: none !important;
  transition-property: background-color, color, opacity !important;
}

.note-action-menu {
  position: fixed;
  z-index: 1200;
  width: 160px;
  padding: 6px;
  border: 1px solid #EAECEF;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(15,23,42,.12);
}

.note-action-menu button {
  width: 100%;
  height: 40px;
  min-height: 40px;
  display: block;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  padding: 0 10px;
  cursor: pointer;
}

.note-action-menu button:hover {
  background: #f6f8fb;
}

.note-action-menu button.danger {
  color: #ef4444;
}

.note-menu-title {
  padding: 8px 10px 6px;
  color: #1f2937;
  font-size: 13px;
  font-weight: 800;
}

.note-move-menu {
  width: 220px;
}

.note-move-list {
  max-height: min(320px, 52vh);
  overflow: auto;
  padding: 2px 0;
}

.note-move-menu [data-move-note-folder] {
  padding-left: calc(10px + var(--move-indent, 0px));
}

.note-move-menu [data-move-note-folder].active {
  color: #2563eb;
  background: #eef4ff;
}

.note-menu-cancel {
  margin-top: 4px;
  border-top: 1px solid #eef2f7 !important;
  color: #64748b !important;
}

.app-toast {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 1800;
  padding: 11px 14px;
  border-radius: 12px;
  background: #111827;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.app-toast.error {
  background: #ef4444;
}

.nav-badge {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

@keyframes noteFolderFadeIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Note editor heading collapse and toolbar final polish */
#todosView .note-editor .note-editor-heading {
  position: relative;
  padding-left: 34px;
}

#todosView .note-editor .note-heading-collapse {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  position: absolute;
  left: 0;
  top: 0.12em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

#todosView .note-editor .note-heading-collapse:hover {
  background: #eef4ff;
  color: #2563eb;
}

#todosView .note-editor .note-editor-heading.heading-collapsed {
  margin-bottom: 14px;
}

#todosView .note-editor .note-heading-hidden {
  display: none !important;
}

#todosView .note-toolbar button,
#todosView .note-toolbar select,
#todosView .note-toolbar .note-color-trigger {
  color: #1f2937 !important;
  font-weight: 850 !important;
}

#todosView .note-toolbar button strong,
#todosView .note-toolbar button u,
#todosView .note-toolbar button s {
  color: #1f2937 !important;
  font-weight: 950 !important;
}

#todosView .note-toolbar select {
  color: #1f2937 !important;
  font-size: 17px !important;
  font-weight: 850 !important;
}

#todosView .note-toolbar .note-icon,
#todosView .note-toolbar .note-icon::before,
#todosView .note-toolbar .note-icon::after {
  color: #1f2937 !important;
}

#todosView .note-toolbar button[data-note-format="undo"].note-icon-button {
  color: #667085 !important;
}

#todosView .note-toolbar button[data-note-format="undo"]:hover {
  color: #1f2937 !important;
}

#todosView .note-toolbar .note-color-trigger::after {
  border-top-color: #98a2b3 !important;
}

/* Notes page natural scroll layout */
#todosView .note-editor-panel {
  height: 100vh !important;
  min-height: 100vh !important;
  display: block !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding: 0 !important;
  scroll-padding-top: 64px;
}

#todosView .note-editor-panel .panel-head {
  display: none !important;
}

#todosView .note-toolbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  width: 100% !important;
  max-width: none !important;
  height: 64px !important;
  min-height: 64px !important;
  justify-content: center !important;
  padding: 0 24px !important;
  border-bottom: 1px solid #e9eef5 !important;
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(10px);
}

#todosView .note-title-field,
#todosView .note-editor,
#todosView #noteSavedPath,
#todosView .note-statusbar {
  width: min(760px, calc(100% - 160px)) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

#todosView .note-title-field {
  margin-top: 42px !important;
}

#todosView .note-editor {
  min-height: 70vh !important;
  overflow: visible !important;
  padding: 28px 0 96px !important;
}

#todosView .note-editor figure,
#todosView .note-editor p {
  position: relative;
}

#todosView .note-editor img {
  max-width: 100%;
  height: auto;
}

#todosView .note-editor .note-image-resize-box {
  display: inline-block;
  position: relative;
  max-width: 100%;
  line-height: 0;
  vertical-align: top;
  user-select: none;
}

#todosView .note-editor .note-image-selected {
  outline: 2px solid #2563eb;
  outline-offset: 4px;
  border-radius: 6px;
}

#todosView .note-editor .note-image-selected img {
  display: block;
}

#todosView .note-editor .note-image-resize-handle {
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  cursor: nwse-resize;
  z-index: 5;
}

#todosView #noteSavedPath {
  min-height: 22px !important;
  margin-top: 24px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#todosView .note-statusbar {
  min-height: 44px !important;
  padding: 10px 0 36px !important;
  background: transparent !important;
}

#todosView .note-summary-float {
  position: fixed !important;
  right: 36px !important;
  bottom: 36px !important;
  z-index: 60 !important;
}

/* Feishu-like note outline */
#todosView .note-outline-panel {
  padding: 14px 12px 20px !important;
}

#todosView .note-outline-search {
  display: none !important;
  height: 36px;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  color: #9aa7b8;
}

#todosView .note-outline-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #334155;
  font-size: 13px;
}

#todosView .note-outline-tree {
  display: grid;
  gap: 2px;
}

#todosView .note-outline-node {
  display: grid;
  gap: 2px;
}

#todosView .note-outline-node.level-1 {
  padding-left: 0;
}

#todosView .note-outline-node.level-2 {
  padding-left: 26px;
}

#todosView .note-outline-node.level-3 {
  padding-left: 52px;
}

#todosView .note-outline-row {
  min-height: 34px;
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  border-radius: 10px;
  padding: 0 6px;
  transition: background-color 140ms ease, color 140ms ease;
}

#todosView .note-outline-row:hover {
  background: #f5f8ff;
}

#todosView .note-outline-collapse {
  width: 20px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  transition: transform 160ms ease, background-color 140ms ease;
}

#todosView .note-outline-collapse:hover {
  background: #eaf1ff;
  color: #2563eb;
}

#todosView .note-outline-collapse:disabled {
  cursor: default;
  opacity: 0;
}

#todosView .note-outline-link {
  min-width: 0;
  height: 32px;
  display: flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: #4e5969;
  text-align: left;
  cursor: pointer;
}

#todosView .note-outline-link strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}

#todosView .note-outline-node.level-1 > .note-outline-row .note-outline-link strong {
  color: #1f2937;
  font-size: 14px;
  font-weight: 850;
}

#todosView .note-outline-node.level-2 > .note-outline-row .note-outline-link strong {
  color: #4e5969;
  font-size: 13px;
  font-weight: 700;
}

#todosView .note-outline-node.level-3 > .note-outline-row .note-outline-link strong {
  color: #8b98aa;
  font-size: 12px;
  font-weight: 600;
}

#todosView .note-outline-node.level-2 > .note-outline-row::before,
#todosView .note-outline-node.level-3 > .note-outline-row::before {
  content: "";
  width: 5px;
  height: 5px;
  position: absolute;
  left: 10px;
  border-radius: 50%;
  background: #cbd5e1;
}

#todosView .note-outline-node.level-3 > .note-outline-row::before {
  width: 4px;
  height: 4px;
  background: #d7dee8;
}

#todosView .note-outline-link mark {
  border-radius: 4px;
  background: #dbeafe;
  color: #1d4ed8;
  padding: 0 2px;
}

#todosView .note-outline-children {
  display: grid;
  gap: 2px;
  overflow: hidden;
  animation: noteOutlineChildrenIn 180ms ease both;
}

#todosView .note-outline-node.collapsed > .note-outline-children {
  display: none;
}

#todosView .note-outline-node.collapsed > .note-outline-row .note-outline-collapse {
  transform: rotate(0deg);
}

#todosView .note-outline-node.expanded > .note-outline-row .note-outline-collapse {
  transform: rotate(0deg);
}

#todosView .note-outline-node.matched > .note-outline-row {
  background: #f5f8ff;
}

#todosView .note-outline-empty {
  margin-top: 10px;
  padding: 14px;
  border: 1px dashed #dbe6f5;
  border-radius: 12px;
  color: #94a3b8;
  font-size: 13px;
}

@keyframes noteOutlineChildrenIn {
  from {
    max-height: 0;
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    max-height: 640px;
    opacity: 1;
    transform: translateY(0);
  }
}

[data-workspace-nav-section="personal"] .kb-group-arrow,
[data-workspace-nav-section="personal"] .workspace-tree-arrow {
  width: 0 !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  color: transparent !important;
  background: transparent !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

#marketingView .marketing-page {
  min-height: calc(100vh - 108px);
  position: relative;
}

#marketingView .marketing-file-section {
  margin-top: 32px;
}

#marketingView .marketing-data-upload {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
  margin: 26px 0 24px;
}

#marketingView .marketing-upload {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-areas:
    "icon copy"
    "icon meta";
  align-items: center;
  column-gap: 16px;
  row-gap: 6px;
  min-height: 138px;
  padding: 24px 26px;
  border: 1px dashed #b9c9e8;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(20, 184, 166, 0.05)),
    #ffffff;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

#marketingView .marketing-upload::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -34px;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.08);
  pointer-events: none;
}

#marketingView .marketing-upload:hover {
  border-color: #2563eb;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(20, 184, 166, 0.08)),
    #ffffff;
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

#marketingView .marketing-upload input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

#marketingView .marketing-upload-icon {
  grid-area: icon;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #2563eb;
  color: #ffffff;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.22);
}

#marketingView .marketing-upload-copy {
  grid-area: copy;
  display: grid;
  gap: 5px;
  min-width: 0;
}

#marketingView .marketing-upload strong {
  color: #1f2937;
  font-size: 16px;
  line-height: 1.2;
}

#marketingView .marketing-upload-copy span,
#marketingView .marketing-upload-meta {
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

#marketingView .marketing-upload-meta {
  grid-area: meta;
  width: max-content;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #526174;
}

#marketingView .marketing-file-card .file-type-mark {
  font-size: 13px;
}

#marketingView .marketing-file-card {
  min-height: 216px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  align-items: start;
  gap: 12px;
  padding: 18px 16px 14px;
  cursor: default;
}

#marketingView .marketing-file-card .file-thumb {
  margin: 0;
}

#marketingView .marketing-file-card .file-card-body {
  min-height: 86px;
  align-items: center;
}

#marketingView .marketing-file-card .file-card-body strong {
  height: auto;
  min-height: 38px;
  margin: 0 0 12px;
}

#marketingView .marketing-file-card .file-card-body small {
  margin-top: 0;
  text-align: center;
}

#marketingView .marketing-file-card .file-card-actions {
  position: static;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 6px;
  opacity: 1;
}

#marketingView .marketing-file-card .file-card-actions .ghost-icon {
  width: auto;
  min-width: 48px;
  height: 30px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbe5f5;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

#marketingView .marketing-file-card .file-card-actions .ghost-icon:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
}

#marketingAnalysisLauncher.kb-chat-launcher {
  right: 32px;
  bottom: 32px;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border-radius: 50%;
}

#marketingAnalysisLauncher.kb-chat-launcher.has-custom-icon {
  padding: 0;
  border: 0;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow: 0 14px 32px -8px rgba(37, 99, 235, 0.38);
}

#marketingAnalysisLauncher.kb-chat-launcher.has-custom-icon:hover {
  transform: translateY(-2px);
}

#marketingAnalysisDock.kb-chat-dock {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: 24px;
  left: auto;
  z-index: 45;
  width: min(65vw, calc(100vw - 320px));
  max-width: none;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  pointer-events: none;
}

#marketingAnalysisDock.hidden {
  display: none !important;
}

#marketingAnalysisDock:has(.marketing-chat-panel:not(.hidden)) {
  width: calc(65vw - 24px);
  max-height: none;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.05), 0 10px 10px -5px rgba(15, 23, 42, 0.02);
  opacity: 1;
  transform: translateX(0) scale(1);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

#marketingAnalysisDock .marketing-chat-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#marketingAnalysisDock .marketing-chat-panel.hidden {
  display: none !important;
}

#marketingAnalysisDock .kb-chat-head {
  min-height: 73px;
  width: 100%;
  padding: 20px 24px;
  border: 0;
  outline: 0;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  cursor: default;
  appearance: none;
  text-align: left;
}

#marketingAnalysisDock .kb-chat-head:focus,
#marketingAnalysisDock .kb-chat-head:focus-visible {
  outline: 0;
  box-shadow: none;
}

#marketingAnalysisDock .kb-chat-head h3 {
  color: #1e293b;
  font-size: 16px;
  font-weight: 700;
}

#marketingAnalysisDock .kb-chat-head p {
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
}

#marketingAnalysisDock .chat-history-chevron {
  color: #94a3b8;
  font-size: 0;
}

#marketingAnalysisDock .chat-history-chevron::before {
  content: "脳";
  font-size: 20px;
  line-height: 1;
}

#marketingAnalysisDock .marketing-chat-history {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  background: #fafbfe;
}

#marketingAnalysisDock #marketingReportContent {
  min-height: 0;
  height: 100%;
  max-height: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: #fafbfe;
  padding: 24px;
}

#marketingAnalysisDock #marketingReportContent > .empty-note,
#marketingAnalysisDock #marketingReportContent > :not(.empty-note) {
  width: fit-content;
  max-width: 75%;
  align-self: flex-start;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  border-bottom-left-radius: 2px;
  background: #ffffff;
  color: #1e293b;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
}

#marketingAnalysisDock .marketing-report-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top-color: #f1f5f9;
}

#marketingAnalysisDock:has(.marketing-chat-panel:not(.hidden)) .kb-input-section {
  margin-top: 22px;
  padding-top: 0 !important;
  border-top: 1px solid #dbe5f2 !important;
  background: #ffffff;
}

#marketingAnalysisDock .kb-input-section,
#marketingAnalysisDock .kb-composer {
  pointer-events: auto;
}

#marketingAnalysisDock .kb-composer {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px 24px 20px;
  border: 0;
  background: #ffffff;
  box-shadow: none;
}

#marketingAnalysisDock .kb-composer textarea,
#marketingAnalysisDock .kb-composer textarea:focus {
  min-height: 46px;
  max-height: 120px;
  padding: 12px 46px 12px 16px;
  border: 2px solid #2563eb !important;
  border-radius: 10px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 13.5px;
  resize: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08) !important;
}

#marketingAnalysisDock .kb-composer-bar {
  min-height: 28px;
  align-items: center;
}

#marketingAnalysisDock .kb-composer-bar::before {
  content: "褰撳墠妯″瀷:";
  color: #64748b;
  font-size: 12px;
}

#marketingAnalysisDock .kb-composer .chat-controls {
  width: auto;
  margin: 0;
}

#marketingAnalysisDock .kb-composer .field {
  display: block;
}

#marketingAnalysisDock .kb-composer select {
  width: auto;
  max-width: 260px;
  min-height: 28px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #1e293b;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
}

#marketingAnalysisDock .composer-actions {
  position: absolute;
  right: 32px;
  top: 28px;
  bottom: auto;
}

#marketingAnalysisDock .composer-icon.send,
#marketingAnalysisDock .composer-icon.send.has-custom-send-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
}

#marketingAnalysisDock .composer-icon.send.has-custom-send-icon {
  overflow: hidden;
  border: 0;
  color: transparent;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  box-shadow: 0 10px 22px -8px rgba(37, 99, 235, 0.45);
}

#marketingAnalysisDock.kb-chat-dock {
  transform-origin: right bottom;
}

#marketingAnalysisDock.kb-chat-dock.opening {
  animation: chatDockIn 240ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

#marketingAnalysisDock.kb-chat-dock.closing {
  display: flex !important;
  animation: chatDockOut 220ms cubic-bezier(0.7, 0, 0.84, 0) both;
}

#marketingAnalysisLauncher.kb-chat-launcher {
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), opacity 180ms ease, box-shadow 180ms ease;
}

#marketingAnalysisLauncher.kb-chat-launcher.has-custom-icon::before {
  content: none !important;
  display: none !important;
}

#marketingAnalysisLauncher.kb-chat-launcher:active {
  transform: scale(0.94);
}

#marketingAnalysisLauncher.kb-chat-launcher.launcher-hiding {
  opacity: 0;
  transform: translate(8px, 8px) scale(0.78) rotate(-18deg);
}

#marketingAnalysisLauncher.kb-chat-launcher.launcher-showing {
  animation: chatLauncherIn 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

#marketingAnalysisLauncher.kb-chat-launcher.marketing-analysis-running {
  box-shadow: 0 18px 42px rgba(20, 184, 166, 0.3), 0 0 0 8px rgba(20, 184, 166, 0.12);
}

#marketingAnalysisLauncher.kb-chat-launcher.marketing-analysis-running::before {
  content: "" !important;
  display: block !important;
  position: absolute;
  right: -2px;
  top: -2px;
  width: 14px;
  height: 14px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #14b8a6;
  box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.44);
  animation: marketingRunningPulse 1.2s ease-out infinite;
}

#marketingAnalysisForm button[type="submit"]:disabled {
  cursor: wait;
  opacity: 0.68;
}

/* Marketing analysis three-section workspace */
.marketing-subnav {
  display: grid;
  gap: 2px;
  margin: -2px 0 8px;
  padding: 0 12px 0 56px;
}

.marketing-subnav.hidden {
  display: none;
}

.marketing-subnav button {
  min-height: 30px;
  border: 0;
  border-left: 2px solid #e5e7eb;
  background: transparent;
  color: #7b8491;
  padding: 4px 10px;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}

.marketing-subnav button:hover,
.marketing-subnav button.active {
  border-left-color: #2563eb;
  color: #2563eb;
  font-weight: 700;
}

#marketingView {
  overflow: auto;
  scroll-behavior: smooth;
  background: #f6f8fb;
}

#marketingView .marketing-page {
  width: min(1320px, calc(100% - 64px));
  margin: 0 auto;
  padding: 34px 0 80px;
}

#marketingView .marketing-header {
  min-height: 72px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  background: transparent;
}

#marketingView .marketing-header h2 {
  color: #111827;
  font-size: 28px;
}

#marketingView .marketing-header p {
  margin-top: 6px;
  color: #7b8491;
  font-size: 13px;
}

#marketingView .marketing-screen {
  display: none;
  min-height: calc(100vh - 120px);
  padding: 34px 36px;
  border: 1px solid #e5eaf1;
  background: #ffffff;
}

#marketingView .marketing-screen.active {
  display: block;
}

#marketingView .marketing-screen-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

#marketingView .marketing-screen-head h3 {
  margin-top: 5px;
  color: #111827;
  font-size: 21px;
}

#marketingView .marketing-screen-head p {
  margin-top: 6px;
  color: #7b8491;
  font-size: 13px;
}

#marketingView .marketing-section-kicker {
  color: #2563eb;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  text-transform: uppercase;
}

#marketingView .marketing-metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid #e5eaf1;
}

#marketingView .marketing-metric {
  min-height: 142px;
  display: grid;
  align-content: center;
  gap: 9px;
  padding: 20px;
  border-right: 1px solid #e5eaf1;
  background: #ffffff;
}

#marketingView .marketing-metric:last-child {
  border-right: 0;
}

#marketingView .marketing-metric.primary {
  background: #f7faff;
}

#marketingView .marketing-metric span {
  color: #7b8491;
  font-size: 12px;
}

#marketingView .marketing-metric strong {
  color: #111827;
  font-size: 27px;
  line-height: 1.1;
}

#marketingView .marketing-metric small {
  color: #8b95a3;
  font-size: 11px;
}

#marketingView .marketing-metric small.favorable {
  color: #07835c;
}

#marketingView .marketing-metric small.unfavorable {
  color: #dc2626;
}

#marketingView .marketing-ai-summary {
  margin-top: 28px;
  border: 1px solid #e5eaf1;
}

#marketingView .marketing-ai-summary-head {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 22px;
  border-bottom: 1px solid #e5eaf1;
  background: #f9fafb;
}

#marketingView .marketing-ai-summary-head h3 {
  margin-top: 4px;
  color: #111827;
  font-size: 15px;
}

#marketingView #marketingTodayState,
#marketingView #marketingAnalysisState {
  color: #64748b;
  font-size: 12px;
}

#marketingView .marketing-today-conclusion {
  min-height: 250px;
  max-height: 420px;
  overflow: auto;
  padding: 24px;
}

#marketingView .marketing-upload-screen {
  min-height: auto;
}

#marketingView .marketing-data-upload {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

#marketingView .marketing-upload {
  min-height: 96px;
  padding: 16px 18px;
  border-radius: 6px;
  background: #fbfcfe;
}

#marketingView .marketing-upload::after {
  display: none;
}

#marketingView .marketing-upload-icon {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  box-shadow: none;
}

#marketingView .marketing-inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px auto;
  align-items: end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5eaf1;
}

#marketingView .marketing-inline-form .field {
  margin: 0;
}

#marketingView .marketing-inline-form .field span {
  color: #64748b;
  font-size: 11px;
}

#marketingView .marketing-inline-form textarea {
  min-height: 64px;
  max-height: 96px;
  resize: vertical;
}

#marketingView .marketing-model-field select,
#marketingView .marketing-run-button {
  min-height: 42px;
}

#marketingView .marketing-upload-status {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 12px;
  color: #7b8491;
  font-size: 11px;
}

#marketingView .marketing-review-layout {
  min-height: 620px;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  border: 1px solid #e5eaf1;
}

#marketingView .marketing-review-list {
  min-height: 280px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
  gap: 12px;
  padding: 18px 0;
}

#marketingView .marketing-file-card {
  position: relative;
  min-height: 150px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  grid-template-rows: minmax(48px, auto) auto;
  justify-items: stretch;
  gap: 10px 12px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

#marketingView .marketing-file-card .file-thumb {
  width: 48px;
  height: 54px;
}

#marketingView .marketing-file-card .file-card-body {
  min-height: 0;
  align-items: flex-start;
}

#marketingView .marketing-file-card .file-card-body strong {
  min-height: 0;
  margin: 0;
  text-align: left;
}

#marketingView .marketing-file-card .file-card-body small {
  text-align: left;
}

#marketingView .marketing-file-card .file-card-actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.marketing-review-check {
  position: absolute;
  top: 10px;
  right: 10px;
}

.marketing-review-check input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

.marketing-review-composer {
  position: sticky;
  bottom: 16px;
  z-index: 3;
  width: min(920px, calc(100% - 32px));
  margin: 20px auto 0;
  padding: 14px 16px 12px;
  border: 1px solid #d9e0e8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.12);
}

.marketing-review-composer textarea {
  width: 100%;
  min-height: 74px;
  border: 0;
  resize: vertical;
  padding: 4px;
  color: #172033;
  font-size: 15px;
  line-height: 1.6;
  box-shadow: none;
}

.marketing-review-composer textarea:focus {
  outline: 0;
  box-shadow: none;
}

.marketing-review-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #7b8796;
  font-size: 12px;
}

.marketing-review-composer-options {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.marketing-review-composer-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #64748b;
  font-size: 12px;
}

.marketing-review-composer-options select {
  width: 190px;
  min-height: 36px;
  border: 1px solid #dbe3ec;
  border-radius: 6px;
  background: #ffffff;
  padding: 0 10px;
  color: #253247;
  font-size: 12px;
}

#marketingReviewInlineImages {
  margin: 8px 0 12px;
}

.marketing-review-answer-dialog {
  width: min(980px, calc(100vw - 64px));
  height: min(760px, calc(100vh - 80px));
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  padding: 0;
  background: #ffffff;
  color: #172033;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.2);
}

.marketing-review-answer-dialog::backdrop,
.marketing-review-cloud-dialog::backdrop {
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
}

.marketing-review-answer-dialog .dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e8edf2;
}

.marketing-review-answer-dialog .dialog-head h3,
.marketing-review-answer-dialog .dialog-head p {
  margin: 0;
}

.marketing-review-answer-dialog .dialog-head p {
  margin-top: 5px;
  color: #7b8796;
  font-size: 12px;
}

.marketing-review-conversation {
  height: calc(100% - 138px);
  overflow: auto;
  padding: 26px 30px;
  display: grid;
  align-content: start;
  gap: 24px;
}

.marketing-review-conversation section {
  display: grid;
  gap: 10px;
}

.marketing-review-conversation section:first-child {
  padding: 14px 16px;
  border-left: 3px solid #2563eb;
  background: #f7f9fc;
}

.marketing-review-conversation p {
  margin: 0;
}

.marketing-review-answer-footer {
  min-height: 64px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 24px;
  border-top: 1px solid #e8edf2;
}

#marketingView .marketing-report-preview {
  min-width: 0;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  background: #ffffff;
}

#marketingView .marketing-report-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 20px;
  border-bottom: 1px solid #e5eaf1;
}

#marketingView .marketing-report-content {
  min-height: 0;
  max-height: 680px;
  overflow: auto;
  padding: 26px 32px;
}

#marketingAnalysisLauncher,
#marketingAnalysisDock {
  display: none !important;
}

@keyframes marketingRunningPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.44);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(20, 184, 166, 0);
  }
}

@media (max-width: 1100px) {
  #marketingAnalysisDock.kb-chat-dock:has(.marketing-chat-panel:not(.hidden)) {
    width: calc(100vw - 300px);
  }
}

/* Mobile adaptation */
@media (max-width: 768px) {
  html,
  body {
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  .app-shell,
  .app-shell:has(#todosView:not(.hidden)),
  .app-shell:has(#settingsView:not(.hidden)) {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    padding: 10px !important;
    overflow: visible !important;
    background: var(--recall-canvas, #efefef) !important;
  }

  #marketingView .marketing-data-upload {
    grid-template-columns: 1fr;
  }

  #marketingAnalysisDock.kb-chat-dock {
    inset: 16px;
    width: auto;
  }

  .sidebar,
  .app-shell:has(#todosView:not(.hidden)) .sidebar,
  .app-shell:has(#settingsView:not(.hidden)) .sidebar {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    max-height: 42vh !important;
    margin: 0 0 10px !important;
    padding: 14px !important;
    border-radius: 20px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .brand,
  .app-shell:has(#todosView:not(.hidden)) .brand {
    grid-template-columns: 42px minmax(0, 1fr) !important;
    column-gap: 12px !important;
    margin-bottom: 14px !important;
    padding: 14px !important;
    border-radius: 16px !important;
  }

  .avatar-wrapper,
  .brand-mark,
  .app-shell:has(#todosView:not(.hidden)) .brand-mark {
    width: 42px !important;
    height: 42px !important;
  }

  .sidebar-search,
  .app-shell:has(#todosView:not(.hidden)) .sidebar-search {
    height: 38px !important;
    margin-top: 14px !important;
  }

  .sidebar .nav,
  .sidebar-logout,
  [data-workspace-nav-section="personal"] .kb-group-toggle,
  [data-workspace-nav-section="projects"] .kb-group-toggle,
  .app-shell:has(#todosView:not(.hidden)) .sidebar .nav,
  .app-shell:has(#todosView:not(.hidden)) .sidebar-logout,
  .app-shell:has(#todosView:not(.hidden)) [data-workspace-nav-section="personal"] .kb-group-toggle {
    min-height: 46px !important;
    margin-bottom: 4px !important;
    padding: 8px 10px !important;
    border-radius: 14px !important;
  }

  .content,
  .app-shell:has(#todosView:not(.hidden)) .content,
  .app-shell:has(#settingsView:not(.hidden)) .content {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: calc(100vh - 20px) !important;
    border-radius: 20px !important;
    overflow: visible !important;
  }

  .view,
  .kb-workbench,
  .kb-empty,
  #workspacesView,
  #inboxView,
  #todosView,
  #settingsView {
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  .kb-detail {
    display: block !important;
    height: auto !important;
    min-height: calc(100vh - 20px) !important;
    padding: 20px 14px 92px !important;
  }

  .kb-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
    margin-bottom: 18px !important;
  }

  .kb-title-wrap h2,
  #workspaceHeaderName {
    font-size: 24px !important;
    word-break: break-word !important;
  }

  .kb-header-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .kb-header-actions button,
  #workspaceDetail .workspace-ai-organize-btn,
  #workspaceDetail #openWorkspaceAssetDialogBtn,
  #workspaceDeleteSelectedFilesBtn,
  #workspaceEditTagsBtn {
    width: 100% !important;
    min-width: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    white-space: nowrap !important;
  }

  .kb-workspace-grid,
  .kb-main-column,
  .kb-file-section {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .kb-file-section {
    padding: 16px !important;
    overflow: visible !important;
    border-radius: 18px !important;
  }

  .kb-section-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 14px !important;
    margin-bottom: 16px !important;
  }

  .kb-file-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    gap: 8px !important;
  }

  .workspace-file-search {
    width: 100% !important;
    min-width: 0 !important;
  }

  .workspace-files {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .workspace-file-card {
    min-height: 178px !important;
    padding: 12px !important;
    border-radius: 16px !important;
  }

  .workspace-file-card .file-thumb {
    width: 46px !important;
    height: 52px !important;
    margin-bottom: 10px !important;
  }

  .workspace-file-card .file-card-body strong {
    height: 36px !important;
    margin-bottom: 28px !important;
    font-size: 11px !important;
  }

  .workspace-file-card .file-card-tags {
    top: 102px !important;
    left: 8px !important;
    right: 8px !important;
  }

  .workspace-file-card .file-card-body small {
    font-size: 10px !important;
  }

  .empty-state,
  .kb-empty-state,
  .empty-copy-card {
    max-width: 100% !important;
  }

  #workspaceChatLauncher.kb-chat-launcher,
  #todosView .note-summary-float,
  #inboxView .inbox-ai-float {
    right: 18px !important;
    bottom: 18px !important;
    width: 58px !important;
    min-width: 58px !important;
    height: 58px !important;
    min-height: 58px !important;
    z-index: 90 !important;
  }

  #workspaceChatFloat.kb-chat-dock {
    right: 10px !important;
    bottom: 10px !important;
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
  }

  #workspaceChatFloat:has(.workspace-chat-panel:not(.hidden)) {
    inset: 10px !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
  }

  #workspaceChatFloat .workspace-chat-panel {
    width: 100% !important;
    max-height: calc(100vh - 20px) !important;
    border-radius: 18px !important;
  }

  #workspaceChatFloat .kb-input-section {
    padding: 12px !important;
  }

  #workspaceChatFloat .kb-composer textarea {
    min-height: 108px !important;
    padding: 14px 56px 14px 14px !important;
    font-size: 14px !important;
  }

  #inboxView {
    min-height: auto !important;
    padding: 0 !important;
  }

  .inbox-panel {
    max-width: none !important;
    min-height: calc(100vh - 20px) !important;
    padding: 20px 14px 86px !important;
    border-radius: 20px !important;
  }

  .inbox-copy h3 {
    font-size: 24px !important;
  }

  .inbox-copy p {
    font-size: 14px !important;
    line-height: 1.6 !important;
  }

  #inboxContent {
    min-height: 360px !important;
    padding: 16px !important;
    font-size: 15px !important;
  }

  .inbox-input-field.has-images #inboxContent {
    padding-bottom: 128px !important;
  }

  .inbox-inline-images {
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    max-height: 100px !important;
  }

  .inbox-actions {
    align-items: stretch !important;
  }

  .inbox-source-grid,
  .inbox-draft,
  .inbox-meta-grid,
  .inbox-saved-card {
    grid-template-columns: 1fr !important;
  }

  .inbox-source-card {
    min-height: 128px !important;
  }

  .inbox-actions button {
    flex: 1 1 100% !important;
  }

  #inboxState {
    width: 100% !important;
    margin-left: 0 !important;
  }

  .inbox-ask-dialog,
  .note-summary-dialog,
  dialog {
    width: min(96vw, 680px) !important;
    max-width: 96vw !important;
    max-height: calc(100vh - 32px) !important;
    border-radius: 18px !important;
  }

  .inbox-ask-dialog .dialog-head,
  .inbox-ask-dialog .field,
  .inbox-ask-footer,
  .note-summary-dialog .dialog-head,
  .note-summary-footer {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .inbox-ask-answer,
  .note-summary-content {
    margin-left: 16px !important;
    margin-right: 16px !important;
  }

  #todosView .notes-shell {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: calc(100vh - 20px) !important;
    overflow: visible !important;
  }

  #todosView .notes-sidebar {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: 42vh !important;
    min-height: 0 !important;
    overflow: auto !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 18px 14px !important;
  }

  #todosView .notes-sidebar .panel-head {
    display: flex !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
  }

  #todosView .notes-head-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  #todosView .notes-head-actions button {
    min-width: 0 !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .notes-search {
    margin: 12px 0 !important;
  }

  #todosView .note-editor-panel {
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    border-radius: 0 0 20px 20px !important;
    overflow: visible !important;
  }

  #todosView .note-toolbar {
    top: 0 !important;
    height: 58px !important;
    min-height: 58px !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 0 12px !important;
    scroll-snap-type: x proximity;
  }

  #todosView .note-toolbar::-webkit-scrollbar {
    display: none !important;
  }

  #todosView .note-toolbar button,
  #todosView .note-toolbar select,
  #todosView .note-toolbar .note-color-trigger {
    flex: 0 0 auto !important;
  }

  #todosView .note-title-field,
  #todosView .note-editor,
  #todosView #noteSavedPath,
  #todosView .note-statusbar {
    width: calc(100% - 32px) !important;
    max-width: none !important;
  }

  #todosView .note-title-field {
    margin-top: 28px !important;
  }

  #todosView .note-title-field input {
    font-size: 34px !important;
  }

  #todosView .note-editor {
    min-height: 72vh !important;
    padding: 18px 0 90px !important;
    font-size: 18px !important;
    line-height: 1.85 !important;
  }

  #todosView .note-statusbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    padding-bottom: 96px !important;
    font-size: 12px !important;
  }

  #todosView #noteSavedPath {
    white-space: normal !important;
    line-height: 1.5 !important;
  }

  #todosView .note-folder-row,
  #todosView .note-folder-notes .note-item {
    max-width: 100% !important;
  }

  #todosView .note-outline-panel {
    max-height: 36vh !important;
    overflow: auto !important;
  }

  #settingsView {
    padding: 18px 14px !important;
  }

  .settings-panel,
  .settings-card,
  .settings-grid {
    width: 100% !important;
    max-width: none !important;
  }
}

@media (max-width: 420px) {
  .workspace-files {
    grid-template-columns: 1fr !important;
  }

  .kb-header-actions {
    grid-template-columns: 1fr !important;
  }

  .kb-file-actions {
    grid-template-columns: 1fr auto !important;
  }

  #workspaceFileHint {
    grid-column: 1 / -1;
  }

  #todosView .note-title-field input {
    font-size: 28px !important;
  }

  #todosView .note-editor {
    font-size: 16px !important;
  }
}

/* Home unified AI/search entry */
.app-shell:has(#dashboardView:not(.hidden)) .topbar {
  display: none;
}

#dashboardView {
  min-height: calc(100vh - 48px);
  height: calc(100vh - 48px);
  overflow: hidden;
}

.home-ai-shell {
  position: relative;
  min-height: calc(100vh - 48px);
  height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  gap: 14px;
  padding: 34px 18px;
}

.home-ai-shell.home-chat-active {
  grid-template-rows: minmax(0, 1fr) auto auto;
  align-items: stretch;
  gap: 10px;
  padding: 54px 18px 24px;
}

.home-close-chat {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #d9e1d8;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #6d766f;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 4;
}

.home-close-chat:hover {
  border-color: #b7c8bf;
  color: #1f766b;
  background: #ffffff;
}

.home-hero {
  width: min(820px, 100%);
  display: grid;
  gap: 28px;
  justify-items: center;
  align-self: end;
  grid-row: 2;
}

.home-hero h1 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.08;
  color: #17221d;
  font-weight: 800;
  letter-spacing: 0;
  text-align: center;
}

.home-examples {
  width: min(720px, 100%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.home-examples button {
  min-height: 36px;
  border: 1px solid #dce3db;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #59645c;
  padding: 0 14px;
  cursor: pointer;
}

.home-examples button:hover {
  border-color: #b8c8c0;
  color: #1f766b;
  background: #ffffff;
}

.home-chat-form {
  width: min(820px, 100%);
  min-height: 72px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 44px;
  grid-template-rows: auto auto auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid #d9e1d8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(31, 43, 37, 0.11);
  justify-self: center;
  grid-row: 3;
  z-index: 2;
}

.home-ai-shell.home-chat-active .home-chat-form {
  grid-row: 2;
  align-self: end;
  box-shadow: 0 10px 32px rgba(31, 43, 37, 0.08);
}

.home-chat-form textarea {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  min-height: 52px;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 14px 8px 10px 12px;
  color: #17221d;
  background: transparent;
  line-height: 1.5;
  overflow-y: auto;
}

.home-chat-tools {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  color: #7a857d;
  font-size: 12px;
}

.home-chat-tools select {
  max-width: min(280px, 48vw);
  min-height: 30px;
  border: 1px solid #e0e7df;
  border-radius: 8px;
  background: #f8faf9;
  color: #35423a;
  padding: 0 9px;
}

.home-chat-tools span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-chat-form textarea::placeholder {
  color: #8a948d;
}

.home-send-btn {
  grid-column: 3;
  grid-row: 1;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: #1f766b;
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
}

.home-attach-btn {
  grid-column: 1;
  grid-row: 1;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  align-self: center;
  border: 1px solid #dce5df;
  border-radius: 8px;
  background: #f8faf9;
  color: #43534a;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.home-attach-btn:hover {
  border-color: #a9c0b5;
  background: #ffffff;
  color: #1f766b;
}

.home-attachments {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0 2px;
  border-top: 1px solid #edf1ee;
}

.home-attachment {
  position: relative;
  width: 150px;
  height: 52px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 6px 26px 6px 7px;
  border: 1px solid #e1e8e4;
  border-radius: 8px;
  background: #f8faf9;
}

.home-attachment img,
.home-attachment > span {
  width: 38px;
  height: 38px;
  border-radius: 6px;
}

.home-attachment img {
  object-fit: cover;
}

.home-attachment > span {
  display: grid;
  place-items: center;
  background: #e8f1ed;
  color: #1f766b;
  font-size: 10px;
  font-weight: 800;
}

.home-attachment strong {
  min-width: 0;
  overflow: hidden;
  color: #34443b;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-attachment button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  min-width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: #dce5df;
  color: #4f5f56;
  cursor: pointer;
}

.home-send-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.home-chat-state {
  min-height: 20px;
  color: #768179;
  font-size: 13px;
  text-align: center;
  grid-row: 4;
}

.home-ai-shell.home-chat-active .home-chat-state {
  grid-row: 3;
}

.home-chat-messages {
  width: min(880px, 100%);
  grid-row: 1 / 2;
  align-self: stretch;
  min-height: 0;
  display: none;
  overflow-y: auto;
  padding: 8px 0 28px;
}

.home-chat-messages.active {
  display: flex;
  grid-row: 1;
  flex-direction: column;
  gap: 18px;
  justify-content: flex-start;
  padding: 8px 0 16px;
}

.home-message {
  display: flex;
}

.home-message.user {
  justify-content: flex-end;
}

.home-message.assistant {
  justify-content: flex-start;
}

.home-message-body {
  max-width: min(720px, 86%);
  border-radius: 8px;
  padding: 12px 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.home-message.user .home-message-body {
  background: #1f766b;
  color: #ffffff;
}

.home-message.assistant .home-message-body {
  background: transparent;
  color: #17221d;
  padding-left: 0;
}

.home-search-results {
  width: min(780px, 94%);
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid #e3e9e5;
  display: grid;
  gap: 8px;
}

.home-search-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #617169;
  font-size: 12px;
}

.home-search-results-head strong {
  color: #20352c;
  font-size: 13px;
}

.home-search-result {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid #e1e8e4;
  border-radius: 8px;
  background: #ffffff;
  color: #24372f;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.home-search-result:hover {
  border-color: #91b7aa;
  background: #f7fbf9;
}

.home-search-result-rank {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #e8f3ef;
  color: #1f766b;
  font-size: 12px;
  font-weight: 800;
}

.home-search-result-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.home-search-result-body strong,
.home-search-result-body span,
.home-search-result-body small {
  overflow-wrap: anywhere;
}

.home-search-result-body span {
  color: #52635b;
  font-size: 13px;
  line-height: 1.55;
}

.home-search-result-body small {
  color: #87948e;
  font-size: 11px;
}

.home-search-result-body mark {
  padding: 0 2px;
  background: #fff0a8;
  color: inherit;
}

.home-search-result-score {
  color: #1f766b;
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 768px) {
  .app-shell {
    display: block;
  }

  .app-shell .sidebar,
  .app-shell:has(#todosView:not(.hidden)) .sidebar,
  .app-shell:has(#settingsView:not(.hidden)) .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    width: min(84vw, 320px) !important;
    max-width: min(84vw, 320px) !important;
    height: 100vh !important;
    max-height: none !important;
    z-index: 80 !important;
    border-radius: 0 18px 18px 0 !important;
    transform: translateX(-104%) !important;
    transition: transform 180ms ease !important;
    box-shadow: 24px 0 80px rgba(31, 43, 37, 0.18) !important;
  }

  body.sidebar-open .app-shell .sidebar {
    transform: translateX(0) !important;
  }

  body.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(16, 24, 20, 0.28);
  }

  .content,
  .app-shell:has(#todosView:not(.hidden)) .content,
  .app-shell:has(#settingsView:not(.hidden)) .content {
    min-height: 100vh !important;
    padding: 14px !important;
    border-radius: 0 !important;
  }

  #dashboardView {
    min-height: calc(100vh - 28px);
    height: calc(100vh - 28px);
  }

  .home-ai-shell {
    min-height: calc(100vh - 28px);
    height: calc(100vh - 28px);
    padding: 38px 0 22px;
  }

  .home-hero {
    align-self: center;
    gap: 22px;
  }

  .home-hero h1 {
    gap: 10px;
  }

  .home-examples {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 0 2px 4px;
  }

  .home-examples button {
    flex: 0 0 auto;
  }

  .home-chat-form {
    min-height: 64px;
    grid-template-columns: minmax(0, 1fr) 42px;
    border-radius: 8px;
  }

  .home-send-btn {
    width: 42px;
    height: 42px;
  }

  .home-message-body {
    max-width: 92%;
  }
}

/* Thoughts stream */
.icon-thought .icon-placeholder {
  background-image: url("/images/sidebar-thought.png"), url("/images/chat-launcher.png");
}

.thoughts-shell {
  --thought-primary: #02b875;
  --thought-primary-dark: #029660;
  --thought-primary-light: #e6f8f1;
  --thought-bg: #f4f7f6;
  --thought-text: #2f3432;
  --thought-muted: #8b9893;
  --thought-line: #e1e6e4;
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: calc(100dvh - var(--topbar-height, 0px));
  margin: -24px -24px -40px;
  background: var(--thought-bg);
  color: var(--thought-text);
}

.thought-sidebar {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 16px;
  border-right: 1px solid var(--thought-line);
  background: #ffffff;
}

.thought-brand {
  padding: 0 8px 2px;
}

.thought-brand h2 {
  margin: 0;
  color: var(--thought-text);
  font-size: 18px;
  line-height: 1.4;
  font-weight: 800;
}

.thought-brand p {
  margin: 4px 0 0;
  color: var(--thought-muted);
  font-size: 12px;
  line-height: 1.5;
}

.thought-nav-item,
.thought-tag-row {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #68726e;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
}

.thought-nav-item {
  padding: 8px 12px;
  text-align: left;
  font-size: 14px;
  font-weight: 650;
}

.thought-nav-item:hover,
.thought-tag-row:hover {
  color: var(--thought-primary);
  background: #f0f5f3;
}

.thought-nav-item.active,
.thought-tag-row.active {
  color: var(--thought-primary);
  background: var(--thought-primary-light);
}

.thought-tree-title {
  padding: 0 12px;
  color: var(--thought-muted);
  font-size: 12px;
  font-weight: 700;
}

.thought-tag-tree {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.thought-tag-node {
  margin-top: 2px;
}

.thought-tag-row {
  padding: 6px 8px;
  font-size: 14px;
  text-align: left;
}

.thought-tag-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.thought-tag-toggle,
.thought-tag-toggle-placeholder {
  width: 14px;
  height: 20px;
  flex: 0 0 14px;
}

.thought-tag-toggle {
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #adb8b4;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
}

.thought-tag-toggle.collapsed {
  transform: rotate(-90deg);
}

.thought-tag-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thought-tag-count {
  flex: 0 0 auto;
  color: var(--thought-muted);
  font-size: 12px;
}

.thought-tag-children {
  margin-left: 15px;
  padding-left: 9px;
  border-left: 1px dashed #d7dedb;
}

.thought-stream {
  min-width: 0;
  overflow-y: auto;
  padding: 40px 28px 56px;
}

.thought-stream-inner {
  width: min(100%, 652px);
  margin: 0 auto;
}

.thought-composer {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 2px solid var(--thought-line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(20, 40, 32, 0.04);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.thought-composer:focus-within {
  border-color: var(--thought-primary);
  box-shadow: 0 4px 16px rgba(2, 184, 117, 0.08);
}

#thoughtContent {
  width: 100%;
  min-height: 118px;
  max-height: 240px;
  resize: vertical;
  overflow-y: auto;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--thought-text);
  font-size: 15px;
  line-height: 1.7;
  box-shadow: none;
}

#thoughtContent:focus {
  border-color: transparent;
  box-shadow: none;
}

#thoughtContent::placeholder {
  color: #b1bbb7;
}

.thought-composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #edf1ef;
}

.thought-tag-shortcut {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--thought-muted);
  cursor: pointer;
  font-size: 14px;
}

.thought-tag-shortcut:hover {
  color: var(--thought-primary);
}

.thought-send {
  height: 34px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: var(--thought-primary);
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.16s ease;
}

.thought-send:hover {
  background: var(--thought-primary-dark);
}

.thought-send:disabled {
  background: #d7dedb;
  color: #ffffff;
  cursor: not-allowed;
}

#thoughtState {
  min-width: 0;
  color: var(--thought-muted);
  font-size: 12px;
  font-weight: 650;
}

#thoughtState.toast {
  color: #b45309;
}

.thought-filter-title {
  margin: 22px 0 12px;
  color: var(--thought-muted);
  font-size: 13px;
}

.thought-filter-title strong {
  color: var(--thought-primary);
  font-weight: 700;
}

.thought-list {
  display: grid;
  gap: 14px;
}

.thought-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 18px 20px 20px;
  border: 1px solid rgba(25, 45, 38, 0.05);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(20, 40, 32, 0.04);
}

.thought-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.thought-card time {
  color: var(--thought-muted);
  font-size: 12px;
}

.thought-delete {
  border: 0;
  background: transparent;
  color: #bdc6c2;
  cursor: pointer;
  font-size: 12px;
}

.thought-delete:hover {
  color: #e05252;
}

.thought-content {
  color: var(--thought-text);
  font-size: 15px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}

.thought-inline-tag {
  display: inline-block;
  margin: 0 2px;
  padding: 1px 6px;
  border: 0;
  border-radius: 4px;
  background: var(--thought-primary-light);
  color: var(--thought-primary);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.55;
  vertical-align: baseline;
}

.thought-inline-tag:hover {
  background: #d9f3e9;
}

.thought-empty {
  padding: 48px 20px;
  color: var(--thought-muted);
  text-align: center;
  font-size: 14px;
  line-height: 1.8;
}

.thought-empty-compact {
  padding: 30px 10px;
}

@media (max-width: 768px) {
  .thoughts-shell {
    grid-template-columns: 1fr;
    min-height: calc(100dvh - var(--mobile-topbar-height, 58px));
    margin: 0;
  }

  .thought-sidebar {
    min-height: auto;
    max-height: 42vh;
    border-right: 0;
    border-bottom: 1px solid var(--thought-line);
  }

  .thought-stream {
    padding: 22px 14px 88px;
  }

  .thought-card {
    padding: 16px;
  }
}

@media (max-width: 768px) {
  :root {
    --mobile-topbar-height: 58px;
  }

  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    background: #f6f7f9 !important;
  }

  .content,
  .app-shell:has(#todosView:not(.hidden)) .content,
  .app-shell:has(#settingsView:not(.hidden)) .content {
    padding: var(--mobile-topbar-height) 0 0 !important;
    background: #f6f7f9 !important;
  }

  .topbar,
  .app-shell:has(#dashboardView:not(.hidden)) .topbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 60 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    height: var(--mobile-topbar-height) !important;
    min-height: var(--mobile-topbar-height) !important;
    padding: max(8px, env(safe-area-inset-top)) 14px 8px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.92) !important;
    border-radius: 0 !important;
    background: rgba(246, 247, 249, 0.94) !important;
    backdrop-filter: blur(14px);
  }

  .mobile-menu-btn {
    display: grid !important;
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    color: #172033 !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08) !important;
  }

  .topbar > div {
    min-width: 0 !important;
  }

  .topbar h2 {
    margin: 0 !important;
    font-size: 20px !important;
    line-height: 1.1 !important;
  }

  .topbar p,
  #refreshBtn {
    display: none !important;
  }

  .sidebar-search,
  .kb-nav-group,
  .sidebar-bottom,
  .sidebar-logout,
  .sidebar-sync-status,
  .sidebar .nav[data-view="workspaces"],
  .sidebar .nav[data-view="messages"],
  .sidebar .nav[data-view="thoughts"],
  .sidebar .nav[data-view="marketing"],
  .sidebar .nav[data-view="analysis"],
  .sidebar .nav[data-view="history"],
  .sidebar .nav[data-view="favorites"],
  .sidebar .nav[data-view="settings"] {
    display: none !important;
  }

  .sidebar .nav[data-view="dashboard"],
  .sidebar .nav[data-view="inbox"],
  .sidebar .nav[data-view="todos"] {
    display: flex !important;
    min-height: 54px !important;
    font-size: 17px !important;
  }

  #dashboardView {
    height: calc(100dvh - var(--mobile-topbar-height)) !important;
    min-height: calc(100dvh - var(--mobile-topbar-height)) !important;
    overflow: hidden !important;
    background: #f6f7f9 !important;
  }

  .home-ai-shell {
    height: calc(100dvh - var(--mobile-topbar-height)) !important;
    min-height: calc(100dvh - var(--mobile-topbar-height)) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    padding: 20px 16px calc(124px + env(safe-area-inset-bottom)) !important;
    gap: 18px !important;
  }

  .home-ai-shell.home-chat-active {
    justify-content: flex-start !important;
    padding-top: 12px !important;
  }

  .home-hero {
    width: 100% !important;
    align-self: center !important;
    gap: 0 !important;
  }

  .home-hero h1 {
    font-size: 30px !important;
    line-height: 1.18 !important;
  }

  .home-examples,
  .home-chat-tools,
  .home-close-chat,
  .home-chat-state {
    display: none !important;
  }

  .home-chat-messages,
  .home-chat-messages.active {
    width: 100% !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding: 4px 0 14px !important;
    overflow-y: auto !important;
  }

  .home-message-body {
    max-width: 86% !important;
    border-radius: 18px !important;
    padding: 12px 14px !important;
    font-size: 15px !important;
  }

  .home-message.user .home-message-body {
    border-bottom-right-radius: 6px !important;
  }

  .home-message.assistant .home-message-body {
    border-bottom-left-radius: 6px !important;
    background: #ffffff !important;
    padding-left: 14px !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06) !important;
  }

  #homeChatForm,
  .home-ai-shell.home-chat-active #homeChatForm {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
    width: auto !important;
    min-height: 64px !important;
    grid-template-columns: minmax(0, 1fr) 46px !important;
    grid-template-rows: auto !important;
    padding: 10px !important;
    border-radius: 22px !important;
    z-index: 55 !important;
  }

  #homeChatForm textarea {
    min-height: 46px !important;
    max-height: 32dvh !important;
    padding: 12px 8px 8px 12px !important;
    font-size: 16px !important;
  }

  .home-send-btn {
    width: 46px !important;
    height: 46px !important;
    border-radius: 16px !important;
  }

  #inboxView {
    padding: 0 !important;
    background: #f6f7f9 !important;
  }

  .inbox-panel {
    min-height: calc(100dvh - var(--mobile-topbar-height)) !important;
    padding: 18px 14px calc(104px + env(safe-area-inset-bottom)) !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #f6f7f9 !important;
  }

  .inbox-copy p,
  .inbox-draft-preview,
  .inbox-saved-section {
    display: none !important;
  }

  .inbox-copy h3 {
    font-size: 28px !important;
    margin-bottom: 14px !important;
  }

  .inbox-source-card {
    min-height: 116px !important;
    border-radius: 18px !important;
    background: #ffffff !important;
  }

  .inbox-file-pill {
    max-width: 100% !important;
    flex: 1 1 100% !important;
    border-radius: 16px !important;
    background: #ffffff !important;
  }

  .inbox-actions:first-of-type {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .inbox-actions:first-of-type #inboxState {
    grid-column: 1 / -1 !important;
  }

  .inbox-draft-editor {
    border-radius: 18px !important;
    background: #ffffff !important;
    padding: 14px !important;
  }

  .inbox-draft-editor input,
  .inbox-draft-editor textarea {
    min-height: 46px !important;
    border-radius: 14px !important;
    font-size: 16px !important;
  }

  #inboxDraftOcr {
    max-height: 34dvh !important;
    overflow-y: auto !important;
  }

  .inbox-tag-chips button,
  .inbox-card-tags span {
    min-height: 34px !important;
    border-radius: 999px !important;
    font-size: 14px !important;
  }

  #inboxDraftPanel .inbox-actions {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 54 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    padding: 10px 14px max(10px, env(safe-area-inset-bottom)) !important;
    background: rgba(246, 247, 249, 0.96) !important;
    border-top: 1px solid #e2e8f0 !important;
    backdrop-filter: blur(14px);
  }

  #inboxSaveEntryBtn,
  #inboxRegenerateSummaryBtn {
    min-height: 52px !important;
    border-radius: 16px !important;
  }

  #todosView {
    padding: 0 !important;
    background: #f6f7f9 !important;
  }

  #todosView .notes-shell {
    height: calc(100dvh - var(--mobile-topbar-height)) !important;
    min-height: calc(100dvh - var(--mobile-topbar-height)) !important;
    display: block !important;
    overflow: hidden !important;
  }

  #todosView .notes-sidebar {
    height: 100% !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 14px 14px 82px !important;
    background: #f6f7f9 !important;
    overflow-y: auto !important;
  }

  #todosView .notes-sidebar .panel-head h3 {
    font-size: 28px !important;
  }

  #todosView #noteOutlineToggleBtn,
  #todosView #newNoteFolderBtn,
  #todosView .notes-head-actions {
    display: none !important;
  }

  #todosView .notes-search {
    margin: 12px 0 14px !important;
    border-radius: 16px !important;
    background: #ffffff !important;
  }

  #todosView .note-folder-row {
    display: none !important;
  }

  #todosView .note-folder-content,
  #todosView .note-folder-children,
  #todosView .note-folder-notes {
    display: grid !important;
    gap: 10px !important;
    padding: 0 !important;
  }

  #todosView .note-folder-notes .note-item {
    min-height: 104px !important;
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 14px 44px 14px 14px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 18px !important;
    background: #ffffff !important;
  }

  #todosView .note-open strong {
    font-size: 16px !important;
  }

  #todosView .note-open small,
  #todosView .note-open span {
    white-space: normal !important;
  }

  #todosView .note-open span {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    overflow: hidden !important;
    color: #64748b !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
  }

  #todosView .row-actions {
    opacity: 1 !important;
    pointer-events: auto !important;
    right: 10px !important;
    top: 10px !important;
    bottom: auto !important;
    transform: none !important;
  }

  #todosView .note-editor-panel {
    position: fixed !important;
    inset: var(--mobile-topbar-height) 0 0 0 !important;
    z-index: 50 !important;
    display: none !important;
    height: calc(100dvh - var(--mobile-topbar-height)) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 12px 14px calc(96px + env(safe-area-inset-bottom)) !important;
    background: #ffffff !important;
  }

  body.mobile-note-editing #todosView .note-editor-panel {
    display: block !important;
  }

  body.mobile-note-editing #todosView .notes-sidebar,
  body.mobile-note-editing #todosView .mobile-note-fab {
    display: none !important;
  }

  #todosView .note-editor-panel .panel-head {
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 4px 0 10px !important;
    background: #ffffff !important;
  }

  .mobile-note-back {
    display: inline-flex !important;
    min-height: 40px !important;
    border-radius: 12px !important;
  }

  #todosView .note-toolbar {
    height: 50px !important;
    min-height: 50px !important;
    margin: 0 -14px !important;
    padding: 0 14px !important;
  }

  #todosView .note-title-field,
  #todosView .note-editor,
  #todosView #noteSavedPath,
  #todosView .note-statusbar {
    width: 100% !important;
  }

  #todosView .note-title-field {
    margin-top: 12px !important;
  }

  #todosView .note-title-field input {
    font-size: 24px !important;
  }

  #todosView .note-editor {
    min-height: 54dvh !important;
    padding: 16px 0 24px !important;
    font-size: 17px !important;
    line-height: 1.7 !important;
  }

  .mobile-note-fab {
    position: fixed !important;
    right: 18px !important;
    bottom: max(18px, env(safe-area-inset-bottom)) !important;
    z-index: 56 !important;
    display: grid !important;
    width: 58px !important;
    height: 58px !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 20px !important;
    background: #2563eb !important;
    color: #ffffff !important;
    font-size: 32px !important;
    line-height: 1 !important;
    box-shadow: 0 18px 42px rgba(37, 99, 235, 0.28) !important;
  }
}

@media (min-width: 769px) {
  .mobile-menu-btn,
  .mobile-note-back,
  .mobile-note-fab {
    display: none !important;
  }

  #todosView .note-folder-notes .note-item {
    min-height: 40px !important;
    padding: 8px 40px 8px 10px !important;
  }

  #todosView .note-folder-notes .note-open {
    display: block !important;
  }

  #todosView .note-folder-notes .note-open strong {
    margin-bottom: 0 !important;
  }

  #todosView .note-folder-notes .note-open small,
  #todosView .note-folder-notes .note-open span {
    display: none !important;
  }
}

@media (max-width: 768px) {
  body.sidebar-open::after {
    content: none !important;
    display: none !important;
  }

  .app-shell .sidebar,
  .app-shell:has(#todosView:not(.hidden)) .sidebar,
  .app-shell:has(#settingsView:not(.hidden)) .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(84vw, 320px) !important;
    max-width: min(84vw, 320px) !important;
    height: 100dvh !important;
    max-height: none !important;
    z-index: 120 !important;
    transform: translateX(-104%) !important;
    transition: transform 180ms ease !important;
    box-shadow: 24px 0 80px rgba(15, 23, 42, 0.18) !important;
  }

  body.sidebar-open .app-shell .sidebar,
  body.sidebar-open .app-shell:has(#todosView:not(.hidden)) .sidebar,
  body.sidebar-open .app-shell:has(#settingsView:not(.hidden)) .sidebar {
    transform: translateX(0) !important;
  }

  .topbar {
    z-index: 90 !important;
  }
}

/* Recall Message Prototype: single source of truth for the Smart Message page. */
@media (min-width: 761px) {
  #appView.app-shell:has(#messagesView:not(.hidden)) {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    display: flex;
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: #f4f5f6;
    color: #1c1c1e;
    letter-spacing: -0.2px;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .content {
    flex: 1 1 auto;
    height: 100vh;
    min-width: 0;
    overflow: hidden;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .topbar {
    display: none;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border: 0;
    border-right: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 0;
    background: #fafafa;
    box-shadow: none;
    color: #71717a;
    overflow: hidden;
    z-index: 10;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .brand,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .kb-nav {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .brand {
    display: contents;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .brand-row {
    display: flex;
    justify-content: center;
    order: 1;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .kb-nav {
    flex: 1 1 auto;
    justify-content: flex-start;
    padding-top: 20px;
    order: 2;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .brand h1,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .brand p,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .sidebar-search,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav span:not(.icon-base):not(.nav-left):not(.message-target-node):not(.nav-badge),
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .sidebar-logout span:not(.nav-left):not(.icon-base):not(.sidebar-user-avatar),
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .sidebar-sync-status,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .marketing-subnav,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .status-dot,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .kb-nav::before,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .sidebar-bottom::before {
    display: none;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .avatar-wrapper,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="dashboard"] {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: #1a1a1c;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: transparent;
    color: #ffffff;
    font-size: 18px;
    font-weight: 900;
    font-family: "Arial Black", Inter, sans-serif;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .sidebar-logout {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #71717a;
    box-shadow: none;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="dashboard"] {
    order: 1;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="messages"] {
    order: 2;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="marketing"] {
    order: 3;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="todos"] {
    order: 4;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="inbox"] {
    order: 5;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="thoughts"] {
    order: 6;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .sidebar-bottom {
    display: contents;
    order: 7;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="settings"] {
    order: 7;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav.active:not([data-view="dashboard"]),
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav:hover:not([data-view="dashboard"]) {
    background: rgba(0, 0, 0, 0.03);
    color: #1a1a1c;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="thoughts"] {
    background: transparent;
    color: inherit;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="thoughts"]:hover,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="thoughts"].active {
    background: #1a1a1c;
    color: #ffffff;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="thoughts"] .icon-thought,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="thoughts"] .flomo-mark {
    width: 24px;
    height: 24px;
    min-width: 24px;
    display: grid;
    place-items: center;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav[data-view="thoughts"] .flomo-mark {
    border-radius: 0;
    background: transparent;
    color: currentColor;
    line-height: 1;
    box-shadow: none;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .nav-left,
  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .message-target-node {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .icon-base {
    width: 20px;
    min-width: 20px;
    height: 20px;
    border-radius: 0;
    background: transparent;
    color: currentColor;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .sidebar-reference-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .sidebar-reference-icon-fill {
    fill: currentColor;
    stroke: none;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .sidebar-logout {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    background: #e4e4e7;
    color: #1c1c1e;
  }

  #appView.app-shell:has(#messagesView:not(.hidden)) .ios-sidebar .sidebar-user-avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #e4e4e7;
    color: #1c1c1e;
    font-size: 13px;
    font-weight: 700;
  }

  #messagesView {
    height: 100vh;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
  }

  #messagesView .ios-message-center {
    height: 100vh;
    display: flex;
    gap: 0;
    overflow: hidden;
    background: #ffffff;
  }

  #messagesView .message-list-panel {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border: 0;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0;
    background: #fcfcfc;
    box-shadow: none;
    overflow: hidden;
  }

  #messagesView .message-center-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: 24px 20px 14px;
    border: 0;
    background: #fcfcfc;
  }

  #messagesView .message-title-line {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  #messagesView .message-title-line h3 {
    margin: 0;
    color: #1c1c1e;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
  }

  #messagesView #messageTotalCount {
    color: #8e8e93;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
  }

  #messagesView #messageCenterHint {
    margin: 6px 0 0;
    color: #8e8e93;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #messagesView .message-head-actions {
    justify-self: end;
    padding-top: 3px;
  }

  #messagesView #markAllMessagesReadBtn {
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: #48484a;
    font-size: 12px;
    font-weight: 600;
    box-shadow: none;
  }

  #messagesView .message-filter-shell {
    grid-column: 1 / -1;
    width: fit-content;
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    padding: 0 10px;
    border: 1px solid rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.03);
    color: #48484a;
    font-size: 12px;
  }

  #messagesView .message-filter-shell span {
    color: #8e8e93;
  }

  #messagesView .message-filter-shell select {
    height: 30px;
    max-width: 118px;
    padding: 0 18px 0 0;
    border: 0;
    background: transparent;
    color: #48484a;
    font-size: 12px;
    font-weight: 700;
    appearance: none;
  }

  #messagesView .message-filter-shell i {
    color: #8e8e93;
    font-size: 10px;
  }

  #messagesView .message-list {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 8px 20px;
    overflow-y: auto;
    background: #fcfcfc;
  }

  #messagesView .message-list-item.msg-card {
    position: relative;
    width: 100%;
    display: block;
    margin: 0 0 4px;
    padding: 16px 14px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
  }

  #messagesView .message-list-item.msg-card:hover {
    background: rgba(0, 0, 0, 0.02);
  }

  #messagesView .message-list-item.msg-card.active {
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.01);
  }

  #messagesView .message-list-item.msg-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    width: 4px;
    height: 60%;
    border-radius: 0 4px 4px 0;
    background: transparent;
  }

  #messagesView .message-list-item.msg-card.active::before {
    background: #1a1a1c;
  }

  #messagesView .message-active-bar {
    display: none;
  }

  #messagesView .message-list-copy {
    display: grid;
    gap: 6px;
  }

  #messagesView .message-list-copy strong {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    color: #1c1c1e;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
  }

  #messagesView .message-list-copy strong > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #messagesView .status-badge {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
  }

  #messagesView .status-badge-done {
    background-color: rgba(34, 197, 94, 0.09);
    color: #16a34a;
  }

  #messagesView .status-badge-failed {
    background-color: rgba(239, 68, 68, 0.09);
    color: #dc2626;
  }

  #messagesView .status-badge-pending {
    background-color: rgba(0, 122, 255, 0.09);
    color: #007aff;
  }

  #messagesView .message-list-copy em {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: #8e8e93;
    font-size: 12px;
    font-style: normal;
    line-height: 1.4;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  #messagesView .message-list-copy small {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #a1a1aa;
    font-size: 11px;
    line-height: 1.4;
  }

  #messagesView .message-detail-panel {
    flex: 1 1 auto;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border: 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
    overflow: hidden;
  }

  #messagesView .message-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 32px;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    background: #ffffff;
  }

  #messagesView .message-detail-path {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #8e8e93;
    font-size: 12px;
    line-height: 1.3;
  }

  #messagesView .message-detail-path span {
    color: #48484a;
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  #messagesView .message-detail-path span:nth-child(3) {
    color: #8e8e93;
    text-decoration: none;
  }

  #messagesView .message-detail-head h3 {
    margin: 10px 0 0;
    color: #1c1c1e;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.22;
    letter-spacing: -0.4px;
  }

  #messagesView .message-detail-head p {
    display: none;
  }

  #messagesView .message-detail-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 12px;
  }

  #messagesView #openMessageFollowupDrawerBtn,
  #messagesView #copyMessageDetailBtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  }

  #messagesView #openMessageFollowupDrawerBtn {
    order: 1;
    min-height: 34px;
    padding: 8px 16px;
    border: 0;
    background: #1a1a1c;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }

  #messagesView #copyMessageDetailBtn {
    order: 2;
    min-height: 34px;
    padding: 7px 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #ffffff;
    color: #48484a;
    box-shadow: none;
  }

  #messagesView .message-detail-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 32px 40px;
    background: #ffffff;
    color: #27272a;
    font-size: 14.5px;
    line-height: 1.75;
    letter-spacing: -0.2px;
  }

  #messagesView .message-detail-content h1,
  #messagesView .message-detail-content h2,
  #messagesView .message-detail-content h3,
  #messagesView .message-detail-content h4 {
    margin: 0 0 8px;
    color: #1c1c1e;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
  }

  #messagesView .message-detail-content p,
  #messagesView .message-detail-content li,
  #messagesView .message-detail-content ol {
    color: #27272a;
    font-size: 14.5px;
    line-height: 1.75;
    letter-spacing: -0.2px;
  }

  #messagesView .message-detail-content p {
    margin: 0 0 14px;
  }

  #messagesView .message-detail-content ul,
  #messagesView .message-detail-content ol {
    margin: 0 0 18px;
    padding-left: 20px;
  }

  #messagesView .message-detail-content li {
    margin-bottom: 12px;
  }

  #messagesView .entity-highlight {
    color: #007aff;
    font-weight: 600;
  }

  #messagesView .message-prototype-text,
  #messagesView .message-prototype-metrics,
  #messagesView .message-prototype-metric,
  #messagesView .message-prototype-list,
  #messagesView .message-prototype-list-item,
  #messagesView .message-prototype-table {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #messagesView .message-prototype-section-title {
    margin: 0 0 8px;
    color: #1c1c1e;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
  }
}

@media (max-width: 760px) {
  #messagesView {
    height: auto;
    min-height: 100vh;
    padding: 12px;
  }

  #messagesView .ios-message-center {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* PWA mobile final overrides: bottom navigation, safe area, and stable home composer. */
@media (max-width: 768px) {
  :root {
    --mobile-bottom-nav-height: 72px;
    --mobile-bottom-nav-total: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
  }

  html,
  body {
    width: 100%;
    min-width: 0 !important;
    min-height: 100%;
    overflow-x: hidden !important;
    overscroll-behavior-y: contain;
    background: #f6f7f9 !important;
  }

  body {
    padding: 0;
    touch-action: manipulation;
  }

  #appView.app-shell,
  #appView.app-shell:has(#todosView:not(.hidden)),
  #appView.app-shell:has(#settingsView:not(.hidden)) {
    display: block !important;
    width: 100% !important;
    min-height: 100dvh !important;
    height: auto !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #f6f7f9 !important;
  }

  #appView .content,
  #appView.app-shell:has(#todosView:not(.hidden)) .content,
  #appView.app-shell:has(#settingsView:not(.hidden)) .content {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 100dvh !important;
    height: auto !important;
    padding: 0 0 var(--mobile-bottom-nav-total) !important;
    border-radius: 0 !important;
    overflow: visible !important;
    background: #f6f7f9 !important;
  }

  #appView .content::before,
  body.sidebar-open::after {
    content: none !important;
    display: none !important;
  }

  #appView .topbar {
    min-height: var(--mobile-topbar-height, 68px) !important;
    margin: 0 !important;
    padding: max(12px, env(safe-area-inset-top)) 16px 12px !important;
    border-radius: 0 !important;
    z-index: 40 !important;
  }

  #mobileMenuBtn {
    display: none !important;
  }

  #appView .ios-sidebar,
  #appView.app-shell:has(#todosView:not(.hidden)) .ios-sidebar,
  #appView.app-shell:has(#settingsView:not(.hidden)) .ios-sidebar {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    z-index: 100 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: var(--mobile-bottom-nav-total) !important;
    min-height: var(--mobile-bottom-nav-total) !important;
    max-height: var(--mobile-bottom-nav-total) !important;
    display: block !important;
    padding: 6px max(10px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(10px, env(safe-area-inset-right)) !important;
    border: 0 !important;
    border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    border-radius: 22px 22px 0 0 !important;
    background: rgba(255, 255, 255, 0.94) !important;
    box-shadow: 0 -12px 36px rgba(15, 23, 42, 0.12) !important;
    transform: none !important;
    overflow: hidden !important;
    backdrop-filter: blur(18px) saturate(1.2) !important;
    -webkit-backdrop-filter: blur(18px) saturate(1.2) !important;
  }

  #appView .ios-sidebar .brand,
  #appView .ios-sidebar .sidebar-search,
  #appView .ios-sidebar .marketing-subnav,
  #appView .ios-sidebar .sidebar-bottom,
  #appView .ios-sidebar .sidebar-logout,
  #appView .ios-sidebar .sidebar-sync-status {
    display: none !important;
  }

  #appView .ios-sidebar .kb-nav {
    width: 100% !important;
    height: var(--mobile-bottom-nav-height) !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    align-items: center !important;
    justify-items: center !important;
    gap: 2px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }

  #appView .ios-sidebar .kb-nav::before,
  #appView .ios-sidebar .kb-nav::after {
    content: none !important;
    display: none !important;
  }

  #appView .ios-sidebar .kb-nav::-webkit-scrollbar {
    display: none !important;
  }

  #appView .ios-sidebar .nav,
  #appView.app-shell:has(#todosView:not(.hidden)) .ios-sidebar .nav,
  #appView.app-shell:has(#settingsView:not(.hidden)) .ios-sidebar .nav {
    position: relative !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 60px !important;
    min-height: 60px !important;
    display: grid !important;
    place-items: center !important;
    margin: 0 !important;
    padding: 5px 2px 4px !important;
    border: 0 !important;
    border-radius: 16px !important;
    background: transparent !important;
    color: #747b86 !important;
    box-shadow: none !important;
    transform: none !important;
  }

  #appView .ios-sidebar .nav[data-view="settings"],
  #appView .ios-sidebar .nav[data-view="workspaces"],
  #appView .ios-sidebar .nav[data-view="analysis"],
  #appView .ios-sidebar .nav[data-view="history"],
  #appView .ios-sidebar .nav[data-view="favorites"],
  #appView .ios-sidebar .nav[data-view="thoughts"] {
    display: none !important;
  }

  #appView .ios-sidebar .nav[data-view="dashboard"] { order: 1; }
  #appView .ios-sidebar .nav[data-view="messages"] { order: 2; }
  #appView .ios-sidebar .nav[data-view="todos"] { order: 3; }
  #appView .ios-sidebar .nav[data-view="inbox"] { order: 4; }
  #appView .ios-sidebar .nav[data-view="ocr"] { order: 5; }
  #appView .ios-sidebar .nav[data-view="marketing"] { order: 6; }
  #appView .ios-sidebar .nav[data-view="video"] { order: 7; }

  #appView .ios-sidebar .nav.active {
    background: #1a1a1c !important;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(26, 26, 28, 0.14) !important;
  }

  #appView .ios-sidebar .nav::after,
  #appView .ios-sidebar .sidebar-logout::after {
    content: none !important;
    display: none !important;
  }

  #appView .ios-sidebar .nav-left,
  #appView .ios-sidebar .message-target-node {
    width: 100% !important;
    height: auto !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-rows: 24px 16px !important;
    place-items: center !important;
    gap: 3px !important;
  }

  #appView .ios-sidebar .icon-base,
  #appView .ios-sidebar .nav .icon-base,
  #appView .ios-sidebar .nav.active .icon-base {
    position: static !important;
    width: 24px !important;
    min-width: 24px !important;
    height: 24px !important;
    display: grid !important;
    place-items: center !important;
    margin: 0 !important;
    color: currentColor !important;
    transform: none !important;
  }

  #appView .ios-sidebar .sidebar-reference-icon {
    width: 21px !important;
    height: 21px !important;
  }

  #appView .ios-sidebar .nav-left > span:last-child:not(.icon-base),
  #appView .ios-sidebar .message-target-node + span {
    display: block !important;
    max-width: 100% !important;
    color: currentColor !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: -0.2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  #appView .ios-sidebar #messageUnreadBadge {
    position: absolute !important;
    top: 4px !important;
    right: 17% !important;
    min-width: 16px !important;
    min-height: 16px !important;
    padding: 0 4px !important;
    border: 2px solid #ffffff !important;
    font-size: 10px !important;
    line-height: 14px !important;
  }

  #dashboardView {
    width: 100% !important;
    min-height: 100dvh !important;
    height: 100dvh !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .home-ai-shell {
    width: 100% !important;
    min-height: 100dvh !important;
    height: 100dvh !important;
    padding: max(24px, env(safe-area-inset-top)) 16px calc(var(--mobile-bottom-nav-total) + 108px) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 18px !important;
  }

  .home-ai-shell.home-chat-active {
    justify-content: flex-start !important;
    padding-top: max(14px, env(safe-area-inset-top)) !important;
  }

  .home-hero {
    display: grid !important;
    width: 100% !important;
    gap: 18px !important;
  }

  .home-hero h1 {
    display: flex !important;
    font-size: clamp(28px, 8vw, 34px) !important;
    line-height: 1.16 !important;
  }

  #homeChatForm,
  .home-ai-shell.home-chat-active #homeChatForm {
    position: fixed !important;
    left: max(12px, env(safe-area-inset-left)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: calc(var(--mobile-bottom-nav-total) + 12px) !important;
    width: auto !important;
    min-height: 64px !important;
    display: grid !important;
    grid-template-columns: 40px minmax(0, 1fr) 46px !important;
    grid-template-rows: auto auto auto !important;
    gap: 8px !important;
    padding: 10px !important;
    border-radius: 22px !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    z-index: 90 !important;
  }

  #homeChatForm textarea {
    display: block !important;
    min-height: 46px !important;
    max-height: 32dvh !important;
    padding: 11px 6px 8px 8px !important;
    font-size: 16px !important;
  }

  #homeChatForm .home-attach-btn {
    width: 40px !important;
    height: 40px !important;
    align-self: center !important;
  }

  #homeChatForm .home-send-btn {
    width: 46px !important;
    height: 46px !important;
    border-radius: 16px !important;
  }

  #homeChatForm .home-chat-tools {
    display: none !important;
  }

  .home-chat-messages,
  .home-chat-messages.active {
    padding-bottom: calc(var(--mobile-bottom-nav-total) + 92px) !important;
    overscroll-behavior-y: contain;
  }
}

/* Final desktop sidebar ordering: thoughts sits directly below knowledge notes. */
@media (min-width: 769px) {
  #appView .ios-sidebar {
    max-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
  }

  #appView .ios-sidebar::-webkit-scrollbar {
    width: 6px !important;
  }

  #appView .ios-sidebar::-webkit-scrollbar-thumb {
    border-radius: 999px !important;
    background: rgba(15, 23, 42, 0.18) !important;
  }

  #appView .ios-sidebar .kb-nav {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  #appView .ios-sidebar .nav[data-view="dashboard"] {
    order: 1 !important;
  }

  #appView .ios-sidebar .nav[data-view="messages"] {
    order: 2 !important;
  }

  #appView .ios-sidebar .nav[data-view="marketing"] {
    order: 3 !important;
  }

  #appView .ios-sidebar .nav[data-view="todos"] {
    order: 4 !important;
  }

  #appView .ios-sidebar .nav[data-view="thoughts"] {
    order: 5 !important;
  }

  #appView .ios-sidebar .nav[data-view="inbox"] {
    order: 6 !important;
  }

  #appView .ios-sidebar .nav[data-view="video"] {
    order: 7 !important;
  }

  #appView .ios-sidebar .nav[data-view="thoughts"] {
    display: grid !important;
    place-items: center !important;
    width: 46px !important;
    min-width: 46px !important;
    height: 46px !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
  }

  #appView .ios-sidebar .nav[data-view="thoughts"]:hover,
  #appView .ios-sidebar .nav[data-view="thoughts"].active {
    background: #1a1a1c !important;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(26, 26, 28, 0.14) !important;
  }

  #appView .ios-sidebar .sidebar-bottom,
  #appView .ios-sidebar .nav[data-view="email"],
  #appView .ios-sidebar .nav[data-view="settings"] {
    order: 8 !important;
  }

  #appView .ios-sidebar .nav[data-view="thoughts"] .icon-thought,
  #appView .ios-sidebar .nav[data-view="thoughts"] .flomo-mark {
    display: grid !important;
    place-items: center !important;
    width: 24px !important;
    min-width: 24px !important;
    height: 24px !important;
    min-height: 24px !important;
  }

  #appView .ios-sidebar .nav[data-view="thoughts"] .icon-thought {
    background: transparent !important;
    color: inherit !important;
  }

  #appView .ios-sidebar .nav[data-view="thoughts"] .flomo-mark {
    border-radius: 0 !important;
    background: transparent !important;
    color: currentColor !important;
    line-height: 1 !important;
    box-shadow: none !important;
  }

  #appView .ios-sidebar .nav[data-view="thoughts"] .bolt-outline {
    width: 22px !important;
    height: 23px !important;
    background: currentColor !important;
    clip-path: polygon(54% 0, 15% 56%, 46% 56%, 36% 100%, 87% 42%, 56% 42%) !important;
  }

  #appView .ios-sidebar .nav[data-view="thoughts"] .bolt-outline::after {
    background: #ffffff !important;
    clip-path: polygon(54% 0, 15% 56%, 46% 56%, 36% 100%, 87% 42%, 56% 42%) !important;
  }

  #appView .ios-sidebar .nav[data-view="thoughts"]:hover .bolt-outline::after,
  #appView .ios-sidebar .nav[data-view="thoughts"].active .bolt-outline::after {
    background: #1a1a1c !important;
  }
}

.sidebar .nav[data-view="email"]::after {
  content: "邮件中心";
}

.sidebar .nav[data-view="email"] {
  order: 1 !important;
}

.sidebar .nav[data-view="settings"] {
  order: 2 !important;
}

.sidebar-bottom {
  flex-direction: column !important;
  gap: 12px !important;
}

.sidebar-bottom .nav[data-view="email"],
.sidebar-bottom .nav[data-view="settings"] {
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  margin: 0 auto !important;
  padding: 0 !important;
}

.sidebar-bottom .nav[data-view="email"].active,
.sidebar-bottom .nav[data-view="settings"].active {
  background: #1a1a1c !important;
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(26, 26, 28, 0.14) !important;
}
