/* Recruitr design system — ported from DesignSystem.swift */
:root {
  --bg-0: rgb(2, 6, 23);
  --bg-1: rgb(15, 23, 42);
  --sidebar-bg: rgba(2, 6, 23, 0.55);
  --panel: rgba(9, 15, 32, 0.88);
  --card: rgba(255, 255, 255, 0.05);
  --card-hover: rgba(255, 255, 255, 0.08);
  --card-border: rgba(255, 255, 255, 0.1);
  --card-border-hover: rgba(255, 255, 255, 0.15);
  --input-bg: rgba(255, 255, 255, 0.06);
  --input-border: rgba(255, 255, 255, 0.14);
  --divider: rgba(255, 255, 255, 0.05);

  --text-primary: #fff;
  --text-secondary: rgb(148, 163, 184);
  --text-tertiary: rgb(71, 85, 105);

  --blue-500: rgb(59, 130, 246);
  --blue-600: rgb(37, 99, 235);
  --emerald-500: rgb(16, 185, 129);
  --emerald-600: rgb(5, 150, 105);
  --cyan-500: rgb(6, 182, 212);
  --sky-500: rgb(14, 165, 233);
  --sky-600: rgb(2, 132, 199);
  --success: rgb(34, 197, 94);
  --warning: rgb(245, 158, 11);
  --danger: rgb(239, 68, 68);

  --grad-blue: linear-gradient(90deg, var(--blue-500), var(--blue-600));
  --grad-green: linear-gradient(90deg, var(--emerald-500), var(--emerald-600));
  --grad-sky: linear-gradient(90deg, var(--sky-500), var(--sky-600));
  --grad-brand: linear-gradient(135deg, var(--blue-500), var(--cyan-500));

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;

  --sidebar-width: 256px;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
  margin: 0;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: radial-gradient(ellipse at top left, #0f172a 0%, #020617 45%, #020617 100%);
  background-attachment: fixed;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button {
  font-family: inherit;
  color: inherit;
}

a {
  color: var(--sky-500);
}

/* ============ App shell ============ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  width: 100vw;
  transition: grid-template-columns 0.25s ease;
}
.app-shell.sidebar-hidden {
  grid-template-columns: 0 1fr;
}
.app-shell.sidebar-hidden .sidebar {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-20px);
}

.sidebar {
  position: relative;
  height: 100vh;
  background: var(--sidebar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s ease, transform 0.25s ease;
  overflow: hidden;
}

.sidebar-brand {
  padding-top: 22px;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  padding-bottom: 16px;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--grad-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
  flex-shrink: 0;
}
.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  flex: 1;
  min-width: 0;
}
.brand-title-main {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}
.brand-title-sub {
  font-size: 11px;
  color: var(--text-secondary);
}
.sidebar-divider {
  height: 1px;
  background: var(--divider);
  margin: 0 20px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover {
  background: var(--card-hover);
  color: var(--text-primary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 14px 0;
}
.nav-btn {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
}
.nav-btn:hover {
  color: var(--text-primary);
  background: var(--card);
}
.nav-btn.active {
  color: var(--text-primary);
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(6, 182, 212, 0.12));
  border-color: rgba(59, 130, 246, 0.28);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.08);
}
.nav-btn svg {
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-btn {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}
.settings-btn:hover {
  background: var(--card-hover);
  color: var(--text-primary);
}

.org-switcher {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--input-bg);
  color: var(--text-secondary);
  font-size: 12px;
}
.org-switcher .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.org-switcher select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  padding: 0;
}
.org-switcher .signed-in-as {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.org-switcher .signout {
  all: unset;
  cursor: pointer;
  font-size: 10px;
  color: var(--text-tertiary);
  text-decoration: underline;
}
.org-switcher .signout:hover { color: var(--text-secondary); }
.sidebar-footer-card {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.1);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(6, 182, 212, 0.05));
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}
.sidebar-footer-card strong {
  color: var(--text-secondary);
  font-weight: 500;
}
.sidebar-footer-card span {
  color: var(--text-tertiary);
}

.sidebar-peek {
  position: fixed;
  top: 24px;
  left: 8px;
  z-index: 40;
  width: 28px;
  height: 48px;
  border-radius: 0 8px 8px 0;
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-left: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sidebar-peek:hover {
  color: var(--text-primary);
}

/* ============ Main pane ============ */
.main-pane {
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  padding: 0;
}

/* ============ Surface components ============ */
.card {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.card.thin { padding: 18px; }
.card.compact { padding: 14px; }
.card.interactive {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.card.interactive:hover {
  border-color: var(--card-border-hover);
  background: var(--card-hover);
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.section-header .title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.section-header .subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.screen-header .screen-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(14, 165, 233, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: rgba(59, 130, 246, 0.9);
  flex-shrink: 0;
}
.screen-header h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}
.screen-header p {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.status-pill.client {
  background: rgba(16, 185, 129, 0.14);
  color: var(--emerald-500);
  border-color: rgba(16, 185, 129, 0.28);
}
.status-pill.candidate {
  background: rgba(59, 130, 246, 0.14);
  color: var(--blue-500);
  border-color: rgba(59, 130, 246, 0.28);
}
.status-pill.archived {
  background: rgba(148, 163, 184, 0.16);
  color: var(--text-tertiary, #94a3b8);
  border-color: rgba(148, 163, 184, 0.28);
}
.status-menu {
  position: relative;
  display: inline-flex;
}
button.status-menu-trigger {
  cursor: pointer;
  /* Keep the .status-pill background/border/padding/font; just neutralize
     the browser's default button chrome. */
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
button.status-menu-trigger:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}
.status-menu-caret {
  font-size: 10px;
  opacity: 0.75;
}
.status-menu-items {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 160px;
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm, 8px);
  padding: 4px;
  z-index: 20;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}
.status-menu.open .status-menu-items {
  display: block;
}
.status-menu-item {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-primary);
}
.status-menu-item:hover {
  background: var(--card-hover, rgba(255, 255, 255, 0.06));
}
.status-menu-item.selected {
  color: var(--blue-500);
}
.status-menu-check {
  font-size: 11px;
}
.status-pill.warning {
  background: rgba(245, 158, 11, 0.14);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.28);
}

/* ============ Buttons ============ */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-ghost,
.btn-gradient {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease, opacity 0.15s ease, background 0.15s ease, border 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
}
.btn-primary {
  background: var(--grad-blue);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: scale(0.98); }

.btn-gradient {
  padding: 14px 20px;
  font-size: 15px;
  width: 100%;
}
.btn-gradient.client { background: var(--grad-green); }
.btn-gradient.candidate { background: var(--grad-blue); }
.btn-gradient:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: var(--input-bg);
  border-color: var(--card-border);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: var(--card-hover);
  border-color: var(--card-border-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--card);
  color: var(--text-primary);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* ============ Inputs ============ */
.input,
.textarea,
.select {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(255, 255, 255, 0.08);
}
.textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}
.big-name-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--input-border);
  border-radius: 0;
  font-size: 24px;
  font-weight: 600;
  padding: 8px 0;
}
.big-name-input:focus {
  border-bottom-color: rgba(59, 130, 246, 0.8);
  background: transparent;
}

