/* ===================================================================
   Hotel AI Insight — Dashboard Stylesheet
   =================================================================== */

:root {
  /* Colors — neutral */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Brand */
  --primary: #6366f1;
  --primary-dk: #4f46e5;
  --primary-lt: #e0e7ff;

  /* Semantic */
  --green: #16a34a;
  --green-lt: #dcfce7;
  --teal: #0d9488;
  --teal-lt: #ccfbf1;
  --orange: #f97316;
  --orange-lt: #ffedd5;
  --red: #dc2626;
  --red-lt: #fee2e2;
  --blue: #2563eb;
  --blue-lt: #dbeafe;
  --purple: #7c3aed;
  --purple-lt: #ede9fe;
  --cyan: #0891b2;

  /* Layout */
  --sidebar-w: 230px;
  --topbar-h: 0px;
  --radius: 8px;
  --radius-sm: 4px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  border-bottom: 1px solid var(--gray-700);
}
.brand-icon {
  font-size: 24px;
}
.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--gray-400);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
  background: var(--gray-800);
  color: #fff;
}
.nav-item.active {
  background: var(--primary);
  color: #fff;
}
.nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 18px;
  font-size: 12px;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-700);
  display: flex;
  align-items: center;
  gap: 8px;
}
.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-500);
  display: inline-block;
}
.health-dot.ok {
  background: var(--green);
}
.health-dot.err {
  background: var(--red);
}

/* ─── Main ─── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

.page-content {
  max-width: 1280px;
  margin: 0 auto;
}

/* ─── Page header ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
}

/* ─── Filters bar ─── */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

/* ─── Inputs ─── */
.input,
.select,
.textarea {
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--gray-800);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.input::placeholder {
  color: var(--gray-400);
}
.input:disabled,
.select:disabled {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
}
.input-sm {
  padding: 4px 8px;
  font-size: 12px;
}
.select-sm {
  padding: 4px 8px;
  font-size: 12px;
}
.textarea {
  resize: vertical;
  width: 100%;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dk);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}
.btn-secondary {
  background: #fff;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}
.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}
.btn-success {
  background: var(--green);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #15803d;
}

.btn-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--gray-500);
  line-height: 1;
}
.btn-close:hover {
  color: var(--gray-800);
}

/* ─── Tables ─── */
.table-wrap {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.table thead th {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}
.table tbody td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--gray-700);
  border-top: 1px solid var(--gray-100);
  vertical-align: middle;
}
.table tbody tr:hover {
  background: var(--gray-50);
}
.table tbody tr {
  cursor: default;
}

/* ─── Badges ─── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: capitalize;
  white-space: nowrap;
}

/* Status badges */
.badge-pending {
  background: var(--gray-200);
  color: var(--gray-600);
}
.badge-fetching {
  background: var(--blue-lt);
  color: var(--blue);
}
.badge-calculating {
  background: var(--blue-lt);
  color: var(--blue);
}
.badge-generating {
  background: var(--purple-lt);
  color: var(--purple);
}
.badge-emailing {
  background: var(--teal-lt);
  color: var(--teal);
}
.badge-done {
  background: var(--green-lt);
  color: var(--green);
}
.badge-failed {
  background: var(--red-lt);
  color: var(--red);
}

/* Email status */
.badge-queued {
  background: var(--gray-200);
  color: var(--gray-600);
}
.badge-sent {
  background: var(--blue-lt);
  color: var(--blue);
}
.badge-delivered {
  background: var(--green-lt);
  color: var(--green);
}
.badge-opened {
  background: var(--teal-lt);
  color: var(--teal);
}
.badge-bounced {
  background: var(--orange-lt);
  color: var(--orange);
}

/* Frequency badges */
.badge-monthly {
  background: var(--primary-lt);
  color: var(--primary);
}
.badge-weekly {
  background: var(--teal-lt);
  color: var(--teal);
}
.badge-both {
  background: var(--purple-lt);
  color: var(--purple);
}

