:root {
  --background: 214 40% 98%;
  --foreground: 222 47% 11%;
  --card: 0 0% 100%;
  --card-foreground: 222 47% 11%;
  --primary: 217 91% 55%;
  --primary-foreground: 0 0% 100%;
  --secondary: 214 32% 91%;
  --secondary-foreground: 222 47% 11%;
  --muted: 214 32% 94%;
  --muted-foreground: 215 16% 47%;
  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 100%;
  --border: 214 32% 90%;
  --input: 214 32% 88%;
  --ring: 217 91% 60%;
  --radius: 0.75rem;
  --bg: hsl(var(--background));
  --panel: hsl(var(--card));
  --ink: hsl(var(--foreground));
  --muted-text: hsl(var(--muted-foreground));
  --line: hsl(var(--border));
  --brand: hsl(var(--primary));
  --brand-strong: #1d4ed8;
  --soft: hsl(var(--muted));
  --warn: hsl(var(--destructive));
}

* {
  letter-spacing: 0;
}

html {
  background: hsl(var(--background));
}

body {
  background:
    linear-gradient(180deg, #f8fbff 0%, #f3f7fd 42%, #eef4fb 100%);
  color: hsl(var(--foreground));
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 0;
  background: transparent;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  background: #ffffff;
  color: hsl(var(--foreground));
  border-right: 1px solid hsl(var(--border));
  box-shadow: 6px 0 24px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: grid;
  gap: 12px;
  padding: 0 4px 8px;
}

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

.brand h1 {
  font-size: 24px;
  font-weight: 750;
  color: hsl(var(--foreground));
}

.brand p {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.status-dot {
  border-color: #fff;
  background: #22c55e;
}

.sidebar-search {
  min-height: 40px;
  border: 1px solid hsl(var(--border));
  background: #f8fafc;
  border-radius: 12px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-search input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  height: 38px;
}

.kb-nav {
  flex: 1;
  overflow: auto;
  padding-right: 4px;
  display: grid;
  align-content: start;
  gap: 6px;
}

.nav,
.kb-group-toggle,
.sidebar-logout {
  min-height: 40px;
  border-radius: 12px;
  color: #475569;
  background: transparent;
  font-weight: 600;
  border: 0;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.nav.active,
.nav:hover,
.kb-group-toggle:hover,
.sidebar-logout:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.nav.active {
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

.nav-badge,
.settings-state-pill,
#configState,
#inboxState,
#marketingAnalysisState,
#marketingFileHint,
#workspaceFileHint,
#messageUnreadBadge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
}

.sidebar-bottom {
  margin-top: auto;
}

.sidebar-sync-status {
  margin-top: 4px;
  border-radius: 12px;
  border: 1px solid hsl(var(--border));
  background: #f8fafc;
  color: hsl(var(--muted-foreground));
  padding: 10px 12px;
  font-size: 12px;
}

.content {
  height: 100vh;
  overflow: auto;
  padding: 28px;
}

.content::before {
  content: "";
  position: fixed;
  inset: 0 0 0 264px;
  pointer-events: none;
  background: radial-gradient(circle at 88% 8%, rgba(37, 99, 235, 0.09), transparent 30%);
}

.topbar {
  display: none;
}

.topbar h2 {
  font-size: 26px;
  font-weight: 750;
}

.topbar p {
  color: hsl(var(--muted-foreground));
  font-size: 14px;
}

.view {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  min-height: calc(100vh - 112px);
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

#dashboardView {
  display: grid;
  place-items: center;
  background: #ffffff;
}

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

.panel,
.settings-summary-card,
.settings-config-card,
.message-list-panel,
.message-detail-panel,
.thought-composer,
.thought-list article,
.inbox-panel,
.inbox-source-card,
.kb-file-section,
.workspace-file-card,
.marketing-upload,
.notes-sidebar,
.note-editor-panel,
.reader,
.browser-box,
.workspace-upload-empty {
  border: 1px solid hsl(var(--border)) !important;
  border-radius: 18px !important;
  background: hsl(var(--card)) !important;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.06) !important;
}

.panel,
.inbox-panel,
.kb-file-section,
.settings-config-card,
.settings-summary-card {
  padding: 24px !important;
}

.primary,
.secondary,
.danger,
.icon-btn,
.ghost-icon,
.home-examples button,
.message-head-actions button,
.reader-actions button,
.toolbar-actions button,
.subhead button,
.composer-icon,
.home-send-btn {
  min-height: 38px;
  border-radius: 10px !important;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.primary,
.home-send-btn,
.composer-icon.send {
  border: 1px solid hsl(var(--primary)) !important;
  background: hsl(var(--primary)) !important;
  color: hsl(var(--primary-foreground)) !important;
}

.primary:hover,
.home-send-btn:hover,
.composer-icon.send:hover {
  background: #1d4ed8 !important;
}

.secondary,
.icon-btn,
.ghost-icon,
.toolbar-actions button,
.subhead button,
.message-head-actions button,
.reader-actions button {
  border: 1px solid hsl(var(--border)) !important;
  background: #ffffff !important;
  color: hsl(var(--foreground)) !important;
}

.secondary:hover,
.icon-btn:hover,
.ghost-icon:hover,
.toolbar-actions button:hover,
.subhead button:hover {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
  color: #1d4ed8 !important;
}

.danger {
  background: #fee2e2 !important;
  color: #b91c1c !important;
}

input,
select,
textarea,
.search,
.workspace-file-search,
.thought-search {
  min-height: 40px;
  border: 1px solid hsl(var(--input)) !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

input:focus,
select:focus,
textarea:focus {
  border-color: hsl(var(--primary)) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14) !important;
}

.field span,
.settings-card-title p,
.kb-section-head p,
.inbox-copy p,
.message-center-head p,
.thoughts-hero p,
.marketing-upload-meta,
.home-chat-tools span {
  color: hsl(var(--muted-foreground));
}

.home-ai-shell {
  width: min(920px, 100%);
  min-height: 560px;
  display: grid;
  align-content: center;
  gap: 22px;
  padding: 28px;
}

.home-hero {
  display: grid;
  gap: 20px;
  text-align: center;
}

.home-hero h1 {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 800;
  color: #0f172a;
}

.home-examples {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.home-examples button {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 8px 12px;
}

.home-chat-form,
.kb-composer,
.workspace-chat-form,
.marketing-form {
  border: 1px solid hsl(var(--border));
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.1);
  padding: 14px;
}

.home-chat-form textarea,
.kb-composer textarea {
  border: 0 !important;
  box-shadow: none !important;
  min-height: 64px;
  resize: none;
}

.home-chat-tools,
.kb-composer-bar {
  border-top: 1px solid hsl(var(--border));
  padding-top: 10px;
}

.home-chat-messages.active,
.workspace-messages,
.message-list,
.message-detail-content {
  overflow: auto;
  scrollbar-width: thin;
}

.home-message-body,
.workspace-message,
.message-detail-content {
  border-radius: 16px;
}

.inbox-source-grid,
.marketing-data-upload,
.config-cols,
.settings-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.inbox-source-card,
.marketing-upload {
  min-height: 170px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 24px;
  text-align: left;
}

.inbox-source-icon,
.marketing-upload-icon,
.settings-card-icon,
.file-thumb {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: #eff6ff;
  color: #2563eb;
  font-weight: 800;
}

.inbox-actions,
.button-row,
.kb-file-actions,
.reader-actions,
.message-head-actions,
.message-detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.message-center {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 190px);
}

.message-list-panel,
.message-detail-panel {
  padding: 20px;
  min-height: 0;
}

.message-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

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

.message-center-head h3 {
  font-size: 22px;
  font-weight: 780;
  line-height: 1.2;
}

.message-center-head p {
  max-width: 180px;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.message-head-actions {
  justify-content: flex-end;
  gap: 8px;
}

.message-head-actions select {
  width: 150px;
  min-height: 38px;
}

.message-head-actions button {
  min-width: 96px;
}

.message-list {
  max-height: calc(100vh - 300px);
  display: grid;
  gap: 10px;
  padding-right: 4px;
}

.message-list-item {
  width: 100%;
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  border: 1px solid hsl(var(--border));
  border-radius: 14px;
  background: #ffffff;
  padding: 12px;
  text-align: left;
}

.message-list-item.active,
.message-list-item:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.message-status,
.file-type-mark,
.thought-tags button,
.workspace-file-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.message-detail-content {
  max-height: calc(100vh - 300px);
  margin-top: 16px;
  border: 1px solid hsl(var(--border));
  background: #f8fafc;
  padding: 18px;
}

.workspace-files,
.thought-list,
#marketingFiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.workspace-file-card,
.thought-list article {
  padding: 16px;
}

.workspace-file-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
}

.file-card-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thoughts-page {
  display: grid;
  gap: 18px;
}

.thoughts-hero h2,
.kb-title-wrap h2,
.settings-hero h2 {
  font-size: 28px;
  font-weight: 780;
}

.thought-composer {
  padding: 18px;
}

.thought-composer textarea {
  min-height: 150px;
  border: 0 !important;
  box-shadow: none !important;
}

.thought-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.kb-header,
.kb-section-head,
.settings-hero,
.message-center-head,
.message-detail-head,
.panel-head,
.reader-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.kb-file-section,
.marketing-file-section {
  display: grid;
  gap: 18px;
}

.marketing-page {
  display: grid;
  gap: 18px;
}

#marketingView .marketing-header {
  display: none;
}

#marketingView .marketing-file-card {
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: start;
  min-height: 190px;
  text-align: center;
}