.search-input {
  font-size: 13px;
  padding: 10px 12px 10px 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgb(148,163,184)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 14px;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.field-row .hint {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Segmented control */
.segmented {
  display: inline-flex;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  all: unset;
  cursor: pointer;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  border-radius: 7px;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.segmented button.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(6, 182, 212, 0.2));
  color: var(--text-primary);
}
.segmented.full {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  width: 100%;
}

/* Checkbox */
.checkbox {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.checkbox:checked {
  background: var(--grad-brand);
  border-color: transparent;
}
.checkbox:checked::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* ============ Add screen ============ */
.add-screen {
  padding: 28px;
  min-height: 100%;
  display: flex;
  justify-content: center;
}
.add-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 470px));
  gap: 18px;
  width: 100%;
  max-width: 958px;
}
.add-grid > .span-2 { grid-column: span 2; }

@media (max-width: 900px) {
  .add-grid {
    grid-template-columns: 1fr;
  }
  .add-grid > .span-2 { grid-column: auto; }
}

.intake-row {
  display: flex;
  gap: 12px;
  font-size: 13px;
  align-items: flex-start;
}
.intake-row .label {
  flex: 0 0 82px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}
.intake-row .value {
  color: var(--text-primary);
  flex: 1;
  word-break: break-word;
}

