:root {
  --ink: #0b1220;
  --muted: #6b7280;
  --surface: #ffffff;
  --accent: #0ea5e9;
  --accent-dark: #0284c7;
  --bg: radial-gradient(circle at top, #e2e8f0, #f8fafc);
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
  --radius: 18px;
  --font: "Space Grotesk", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.page {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.brand {
  font-size: 20px;
  font-weight: 600;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav a {
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
}

.nav a.active {
  background: rgba(14, 165, 233, 0.25);
  color: #fff;
}

.content {
  padding: 40px clamp(24px, 4vw, 60px);
  min-width: 0;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  min-width: 0;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.form {
  display: grid;
  gap: 16px;
}

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

.form input,
.form textarea,
.form select {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  font-family: var(--font);
}

.form input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
}

.textarea-lg {
  min-height: 160px;
}

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

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.help-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.copy-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-field input {
  flex: 1;
  min-width: 0;
}

.btn {
  padding: 12px 18px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.btn.secondary {
  background: #0f172a;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid #e2e8f0;
}

.btn.ghost:hover {
  background: #f8fafc;
}

.btn.danger {
  background: #dc2626;
}

.btn.danger:hover {
  background: #b91c1c;
}

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

.auth-card {
  width: min(420px, 92vw);
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-header {
  margin-bottom: 24px;
}

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

.inbox-filters {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.inbox-filters label {
  display: grid;
  gap: 6px;
}

.assignment-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assignment-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.assignment-pill.unassigned {
  background: #f1f5f9;
  color: #64748b;
}

.assignment-pill.assigned {
  background: #dcfce7;
  color: #166534;
}

.message-status.is-sent {
  color: #94a3b8;
}

.message-status.is-delivered {
  color: #16a34a;
  font-weight: 600;
}

.message-status.is-failed {
  color: #dc2626;
  font-weight: 600;
}

.outbound-failure-detail {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  line-height: 1.4;
}

.outbound-failure-row {
  color: #b91c1c;
  font-weight: 600;
}

.message-body-line {
  display: inline;
}

.message-author {
  display: inline-flex;
  margin-left: 6px;
  margin-right: 4px;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.message-reply-btn {
  margin-left: 8px;
  border: 0;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 0;
}

.message-reply-btn:hover {
  text-decoration: underline;
}

.message-quote,
.reply-target-bar,
.ai-draft-note {
  border-left: 3px solid #cbd5e1;
  color: #475569;
  font-size: 13px;
}

.message-quote {
  margin: 4px 0;
  padding-left: 8px;
}

.reply-target-bar {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 6px 0 8px;
  padding: 6px 0 6px 8px;
}

.ai-draft-note {
  margin-top: 8px;
  padding-left: 8px;
}


.pill {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.ai-toggle {
  border: none;
  cursor: pointer;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.icon-btn:hover {
  transform: translateY(-1px) scale(1.03);
  border-color: rgba(14, 165, 233, 0.5);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

.icon-btn:active {
  transform: translateY(0) scale(0.98);
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.ai-on {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.35);
}

.icon-btn.ai-off {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.35);
}

.ai-mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
}

.segmented-control-2 {
  grid-template-columns: repeat(2, minmax(84px, 1fr));
}

.segmented-option {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid #e2e8f0;
  background: transparent;
  color: #475569;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.segmented-option:last-child {
  border-right: 0;
}

.segmented-option.active {
  background: #0f172a;
  color: #ffffff;
}

.ai-mode-select {
  min-width: 86px;
  height: 34px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0 28px 0 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.ai-mode-timeout {
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ai-draft-panel {
  display: grid;
  gap: 10px;
  border: 1px solid #bae6fd;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f0f9ff;
}

.ai-draft-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-draft-content {
  white-space: pre-wrap;
  line-height: 1.5;
}

.ai-draft-guidance-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.ai-draft-guidance {
  width: 100%;
  resize: vertical;
  min-height: 58px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.ai-draft-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-draft-undo {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  font-size: 13px;
}

#bulk-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 44px;
  padding: 8px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  min-width: 160px;
  z-index: 10;
}

#bulk-menu.open {
  display: block;
}

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: #0f172a;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.menu-item:hover {
  background: rgba(15, 23, 42, 0.06);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #111827;
  color: #f9fafb;
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
  position: relative;
  width: min(440px, calc(100% - 32px));
  background: #ffffff;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.modal-dialog h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.modal-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions .btn {
  min-width: 96px;
}

.toast .btn.secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #f9fafb;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.row-ai {
  background: #f8fafc;
}

.row-human {
  background: #fff7ed;
}

tr[data-conversation-id] {
  cursor: pointer;
}

tr[data-conversation-id]:hover {
  box-shadow: inset 0 0 0 9999px rgba(15, 23, 42, 0.04);
}

tr.row-unread {
  box-shadow: inset 3px 0 0 #2563eb;
  background: #f0f7ff;
}

tr.row-unread td {
  font-weight: 700;
}

tr.row-unread td.meta {
  font-weight: 600;
  color: #0f172a;
}

tr.row-unread td:first-child {
  position: relative;
  padding-left: 28px;
}

tr.row-unread td:first-child::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2563eb;
  transform: translateY(-50%);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fee2e2;
  color: #991b1b;
  margin-bottom: 16px;
}

.alert.success {
  background: #dcfce7;
  color: #166534;
}

.row-link {
  cursor: pointer;
}

.row-link:hover {
  background: #f8fafc;
}

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

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

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #e2e8f0;
  margin: 16px 0 20px;
  overflow-x: auto;
}

.tab {
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--ink);
  border-color: var(--accent);
}

.tabs-primary {
  margin-top: 8px;
}

.tabs-secondary {
  margin-top: -8px;
}

.hidden {
  display: none;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.settings-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.settings-status {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.settings-status__label {
  font-size: 12px;
  color: var(--muted);
}

.settings-status__value {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
}

.settings-status__meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: #94a3b8;
}

.status-dot.ok,
.status-pill.ok {
  background: #dcfce7;
  color: #166534;
}

.status-dot.ok {
  background: #16a34a;
}

.status-dot.warn,
.status-pill.warn {
  background: #fef3c7;
  color: #92400e;
}

.status-dot.warn {
  background: #f59e0b;
}

.status-dot.neutral,
.status-pill.neutral {
  background: #e2e8f0;
  color: #475569;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.settings-section {
  padding: 18px 0;
  border-top: 1px solid #e2e8f0;
}

.danger-zone {
  border-top-color: #fecaca;
  background: #fff7f7;
  margin-top: 18px;
  padding: 18px;
  border-radius: 8px;
}

.delete-confirmation {
  max-width: 520px;
}

.section-save-actions {
  margin-top: 18px;
}

.kb-rebuild-section {
  margin-top: 8px;
  padding: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.kb-rebuild-section .section-heading {
  align-items: center;
  margin-bottom: 0;
}

.kb-rebuild-section form {
  margin: 0;
}

.tab-panel > .settings-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.waha-session-list {
  display: grid;
  gap: 18px;
}

.channel-status-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 14px;
  padding: 12px 14px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f8fafc;
}

.channel-status-banner .status-dot {
  margin-top: 5px;
}

.channel-status-banner strong {
  display: block;
  font-size: 15px;
}

.channel-status-banner .meta {
  margin: 3px 0 0;
}

.channel-setup-panel {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fbfdff;
}

.setup-step-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.setup-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.setup-step__state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.setup-step.done .setup-step__state {
  background: #dcfce7;
  color: #166534;
}

.setup-step.pending .setup-step__state {
  background: #fef3c7;
  color: #92400e;
}

.setup-step__label,
.setup-step__detail {
  display: block;
}

.setup-step__label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.setup-step__detail {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.waha-session-block {
  padding: 18px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #ffffff;
}

.waha-session-block:nth-child(even) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.waha-add-session {
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #fbfdff;
}

.waha-session-heading {
  align-items: center;
}

.waha-health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.waha-health-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.waha-health-item strong {
  font-size: 14px;
}

.waha-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}

.waha-grid > div {
  min-width: 0;
}

.waha-check {
  margin-top: 10px;
}

.waha-check-list {
  display: grid;
  gap: 10px;
  padding: 10px 0 0;
}

.waha-actions {
  margin-top: 16px;
}

.waha-session-actions {
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.subsection-title {
  margin: 0;
  font-size: 15px;
}

.source-entry-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 14px;
}

.radio-toggle-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.radio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.radio-toggle input {
  width: 16px;
  height: 16px;
}

.source-entry-panel {
  display: block;
}

.source-entry-panel.hidden {
  display: none;
}

.settings-disclosure {
  border-top: 1px solid #e2e8f0;
  padding: 16px 0;
}

.settings-disclosure summary {
  cursor: pointer;
  font-weight: 600;
}

.settings-disclosure .settings-section {
  border-top: 0;
  padding: 16px 0 0;
}

.entity-create-form {
  margin-top: 12px;
}

.entity-create-form > .settings-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.entity-form-actions,
.inline-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.entity-form-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.inline-actions {
  margin-top: 10px;
}

.bulk-selection-actions {
  justify-content: space-between;
  margin: 12px 0;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inline-form select {
  width: auto;
  min-width: 130px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  font-family: var(--font);
}

.table-scroll {
  margin-top: 12px;
  overflow: auto;
}

.transfer-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.transfer-panel.hidden {
  display: none;
}

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

.transfer-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.18s ease;
}

.transfer-list {
  display: grid;
  gap: 8px;
}

.transfer-row {
  display: grid;
  gap: 6px;
}

.transfer-row__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.transfer-row__name {
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-row__state {
  color: var(--muted);
  white-space: nowrap;
}

.transfer-row.is-complete .progress-bar {
  background: #16a34a;
}

.transfer-row.is-error .progress-bar {
  background: #dc2626;
}

.transfer-row.is-error .transfer-row__state {
  color: #991b1b;
}

.file-list {
  margin-top: 16px;
}

.file-list-actions {
  margin-bottom: 10px;
}

.file-list ul {
  list-style: none;
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.file-row-main {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.kb-file-name {
  overflow-wrap: anywhere;
}

.entity-cards {
  display: none;
  gap: 12px;
  margin-top: 18px;
}

.entity-card {
  display: block;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.entity-card.empty {
  text-align: center;
  color: var(--muted);
}

.entity-card__title {
  font-weight: 600;
  margin-bottom: 6px;
}

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

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.pagination.top-right {
  margin-top: 8px;
}

.pagination.gmail .page-range {
  font-size: 12px;
  color: var(--muted);
}

.pagination.gmail .per-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pagination.gmail .per-page label {
  font-size: 12px;
  color: var(--muted);
}

.pagination.gmail .per-page select {
  height: 28px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 0 26px 0 10px;
  font-size: 12px;
  background: #fff;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 14px) 11px, calc(100% - 9px) 11px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.page-link.icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: var(--ink);
}

.page-link.icon .icon {
  width: 18px;
  height: 18px;
}

.page-link.icon.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.empty-state {
  border: 1px dashed #cbd5f5;
  padding: 20px;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--muted);
}

.code-block {
  margin-top: 10px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
}

.code-block code {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

@media (max-width: 860px) {
  .page {
    grid-template-columns: 1fr;
  }
  .sidebar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 18px;
  }
  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav a {
    padding: 8px 12px;
    font-size: 14px;
  }

  .content {
    padding: 24px 16px;
  }

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

  .entity-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

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

  .kb-rebuild-section .section-heading {
    align-items: flex-start;
  }

  .kb-rebuild-section form,
  .kb-rebuild-section .btn {
    width: 100%;
  }

  .waha-heading-actions,
  .waha-session-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .waha-health-grid,
  .waha-grid {
    grid-template-columns: 1fr;
  }

  .source-entry-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .entity-form-actions {
    justify-content: flex-start;
  }

  .file-list li {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-wrap {
    display: none;
  }

  .entity-cards {
    display: grid;
  }
}