#marketingView .marketing-file-card .file-thumb {
  width: 70px;
  height: 70px;
  margin-bottom: 8px;
  border-radius: 999px;
}

#marketingView .marketing-file-card .file-card-body {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
}

#marketingView .marketing-file-card .file-card-body strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}

#marketingView .marketing-file-card .file-card-body small {
  text-align: center;
}

#marketingView .marketing-file-card .file-card-actions {
  justify-content: center;
  width: 100%;
}

#marketingView .marketing-data-upload {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#marketingReportContent table,
.markdown-content table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
}

#marketingReportContent .markdown-table-wrap,
.markdown-content .markdown-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

#marketingReportContent th,
#marketingReportContent td,
.markdown-content th,
.markdown-content td {
  border: 1px solid hsl(var(--border));
  padding: 10px 12px;
  max-width: 360px;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  user-select: text;
}

#marketingReportContent th,
#marketingReportContent td {
  min-width: 96px;
}

#marketingReportContent th:first-child,
#marketingReportContent td:first-child {
  min-width: 220px;
  max-width: 420px;
}

#marketingReportContent td span,
#marketingReportContent th span,
.markdown-content td span,
.markdown-content th span {
  user-select: text;
}

#marketingReportContent th,
.markdown-content th {
  background: #eff6ff;
  color: #1d4ed8;
}