/* File uploader */
.uploader {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.uploader-drop {
  border: 2px dashed var(--card-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.uploader-drop:hover,
.uploader-drop.drag-over {
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(59, 130, 246, 0.05);
}
.uploader-drop.has-files {
  border-style: solid;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.05);
}
.uploader-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(14, 165, 233, 0.12));
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: rgba(59, 130, 246, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}
.uploader-drop.has-files .uploader-icon {
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--success);
}
.uploader-label {
  font-size: 12px;
  font-weight: 600;
}
.uploader-hint {
  font-size: 10px;
  color: var(--text-secondary);
}
.uploader-supported {
  font-size: 9px;
  color: var(--text-tertiary);
}
.uploader-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.uploader-files {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}
.uploader-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
}
.uploader-file .file-chip {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(14, 165, 233, 0.12));
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: rgba(59, 130, 246, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.uploader-file .meta {
  flex: 1;
  min-width: 0;
}
.uploader-file .meta .name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uploader-file .meta .sub {
  font-size: 11px;
  color: var(--text-secondary);
}
.uploader-file button.remove {
  all: unset;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ View Records ============ */
.records-screen {
  display: grid;
  grid-template-columns: 320px 1fr;
  /* minmax(0, 1fr) keeps the row bounded to viewport height so the panes scroll
     internally instead of the row growing to fit the whole list. */
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
}
.records-list {
  border-right: 1px solid var(--divider);
  padding: 24px 20px;
  overflow-y: auto;
  background: rgba(2, 6, 23, 0.35);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.records-detail {
  padding: 24px 28px;
  overflow-y: auto;
}
@media (max-width: 900px) {
  .records-screen {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-rows: minmax(0, auto);
    height: auto;
    min-height: 100%;
  }
  .records-list {
    border-right: none;
    border-bottom: 1px solid var(--divider);
    max-height: 55vh;
  }
}

.records-section {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card);
  overflow: hidden;
  /* Don't let the section shrink inside the scrolling list flex column, or
     overflow:hidden clips the rows instead of the list scrolling. */
  flex-shrink: 0;
}
.records-section-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.records-section-header .count {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-secondary);
}
.records-section-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px 8px;
}
.record-row {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.15s ease;
  border: 1px solid transparent;
}
.record-row:hover {
  background: var(--card-hover);
}
.record-row.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), rgba(6, 182, 212, 0.08));
  border-color: rgba(59, 130, 246, 0.3);
}
.record-row.client.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.1), rgba(34, 197, 94, 0.08));
  border-color: rgba(16, 185, 129, 0.3);
}
.record-row .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.record-row .sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.records-empty {
  padding: 12px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 14px;
  flex-wrap: wrap;
}
.detail-header .title-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.detail-header h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}
.detail-header .id-row {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-section {
  margin-bottom: 20px;
}
.detail-section .section-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.field-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 8px;
  transition: border-color 0.15s ease;
}
.field-card:hover {
  border-color: var(--card-border-hover);
}
.field-card .field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.field-card .field-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field-card .field-actions {
  display: flex;
  gap: 6px;
}
.field-card .copy-btn {
  all: unset;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--input-bg);
  border: 1px solid var(--card-border);
}
.field-card .copy-btn:hover {
  color: var(--text-primary);
  background: var(--card-hover);
}

.rich-editor,
.rich-display {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 24px;
}
.rich-editor[contenteditable="true"]:focus {
  background: rgba(59, 130, 246, 0.05);
  border-radius: 6px;
  padding: 4px 6px;
  margin: -4px -6px;
}

.rich-toolbar {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--panel);
  margin-bottom: 8px;
}
.rich-toolbar button {
  all: unset;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.rich-toolbar button:hover {
  background: var(--card-hover);
  color: var(--text-primary);
}
.rich-toolbar button.active {
  background: rgba(59, 130, 246, 0.2);
  color: var(--text-primary);
}

/* ============ Prompts screen ============ */
.prompts-screen {
  padding: 28px;
}
.prompts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.prompts-toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.prompt-section {
  margin-bottom: 26px;
}
.prompt-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.prompt-card {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prompt-card .prompt-field {
  font-size: 14px;
  font-weight: 600;
}
.prompt-card .prompt-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.prompt-card .prompt-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tag-pill {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}
.prompt-card-actions {
  display: flex;
  gap: 8px;
}
.prompt-card-actions button {
  all: unset;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  transition: background 0.15s ease;
}
.prompt-card-actions button:hover {
  background: var(--card-hover);
  color: var(--text-primary);
}
.prompt-card-actions button.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}

.bundle-card {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(6, 182, 212, 0.05));
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bundle-card.client {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(34, 197, 94, 0.05));
  border-color: rgba(16, 185, 129, 0.25);
}