/* Performance badges */
.badge-excellent {
  background: var(--green-lt);
  color: var(--green);
}
.badge-good {
  background: var(--teal-lt);
  color: var(--teal);
}
.badge-average {
  background: var(--gray-200);
  color: var(--gray-600);
}
.badge-below_average {
  background: var(--orange-lt);
  color: var(--orange);
}
.badge-critical {
  background: var(--red-lt);
  color: var(--red);
}

/* DB status pill */
.pill {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.pill-green {
  background: var(--green);
}
.pill-red {
  background: var(--red);
}
.pill-gray {
  background: var(--gray-400);
}

/* Active indicators */
.active-yes {
  color: var(--green);
  font-weight: 600;
}
.active-no {
  color: var(--gray-400);
}

/* ─── Summary bar ─── */
.summary-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.summary-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 12px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  min-width: 120px;
}
.summary-card .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.summary-card .value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 2px;
  color: var(--gray-800);
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 640px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
  animation: modalSlideUp 0.25s ease-out;
}
.modal-lg {
  width: 960px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
}
.modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  color: var(--gray-500);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover {
  background: var(--red-lt);
  border-color: var(--red);
  color: var(--red);
}
.modal-body {
  padding: 24px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: 0 0 12px 12px;
}

/* ─── Prompt editor grid ─── */
.prompt-editor-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
}
.prompt-editor-main label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin: 12px 0 4px;
}
.prompt-editor-main label:first-child {
  margin-top: 0;
}
.prompt-meta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.prompt-meta-row label {
  flex: 1;
  min-width: 140px;
}
.prompt-meta-row .input,
.prompt-meta-row .select {
  width: 100%;
  margin-top: 4px;
}

.prompt-editor-sidebar {
  border-left: 1px solid var(--gray-200);
  padding-left: 16px;
}
.prompt-editor-sidebar h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 10px;
}
.var-list {
  max-height: 460px;
  overflow-y: auto;
}
.var-item {
  font-size: 11px;
  font-family: "SFMono-Regular", Consolas, monospace;
  padding: 3px 6px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--primary);
  transition: background 0.1s;
}
.var-item:hover {
  background: var(--primary-lt);
}

/* ─── Prompt Preview modal ─── */
.modal-xl {
  width: 1100px;
}
.preview-info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--gray-600);
}
.preview-info-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.preview-info-text {
  font-size: 12px;
}
.preview-tabs {
  display: flex;
  gap: 2px;
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 3px;
  margin-bottom: 16px;
}
.preview-tab {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}
.preview-tab.active {
  background: #fff;
  color: var(--gray-900);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.preview-tab:hover:not(.active) {
  color: var(--gray-700);
}
.preview-tab-content {
  display: none;
}
.preview-tab-content.active {
  display: block;
}
.preview-code-block {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.preview-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
}
.preview-code {
  margin: 0;
  padding: 16px;
  font-size: 12.5px;
  line-height: 1.65;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  color: var(--gray-800);
  max-height: 460px;
  overflow-y: auto;
}
.preview-vars-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.preview-var-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
}
.preview-var-item .var-name {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  color: var(--primary);
  font-weight: 500;
}
.preview-var-item .var-value {
  font-size: 11px;
  color: var(--gray-600);
  text-align: right;
  max-width: 50%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Insight detail sections ─── */
.insight-section {
  margin-bottom: 16px;
}
.insight-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.insight-section p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--gray-700);
  white-space: pre-line;
}

.context-json {
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: monospace;
  font-size: 11px;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 12px;
}

/* ─── Loading / empty states ─── */
.loading-row td {
  text-align: center;
  color: var(--gray-400);
  padding: 40px !important;
}
.empty-row td {
  text-align: center;
  color: var(--gray-400);
  padding: 40px !important;
}