.settings-page {
  display: grid;
  gap: 20px;
}

#settingsView .settings-hero {
  display: none;
}

.settings-hero {
  border: 1px solid hsl(var(--border));
  border-radius: 20px;
  background: #ffffff;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.06);
}

.settings-tabs {
  display: inline-flex;
  width: fit-content;
  gap: 4px;
  border-radius: 12px;
  background: hsl(var(--muted));
  padding: 4px;
}

#settingsView .settings-summary {
  grid-template-columns: minmax(0, 1fr);
  max-width: 760px;
}

#settingsView .settings-summary-card.hidden {
  display: none !important;
}

.settings-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: hsl(var(--muted-foreground));
  padding: 0 14px;
  font-weight: 800;
}

.settings-tabs button.active {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.config-cols {
  align-items: start;
}

.settings-config-card {
  display: grid;
  gap: 14px;
}

.settings-account-card {
  max-width: 620px;
}

.settings-account-info {
  display: grid;
  gap: 6px;
  border: 1px solid hsl(var(--border));
  border-radius: 14px;
  background: #f8fafc;
  padding: 16px;
}

.settings-account-info span {
  color: hsl(var(--muted-foreground));
  font-size: 13px;
}

.settings-account-info strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

dialog {
  border: 1px solid hsl(var(--border)) !important;
  border-radius: 20px !important;
  background: #ffffff !important;
  color: hsl(var(--foreground));
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.22) !important;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.kb-chat-launcher,
#workspaceChatLauncher.kb-chat-launcher,
#marketingAnalysisLauncher.kb-chat-launcher,
#inboxView .inbox-ai-float {
  position: fixed !important;
  right: 28px !important;
  bottom: 28px !important;
  z-index: 80 !important;
  width: 58px !important;
  height: 58px !important;
  border-radius: 999px !important;
  border: 1px solid #bfdbfe !important;
  background: hsl(var(--primary)) url("/images/chat-launcher.png") center / cover no-repeat !important;
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.32) !important;
}