/* ============ Overlays ============ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.overlay-card {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: min(460px, 92vw);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.overlay-card h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 6px 0 0;
}
.overlay-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}
.processing-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(59, 130, 246, 0.25);
  border-top-color: var(--blue-500);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.success-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.18);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
}
.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 14px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--grad-brand);
  width: 0%;
  transition: width 0.25s ease;
}
.processing-step {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* ============ Dialog ============ */
.dialog {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  background: var(--panel);
  color: var(--text-primary);
  padding: 0;
  max-width: 560px;
  width: 92vw;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
.dialog.large-dialog {
  max-width: 720px;
}
.dialog::backdrop {
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(6px);
}
.dialog-form {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--divider);
}
.dialog-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.dialog-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--divider);
}

/* ============ Pipeline panel ============ */
.pipeline-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 90;
  width: min(380px, calc(100vw - 40px));
  max-height: min(68vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  animation: pipeline-in 0.2s ease;
}
@keyframes pipeline-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.pipeline-panel[hidden] { display: none !important; }
.pipeline-panel.collapsed {
  width: auto;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.pipeline-chip {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--card-border);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.pipeline-chip:hover { background: var(--card-hover); }
.pipeline-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-500);
}
.pipeline-chip .dot.pulse {
  animation: pulse-dot 1.1s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.72); }
}
.pipeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
  font-size: 14px;
}
.pipeline-header strong {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.pipeline-list {
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pipeline-job {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.pipeline-job.status-done {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}
.pipeline-job.status-error {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}
.pipeline-job.status-canceled {
  border-color: var(--card-border);
  background: rgba(255, 255, 255, 0.03);
  opacity: 0.75;
}
.pipeline-job .name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pipeline-job .name-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.pipeline-cancel {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.pipeline-cancel:hover {
  color: #fff;
  background: rgba(239, 68, 68, 0.85);
  border-color: rgba(239, 68, 68, 0.85);
}
.pipeline-job .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pipeline-job .detail {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}
.pipeline-job .progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.pipeline-job .progress .fill {
  height: 100%;
  background: var(--grad-brand);
  transition: width 0.3s ease;
}
.pipeline-job .stage-dots {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}
.pipeline-job .stage-dot {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.3s ease;
}
.pipeline-job .stage-dot.complete {
  background: var(--emerald-500);
}
.pipeline-job .stage-dot.active {
  background: var(--blue-500);
  animation: stage-active 1.4s ease-in-out infinite;
}
@keyframes stage-active {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.pipeline-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.pipeline-view {
  all: unset;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--grad-brand);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.18);
  transition: filter 0.15s ease;
}
.pipeline-view:hover { filter: brightness(1.08); }
.pipeline-dismiss {
  all: unset;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
}
.pipeline-dismiss:hover {
  background: var(--card-hover);
  color: var(--text-primary);
}

/* ============ Draft banner ============ */
.draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(6, 182, 212, 0.08));
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text-primary);
}
.draft-banner[hidden] { display: none !important; }
.draft-banner .draft-banner-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.draft-banner .draft-banner-label span {
  color: var(--text-secondary);
  font-size: 12px;
}
.draft-banner button {
  padding: 6px 12px;
  font-size: 12px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.9);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  z-index: 200;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ Empty state ============ */
.empty-state {
  padding: 36px 24px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--card-border);
  background: var(--card);
  text-align: center;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.empty-state strong {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.spinner-inline {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--blue-500);
  animation: spin 0.9s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Scrollbars */
.main-pane::-webkit-scrollbar,
.records-list::-webkit-scrollbar,
.uploader-files::-webkit-scrollbar,
.dialog-body::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.main-pane::-webkit-scrollbar-thumb,
.records-list::-webkit-scrollbar-thumb,
.uploader-files::-webkit-scrollbar-thumb,
.dialog-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}
.main-pane::-webkit-scrollbar-thumb:hover,
.records-list::-webkit-scrollbar-thumb:hover,
.uploader-files::-webkit-scrollbar-thumb:hover,
.dialog-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