/* ─── Login screen ─── */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: linear-gradient(135deg, var(--gray-900) 0%, #1e1b4b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-screen.hidden {
  display: none;
}
.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px 36px 32px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
}
.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo {
  /* width: 56px; */
  height: 40px;
  object-fit: contain;
  margin-bottom: 4px;
}
.login-brand h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 8px 0 4px;
}
.login-brand p {
  font-size: 13px;
  color: var(--gray-500);
}
#login-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
}
#login-form .input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 16px;
}
.login-btn {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  justify-content: center;
}
.login-error {
  background: var(--red-lt);
  color: var(--red);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.btn-logout {
  margin-left: auto;
  background: none;
  border: 1px solid var(--gray-600);
  color: var(--gray-400);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.btn-logout:hover {
  background: var(--gray-700);
  color: #fff;
}

/* ─── Form grid (modern) ─── */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.form-section {
  border: none;
  padding: 0;
  margin: 0;
}
.form-section legend {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 16px 24px 10px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section legend .section-icon {
  font-size: 14px;
}
.form-section:first-of-type legend {
  border-top: none;
}
.form-section-body {
  padding: 16px 24px 4px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}
.form-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-row label .input,
.form-row label .select {
  font-weight: 400;
}
.form-row label .hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--gray-400);
  margin-top: -2px;
}
.form-row.single {
  grid-template-columns: 1fr;
}
.form-error {
  color: var(--red);
  font-size: 13px;
  padding: 10px 24px;
  background: var(--red-lt);
  border-radius: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-error::before {
  content: "⚠";
}

/* ─── Toggle switch (modern) ─── */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--gray-300);
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}
.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
input:checked + .slider {
  background-color: var(--primary);
}
input:checked + .slider::before {
  transform: translateX(20px);
}
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.toggle-row div strong {
  color: var(--gray-800);
  font-size: 14px;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--gray-700);
  padding: 4px 0;
}
.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  border-radius: 3px;
}

/* ─── Button variants ─── */
.btn-danger {
  background: var(--red);
  color: #fff;
  border: 1px solid var(--red);
}
.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}
.btn-success {
  background: var(--green);
  color: #fff;
  border: 1px solid var(--green);
}
.btn-success:hover {
  background: #059669;
  border-color: #059669;
}
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
}
.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}
.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--gray-800);
}

/* ─── Tabs bar (hotel detail) ─── */
.tabs-bar {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--gray-800);
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ─── Detail grid (hotel detail profile) ─── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.detail-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.detail-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-100);
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
}
.detail-row span:first-child {
  color: var(--gray-500);
  font-weight: 500;
}
.detail-row span:last-child {
  color: var(--gray-800);
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}
.detail-row a {
  color: var(--primary);
  text-decoration: none;
}
.detail-row a:hover {
  text-decoration: underline;
}

/* ─── Role badge ─── */
.badge-role {
  background: var(--gray-200);
  color: var(--gray-700);
}

/* ─── Insight section tabs ─── */
.insight-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.insight-tab-btn {
  background: none;
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.insight-tab-btn:hover {
  color: var(--gray-800);
}
.insight-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.insight-section-panel p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--gray-700);
  white-space: pre-line;
}
.insight-meta-bar {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 8px;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  .brand-text,
  .nav-item span:not(.nav-icon) {
    display: none;
  }
  .sidebar-footer span:not(.health-dot) {
    display: none;
  }
  .main {
    margin-left: 60px;
    padding: 16px;
  }
  .prompt-editor-grid {
    grid-template-columns: 1fr;
  }
  .prompt-editor-sidebar {
    border-left: none;
    border-top: 1px solid var(--gray-200);
    padding-left: 0;
    padding-top: 12px;
  }
  .modal-xl {
    width: 100%;
  }
  .preview-vars-grid {
    grid-template-columns: 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .tabs-bar {
    gap: 0;
  }
}