.kb-chat-dock:not(.hidden) {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 90;
  width: min(520px, 100vw);
  min-height: 100vh;
  display: grid;
  align-content: stretch;
  background: #ffffff;
  border-left: 1px solid hsl(var(--border));
  box-shadow: -24px 0 80px rgba(15, 23, 42, 0.18);
  padding: 20px;
}

.sheet-close-button {
  position: absolute;
  right: 20px;
  top: 18px;
  z-index: 3;
  min-height: 36px;
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  background: #ffffff;
  color: hsl(var(--foreground));
  padding: 0 12px;
  font-weight: 700;
}

.sheet-close-button:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.kb-chat-dock:not(.hidden)::before {
  content: "";
  position: fixed;
  inset: 0 min(520px, 100vw) 0 0;
  background: rgba(15, 23, 42, 0.28);
  pointer-events: none;
}

#marketingAnalysisDock.kb-chat-dock:not(.hidden)::before {
  display: none;
}

#marketingAnalysisDock.kb-chat-dock:not(.hidden) {
  background: #ffffff;
  width: min(1280px, calc(100vw - 304px));
  grid-template-rows: auto 1fr auto;
}

#marketingAnalysisDock #closeMarketingAnalysisDockBtn.hidden {
  display: block !important;
}

#marketingAnalysisDock .kb-chat-head .chat-history-chevron {
  display: none;
}

.kb-chat-panel,
.workspace-chat-panel,
.marketing-chat-panel,
.kb-input-section {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.workspace-chat-history,
.marketing-chat-history {
  display: grid;
  min-height: 0;
}

.marketing-chat-panel.hidden,
.marketing-chat-history.hidden {
  display: none !important;
}

#marketingAnalysisDock .marketing-chat-panel {
  min-width: 0;
}

#marketingAnalysisDock .marketing-chat-history {
  width: 100%;
  min-width: 0;
}

#marketingAnalysisDock #marketingReportContent {
  width: 100%;
  max-height: calc(100vh - 280px);
  overflow: auto;
}

#marketingAnalysisDock #marketingSavedPath {
  display: none !important;
}

#marketingAnalysisDock .marketing-report-footer {
  display: flex;
  align-items: center;
  gap: 16px;
}

#marketingAnalysisDock #marketingReportTitle {
  display: none !important;
}

#marketingAnalysisDock .marketing-report-footer {
  justify-content: flex-end;
}

.kb-chat-head {
  width: 100%;
  border: 1px solid hsl(var(--border));
  border-radius: 16px;
  background: #f8fafc;
  padding: 14px;
  text-align: left;
}

.notes-shell,
.analysis-layout,
.kb-workspace-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
}

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

.mobile-menu-btn {
  display: none;
}

#todosView {
  max-width: none;
}

#todosView .notes-shell {
  min-height: calc(100vh - 56px);
  gap: 20px;
}

#todosView .notes-sidebar,
#todosView .note-editor-panel {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

#todosView .notes-sidebar {
  padding: 24px 24px 18px !important;
  border-right: 1px solid hsl(var(--border)) !important;
  border-radius: 0 !important;
}

#todosView .notes-sidebar .panel-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
  padding: 0;
}

#todosView .notes-sidebar .panel-head h3 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
}

#todosView .notes-head-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

#todosView .notes-head-actions button {
  min-height: 36px;
  border-radius: 10px !important;
  padding: 0 12px;
}

#todosView #newNoteBtn {
  grid-column: 1 / -1;
  justify-self: start;
}

#todosView .notes-search {
  margin-bottom: 18px;
}

#todosView .note-editor-panel {
  padding: 28px 32px !important;
}

#todosView .note-editor-panel > .panel-head {
  display: none;
}

#todosView .note-title-field {
  display: block;
  margin: 0 auto 10px;
  max-width: 880px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#todosView .note-title-field span {
  display: none;
}

