:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --line: #dbe3f0;
  --line-strong: #c8d4e7;
  --text: #1f3153;
  --muted: #6f83a6;
  --accent: #4b82f0;
  --accent-strong: #2f64cf;
  --accent-soft: #edf3ff;
  --theme-soft: #f3ebff;
  --theme-text: #8b5cf6;
  --danger-soft: #fff1ef;
  --danger-text: #e15b4e;
  --shadow: 0 20px 50px rgba(40, 75, 140, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(75, 130, 240, 0.09), transparent 24%),
    linear-gradient(180deg, #fbfdff, var(--bg));
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

code {
  background: #eef4ff;
  border-radius: 6px;
  padding: 2px 6px;
}

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

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

button,
.secondary-link {
  border: none;
  border-radius: 16px;
  padding: 12px 18px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

button:hover,
.secondary-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(75, 130, 240, 0.18);
}

button:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

button.secondary {
  background: #fff;
  color: var(--accent-strong);
  border: 1px solid var(--line);
}

.secondary-link {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 28px 32px 20px;
}

.topbar h1 {
  margin: 6px 0 0;
  font-size: 30px;
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.ws-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: normal;
  text-transform: none;
  font-weight: 500;
  vertical-align: middle;
}

.ws-status::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.ws-status-unknown {
  background: #f2f5fa;
  color: var(--muted);
}
.ws-status-unknown::before {
  background: var(--line-strong);
}

.ws-status-connected {
  background: #eefdf4;
  color: #0b7b43;
}
.ws-status-connected::before {
  background: #10b981;
}

.ws-status-disconnected {
  background: #fff1ef;
  color: #e15b4e;
}
.ws-status-disconnected::before {
  background: #ef4444;
}

.ws-status-disabled {
  background: #f9fafb;
  color: #9ca3af;
}
.ws-status-disabled::before {
  background: #d1d5db;
}

.topnav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.topnav a {
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
}

.topnav a.active {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(200, 212, 231, 0.9);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

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

.hidden {
  display: none !important;
}

.banner {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff5e9;
  color: #9b6110;
  line-height: 1.6;
}

.banner.error {
  background: #fdeeee;
  color: #9e3d3d;
}

.empty-state {
  padding: 30px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 24px;
  color: var(--muted);
  background: rgba(247, 250, 255, 0.9);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 999px;
  background: #eef4ff;
  padding: 4px 10px;
}

.tag.subtle {
  background: #f2f5fa;
}

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

.detail-form label {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.chat-shell,
.workspace-shell {
  padding: 0 32px 32px;
}

.chat-panel {
  padding: 22px;
}

.plain-list {
  padding-left: 18px;
  color: var(--muted);
}

.chat-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.chat-shell {
  display: block;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 160px);
  max-width: 1200px;
  margin: 0 auto;
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-bottom: 24px;
}

.message {
  max-width: 880px;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #fff;
}

.message.user {
  align-self: flex-end;
  background: #edf4ff;
}

.message.assistant {
  background: #fff;
}

.message h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.record-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  margin-top: 10px;
  background: rgba(247, 250, 255, 0.95);
}

.record-card strong {
  display: block;
  margin-bottom: 6px;
  line-height: 1.5;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.record-card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.chat-sticky {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0 -22px -22px;
  padding: 12px 22px 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(246, 248, 252, 0.92) 12%, rgba(246, 248, 252, 0.98));
  backdrop-filter: blur(6px);
}

.chat-shortcut-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.shortcut-inline-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  flex: 1;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.shortcut-inline-list::-webkit-scrollbar {
  display: none;
}

.shortcut-pill {
  min-height: 38px;
  padding: 8px 14px;
  text-align: left;
  white-space: nowrap;
  flex-shrink: 0;
}

.icon-btn.manage-shortcuts-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  flex-shrink: 0;
}

.icon-btn.manage-shortcuts-btn:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
  box-shadow: none;
  transform: none;
}

.slash-suggestions {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 32px rgba(43, 72, 130, 0.12);
}

.slash-suggestion-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.slash-suggestion-item span {
  color: var(--muted);
  font-size: 13px;
}

.slash-suggestion-item.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.slash-suggestion-item:hover,
.slash-suggestion-item.active:hover {
  box-shadow: none;
  transform: none;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 12px;
}

.composer-chat {
  align-items: end;
}

.composer-chat textarea {
  min-height: 88px;
}