#todosView .note-title-field input {
  min-height: 58px;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 800;
  color: hsl(var(--foreground));
}

#todosView .note-title-field input:focus {
  border: 0 !important;
  box-shadow: none !important;
}

#todosView .note-title-field input::placeholder {
  color: #94a3b8;
}

#todosView .note-toolbar {
  max-width: 880px;
  margin: 0 auto;
  border-top: 0 !important;
  border-right: 0 !important;
  border-left: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#todosView #noteEditor {
  max-width: 880px;
  margin: 0 auto;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#todosView .note-folder-notes .note-item,
#todosView .note-item {
  width: 100%;
}

#todosView .note-item .note-open {
  min-width: 0;
  width: 100%;
  text-align: left;
}

#todosView .note-card-title-line {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

#todosView .note-card-title-line strong,
#todosView .note-item .note-open > strong {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  overflow-wrap: normal;
  line-height: 1.45;
}

#todosView .note-card-title-line small {
  display: block;
  min-width: 0;
  max-width: 112px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#todosView .note-item .note-open > span:last-child {
  display: block;
  margin-top: 4px;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 120;
    width: min(82vw, 320px);
    height: 100dvh;
    max-height: 100dvh;
    justify-content: flex-start;
    overflow-y: auto;
    padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)) !important;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  .sidebar .brand-row {
    gap: 12px;
  }

  .sidebar .brand h1 {
    font-size: 24px;
  }

  .sidebar-search {
    min-height: 44px;
  }

  .sidebar .brand {
    flex: 0 0 auto;
    gap: 10px;
    padding-bottom: 8px;
  }

  .sidebar .kb-nav {
    display: flex !important;
    flex-direction: column !important;
    flex: 0 0 auto;
    overflow: visible;
    align-items: stretch;
    align-content: start;
    gap: 8px;
    margin-top: 8px;
  }

  .sidebar .kb-nav-group,
  .sidebar .kb-nav-group-body {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch;
    gap: 8px;
    width: 100%;
  }

  .sidebar .nav[data-view="messages"] {
    display: flex !important;
  }

  .sidebar .nav,
  .sidebar .kb-group-toggle,
  .sidebar .sidebar-logout {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    font-size: 16px;
  }

  .sidebar .nav-left,
  .sidebar .kb-group-toggle .nav-left,
  .sidebar .sidebar-logout .nav-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    min-width: 0;
    white-space: nowrap;
  }

  .sidebar .nav-left > span:last-child,
  .sidebar .kb-group-toggle .nav-left > span:last-child {
    white-space: nowrap;
    writing-mode: horizontal-tb;
  }

  .sidebar .icon-base {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
  }

  .sidebar-bottom {
    margin-top: 0;
  }

  .sidebar-logout,
  .sidebar-sync-status {
    margin-top: 8px;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .content {
    height: auto;
    min-height: 100vh;
    padding: 0 16px 24px;
  }

  .content::before {
    inset: 0;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    min-height: 76px;
    margin: 0 -16px 18px;
    padding: max(12px, env(safe-area-inset-top)) 16px 12px;
    background: rgba(248, 251, 255, 0.94);
    border-bottom: 1px solid hsl(var(--border));
    backdrop-filter: blur(14px);
  }

  .topbar > div {
    min-width: 0;
    flex: 1;
  }

  .topbar h2 {
    font-size: 22px;
    line-height: 1.2;
  }

  .topbar p {
    display: none;
  }

  .mobile-menu-btn {
    position: static;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid hsl(var(--border));
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  }

  .view {
    min-height: calc(100dvh - 118px);
    padding: 0;
    border-radius: 0;
  }

  #dashboardView {
    min-height: calc(100dvh - 118px);
    align-items: stretch;
    place-items: stretch;
  }

  .home-ai-shell {
    min-height: calc(100dvh - 136px);
    width: 100%;
    align-content: stretch;
    grid-template-rows: 1fr auto auto;
    gap: 18px;
    padding: 20px 0;
  }

  .home-hero {
    align-content: center;
    min-height: 42dvh;
  }

  .home-hero h1 {
    font-size: clamp(34px, 9vw, 48px);
    line-height: 1.18;
  }

  .home-examples {
    display: none;
  }

  .home-chat-form {
    margin: 0;
    border-radius: 24px;
    padding: 10px;
  }

  .home-chat-form textarea {
    min-height: 54px;
    font-size: 16px;
  }

  .home-send-btn {
    width: 56px;
    height: 56px;
    border-radius: 18px !important;
  }

  .home-chat-tools,
  .home-chat-state {
    display: none;
  }

  .inbox-source-grid,
  .marketing-data-upload,
  #marketingView .marketing-data-upload,
  .config-cols,
  .settings-summary,
  .message-center,
  .notes-shell,
  .analysis-layout,
  .kb-workspace-grid {
    grid-template-columns: 1fr;
  }

  .inbox-panel,
  .message-list-panel,
  .message-detail-panel,
  .kb-file-section,
  .settings-hero,
  .settings-config-card,
  .settings-summary-card {
    padding: 18px !important;
    border-radius: 22px !important;
  }

  .inbox-copy h3,
  .message-center-head h3,
  .thoughts-hero h2,
  .kb-title-wrap h2 {
    font-size: 30px;
    line-height: 1.15;
  }

  .inbox-source-card,
  .marketing-upload {
    min-height: 170px;
    border-radius: 22px !important;
    padding: 22px;
  }

  .inbox-actions .primary,
  .inbox-actions .secondary,
  .button-row .primary,
  .button-row .secondary {
    width: 100%;
    min-height: 52px;
    font-size: 17px;
  }

  .message-center {
    gap: 18px;
  }

  .message-center-head {
    align-items: flex-start;
  }

  .message-list {
    max-height: none;
  }

  .message-list-item {
    min-height: 96px;
    border-radius: 18px;
    padding: 16px;
  }

  .message-detail-content {
    max-height: none;
  }

  .workspace-files,
  .thought-list,
  #marketingFiles {
    grid-template-columns: 1fr;
  }

  .thought-controls {
    grid-template-columns: 1fr;
  }

  .kb-chat-dock:not(.hidden) {
    width: min(96vw, 520px);
  }

  #marketingAnalysisDock.kb-chat-dock:not(.hidden) {
    width: 100vw;
  }

  .kb-chat-dock:not(.hidden)::before {
    inset: 0 min(96vw, 520px) 0 0;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
  }

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

  .home-ai-shell {
    padding: 0;
    min-height: 520px;
  }

  .home-hero h1 {
    font-size: 38px;
  }

  .home-examples,
  .home-chat-tools,
  .kb-composer-bar,
  .kb-header,
  .kb-section-head,
  .message-center-head,
  .message-detail-head,
  .settings-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .message-head-actions {
    justify-content: stretch;
  }

  .message-head-actions select,
  .message-head-actions button {
    width: 100%;
  }

  .kb-chat-dock:not(.hidden) {
    width: 100vw;
    padding: 16px;
  }

  #marketingAnalysisDock.kb-chat-dock:not(.hidden) {
    width: 100vw;
  }

  .kb-chat-dock:not(.hidden)::before {
    display: none;
  }
}

#todosView .note-folder-content:not(.hidden) {
  display: block !important;
  overflow: visible !important;
}

#todosView .note-folder-notes {
  display: block !important;
}

#todosView .note-folder-notes .note-item,
#todosView .note-item {
  color: #0f172a !important;
}

#todosView .note-folder-notes .note-open,
#todosView .note-item .note-open {
  color: #0f172a !important;
}

#todosView .note-folder-notes .note-open .note-card-title-line,
#todosView .note-item .note-open .note-card-title-line {
  display: grid !important;
  grid-template-columns: minmax(72px, 1fr) auto !important;
  align-items: baseline !important;
  gap: 6px !important;
  width: 100% !important;
  min-width: 0 !important;
  color: #0f172a !important;
}

#todosView .note-folder-notes .note-open .note-card-title-line strong,
#todosView .note-item .note-open .note-card-title-line strong {
  display: block !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  color: #0f172a !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  overflow-wrap: normal !important;
}

#todosView .note-folder-notes .note-open .note-card-title-line small,
#todosView .note-item .note-open .note-card-title-line small {
  display: block !important;
  min-width: 0 !important;
  max-width: 112px !important;
  color: #94a3b8 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