.shortcut-editor-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.shortcut-editor-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.shortcut-remove-btn {
  padding-left: 16px;
  padding-right: 16px;
}

.workspace-surface {
  padding: 22px;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 14px;
}

.workspace-title {
  font-size: 24px;
  font-weight: 700;
}

.workspace-subtitle {
  margin-top: 4px;
  line-height: 1.5;
}

.filter-block {
  margin-top: 14px;
}

.search-block {
  margin-top: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.search-box input {
  border: none;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
}

.search-box input:focus {
  outline: none;
}

.search-icon {
  font-size: 22px;
  color: var(--muted);
  line-height: 1;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip-row-theme {
  max-height: 188px;
  overflow-y: auto;
  align-content: flex-start;
  padding-right: 4px;
}

.filter-chip {
  min-height: 42px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 15px;
  box-shadow: none;
}

.filter-chip.soft {
  background: #f6f1ff;
  border-color: #e0d2ff;
  color: var(--theme-text);
}

.filter-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.filter-chip.soft.active {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: #fff;
}

.workspace-meta {
  margin-top: 12px;
  margin-bottom: 12px;
}

.workspace-groups {
  display: grid;
  gap: 16px;
}

.category-group,
.theme-group {
  border: none;
}

.group-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.group-summary::-webkit-details-marker {
  display: none;
}

.category-summary {
  background: var(--panel-soft);
  border: 1px solid #edf3fb;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 700;
}

.theme-summary {
  padding: 18px 10px 12px;
  font-size: 17px;
  font-weight: 700;
}

.summary-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.summary-icon {
  color: var(--accent);
  font-size: 18px;
}

.summary-icon.theme {
  color: var(--theme-text);
}

.summary-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef3fb;
  color: var(--text);
  font-weight: 600;
}

.summary-arrow {
  color: var(--muted);
  transition: transform 160ms ease;
}

details[open] > .group-summary .summary-arrow {
  transform: rotate(180deg);
}

.record-card-list {
  display: grid;
  gap: 18px;
  padding: 0 0 0 34px;
}

.record-card-item {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px 24px 18px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(49, 93, 170, 0.05);
}

.record-card-item.editing {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(75, 130, 240, 0.12);
}

.card-content {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  word-break: break-word;
}

.card-content.expanded {
  display: block;
  white-space: pre-wrap;
  overflow: visible;
}

.text-link {
  margin-top: 10px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 600;
  box-shadow: none;
}

.text-link:hover {
  transform: none;
  box-shadow: none;
  text-decoration: underline;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.theme-pill,
.card-note {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}

.theme-pill {
  background: var(--theme-soft);
  color: var(--theme-text);
}

.card-note {
  background: #eef3fb;
  color: var(--muted);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.card-date {
  font-size: 15px;
}

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

.card-action-btn {
  padding: 10px 18px;
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--line);
  box-shadow: none;
}

.card-action-btn:hover {
  box-shadow: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  background: rgba(19, 36, 67, 0.35);
  backdrop-filter: blur(4px);
}

.modal-panel {
  width: min(780px, 100%);
  max-height: calc(100vh - 80px);
  overflow: auto;
  background: #fff;
  border-radius: 28px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(26, 48, 94, 0.18);
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
}

.modal-form {
  margin-top: 18px;
}

.icon-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  background: #f2f6fd;
  color: var(--muted);
  box-shadow: none;
}

.icon-close:hover {
  box-shadow: none;
}

.modal-actions {
  margin-top: 8px;
}

@media (max-width: 900px) {
  .topbar,
  .chat-shell,
  .workspace-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

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

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

  .chat-sticky {
    margin-left: -18px;
    margin-right: -18px;
    margin-bottom: -18px;
    padding-left: 18px;
    padding-right: 18px;
    padding-bottom: 18px;
  }

  .chat-shortcut-toolbar {
    /* 移除 flex-direction: column 以保持水平排布 */
  }

  .workspace-surface {
    padding: 18px;
    border-radius: 24px;
  }

  .workspace-header {
    flex-direction: column;
    align-items: stretch;
  }

  .record-card-list {
    padding-left: 0;
  }

  .card-footer {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .modal-panel {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    padding: 18px;
  }
}

/* NEW WORKSPACE LAYOUT STYLES */
.workspace-top-filter {
  padding: 0 32px 16px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.workspace-top-filter::-webkit-scrollbar {
  display: none;
}

.workspace-layout {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  max-width: 1400px;
  margin: 0 auto;
}

.workspace-sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding-top: 8px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-title {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}

.workspace-main {
  flex: 1;
  min-width: 0;
  padding: 24px;
}

.workspace-surface {
  padding: 22px;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.workspace-title {
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.workspace-count {
  font-size: 14px;
  font-weight: 400;
}

.workspace-subtitle {
  display: none; /* Hide old subtitle, use inline count instead */
}

.compact-btn {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.search-box.compact {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.search-box.compact input {
  font-size: 14px;
}

.search-box.compact .search-icon {
  font-size: 18px;
  color: #9ca3af;
}

.chip-row-category {
  flex-wrap: nowrap;
  gap: 8px;
  padding-bottom: 4px;
}

.chip-row-category .filter-chip {
  min-height: 34px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.chip-row-category .filter-chip:hover {
  background: #f9fafb;
}

.chip-row-category .filter-chip.active {
  background: #006fee;
  border-color: #006fee;
  color: #fff;
}

.chip-row-theme.compact {
  max-height: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-row-theme.compact .filter-chip {
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  background: transparent;
  color: #3b82f6;
  font-size: 12px;
  font-weight: 500;
}

.chip-row-theme.compact .filter-chip:hover {
  background: #f3f4f6;
}

.chip-row-theme.compact .filter-chip.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

/* Fix for subtitle */
.workspace-subtitle {
  display: inline-block !important;
  font-size: 13px !important;
  color: #6b7280;
  margin-top: 0 !important;
  font-weight: normal;
}

/* Responsive layout for the workspace */
@media (max-width: 900px) {
  .workspace-layout {
    flex-direction: column;
    gap: 16px;
  }
  .workspace-sidebar {
    width: 100%;
  }
  .workspace-top-filter {
    padding: 0 16px 16px;
  }
}

/* Compact Record Card Styles */
.record-card-list {
  display: grid;
  gap: 8px; /* Extra tight gap */
  padding: 0 0 0 16px; /* Indent */
}

.record-card-item {
  position: relative; /* For absolute floating actions */
  border: 1px solid var(--line);
  border-radius: 10px; /* Reduced from 12px */
  padding: 10px 12px; /* Super tight padding */
  background: #fff;
  box-shadow: 0 1px 4px rgba(49, 93, 170, 0.02); /* Lighter shadow */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.record-card-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 3px 8px rgba(49, 93, 170, 0.05);
}

.card-content {
  position: relative;
  font-size: 14px; /* Reduced to fit inline badges nicely */
  line-height: 1.5;
  color: var(--text);
  padding-right: 48px; /* Space for the floating edit button */
  min-height: 21px; /* Ensure one line height minimum */
}

.record-card-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(49, 93, 170, 0.06);
}

.card-content {
  font-size: 14px; /* Reduced to fit inline badges nicely */
  line-height: 1.6;
  color: var(--text);
  padding-right: 50px; /* Leave space for the floating edit button */
  display: block;
}

.card-text-span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  margin-bottom: 0;
}

.card-content:not(.expanded) .card-text-span {
  padding-right: 120px; /* 缩小预留给右侧标签和时间的空间 */
}

.card-content.expanded .card-text-span {
  display: inline;
  -webkit-line-clamp: unset;
  overflow: visible;
  white-space: pre-wrap;
  padding-right: 0;
}

.card-inline-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  vertical-align: middle;
  margin-left: 8px;
}

.card-content {
  position: relative;
  font-size: 14px; /* Reduced to fit inline badges nicely */
  line-height: 1.5;
  color: var(--text);
  padding-right: 48px; /* Space for the floating edit button */
  min-height: 21px; /* Ensure one line height minimum */
}

.card-content:not(.expanded) .card-inline-meta {
  position: absolute;
  bottom: 0;
  right: 48px; /* 对齐到文本内容区的右侧边界 */
  justify-content: flex-end;
  background: transparent;
  max-width: 120px; /* 不超过预留的空间 */
}

.card-content.expanded .card-inline-meta {
  position: relative;
  bottom: auto;
  right: auto;
  margin-top: 4px;
}

/* 展开按钮，绝对定位贴紧截断内容 */
.card-content:not(.expanded) .inline-expand-btn {
  position: absolute;
  bottom: 0;
  right: 168px; /* 48px(容器padding) + 120px(文字padding) = 168px */
  background: #fff; /* 遮盖底部截断痕迹 */
  padding: 0 4px;
  margin: 0;
  box-shadow: -4px 0 6px #fff; /* 柔和过渡 */
  z-index: 5;
}

.card-content.expanded .inline-expand-btn {
  display: inline-block;
  margin-left: 12px;
  position: relative;
}

.card-content.expanded .card-text-span {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  white-space: pre-wrap;
  margin-bottom: 4px;
}

.card-inline-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  vertical-align: middle;
  margin-left: 8px;
  position: relative;
  top: -1px;
}

/* For non-expanded state, we position the meta to the bottom right of the container
   to make it perfectly append to the clamped text */
.card-content {
  position: relative;
  min-height: 22px; /* Ensure one line height minimum */
}

.card-content:not(.expanded) .card-inline-meta {
  position: absolute;
  bottom: 0;
  right: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 15%, #fff 100%);
  padding-left: 24px;
  line-height: 1.4;
}

/* Ensure expanded meta stays inline normally */
.card-content.expanded .card-inline-meta {
  display: inline-flex;
  margin-top: 4px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0; /* Override old margin */
}

.theme-pill,
.card-note {
  padding: 4px 10px;
  border-radius: 6px; /* Squarer look */
  font-size: 12px;
  font-weight: 500;
}

.inline-pill {
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 4px;
  line-height: 1;
}

.inline-date {
  font-size: 11px;
  color: #9ca3af;
  margin-left: 2px;
}

.inline-expand-btn {
  font-size: 12px;
  padding: 0;
  margin: 0;
  color: var(--accent);
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}
.inline-expand-btn:hover {
  color: var(--accent-strong);
}

.card-date {
  font-size: 12px; /* Smaller date */
  color: #9ca3af;
}

/* Floating Actions */
.card-actions-floating {
  position: absolute;
  top: 8px;
  right: 10px;
  opacity: 0;
  transform: translateY(-2px);
  transition: all 0.2s ease;
  z-index: 10;
}

.record-card-item:hover .card-actions-floating,
.record-card-item.editing .card-actions-floating {
  opacity: 1;
  transform: translateY(0);
}

.card-action-btn.compact-btn {
  padding: 4px 12px;
  font-size: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  border-radius: 6px;
}

.card-action-btn.compact-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Hide old footer classes just in case they exist somewhere else */
.card-footer {
  display: none;
}

/* Override existing expanded content padding issue */
.card-content.expanded {
  margin-bottom: 12px;
}

/* Adjust text link size */
.text-link {
  font-size: 13px;
  margin-top: 4px;
}

/* =========================================================
   EXTRA COMPACT UI OVERRIDES
   ========================================================= */

/* 1. Top Bar Compression */
.topbar {
  padding: 12px 32px 12px !important;
  align-items: center !important;
}
.topbar h1 {
  font-size: 24px !important;
  margin: 2px 0 0 !important;
}
.eyebrow {
  font-size: 11px !important;
}
.topnav a {
  padding: 6px 14px !important;
  font-size: 14px !important;
}

/* 2. Category Filter Row Compression */
.workspace-top-filter {
  padding: 0 32px 8px !important;
  margin-bottom: 8px !important;
}
.chip-row-category .filter-chip {
  min-height: 28px !important;
  padding: 4px 14px !important;
  font-size: 13px !important;
}

/* 3. Main Content Panel Compression */
.workspace-shell {
  padding: 0 32px 16px !important;
}
.workspace-main {
  padding: 12px 18px !important;
}
.workspace-header {
  margin-bottom: 12px !important;
  align-items: center !important;
}
.workspace-title {
  font-size: 18px !important;
  margin: 0 !important;
}

/* 4. Group Summary Compression (Accordion headings) */
.group-summary {
  padding: 8px 12px !important;
}
.category-summary {
  font-size: 15px !important;
  border-radius: 12px !important;
}
.theme-summary {
  padding: 6px 8px 4px !important;
  font-size: 14px !important;
}
.summary-count {
  min-width: 32px !important;
  padding: 2px 8px !important;
  font-size: 12px !important;
}
.summary-icon {
  font-size: 14px !important;
}
.summary-main {
  gap: 8px !important;
}

/* 5. Button and Layout Tweaks */
.compact-btn {
  padding: 6px 12px !important;
  font-size: 13px !important;
}
.record-card-list {
  padding: 0 0 0 12px !important; /* Move cards slightly more left */
  gap: 8px !important; /* Tighter card spacing */
}
.workspace-groups {
  gap: 8px !important; /* Tighter group spacing */
}
